import os.path
import sys

sys.path.append(os.path.dirname(__file__))  # let code under test load stubs
from device_test import DeviceTestCase

class TestMikrotik60GModels(DeviceTestCase):
    def test_mikrotik_mikrotik_60g_CubeG_5ac60ay_7_4_1_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.CubeG-5ac60ay.7.4.1.01")
        exp_info = {
                'model': 'CubeG-5ac60ay',
                'rf_chan_width': 2160,
                'rf_freq': 64800,
                'sta_count': 1,
                'sw_version': '7.4.1',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 282493330855,
                'dl_en_packets': 359934336,
                'dl_noise_floor': None,
                'dl_rf_bytes': 282381732919,
                'dl_rf_packets': 317808191,
                'en_if_speed': 1000000000,
                'mem': 27.8533935546875,
                'serial_number': 'HCR08713BMQ',
                'ssid': 'damon20',
                'system_mac_address': '18:fd:74:3d:d1:05',
                'ul_en_bytes': 69225552014,
                'ul_en_packets': 161227621,
                'ul_noise_floor': None,
                'ul_rf_bytes': 68634069388,
                'ul_rf_packets': 159834417
        }
        exp_sta_stats = {
                '04:ce:14:fa:4b:dd': {       'alt_macs': {       '18:fd:74:3d:d1:ac',
                                                                 '18:fd:74:3d:d1:ad'},
                                             'dev_macs': {       '04:ce:14:fa:4b:df',
                                                                 '18:fd:74:3d:d1:ac',
                                                                 '5c:a6:e6:36:74:05'},
                                             'dl_link_rate': 2502000000,
                                             'dl_mcs': 10,
                                             'dl_noise_floor': -150.0,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': -50.0,
                                             'dl_snr': 100.0,
                                             'ip_address': '10.4.0.125',
                                             'mac_address': '04:ce:14:fa:4b:dd',
                                             'name': '4246 - Chase Austin - (60ghz)',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': 3080000000,
                                             'ul_mcs': 9,
                                             'ul_noise_floor': -139.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -59,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '13',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '68634069388',
                                                              'in_ucast_pkts': '159834417',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '04:ce:14:fa:4b:df',
                                                                                                                        '18:fd:74:3d:d1:ac',
                                                                                                                        '5c:a6:e6:36:74:05'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '68634069388',
                                                                                       'in_ucast_pkts': '159834417',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:ce:14:fa:4b:dd',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '282381732919',
                                                                                       'out_ucast_pkts': '317808191'}],
                                                              'mac_address': '04:ce:14:fa:4b:df',
                                                              'mtu': 1500,
                                                              'name': 'wlan60',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '282381732919',
                                                              'out_ucast_pkts': '317808191',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 64800,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 660,
                                                                                                                                            'mac_address': '04:ce:14:fa:4b:dd',
                                                                                                                                            'noise_floor': -139.0,
                                                                                                                                            'rssi': -59.0,
                                                                                                                                            'rx_link_rate': '3080000000',
                                                                                                                                            'rx_mcs': 9,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2502000000',
                                                                                                                                            'tx_mcs': 10}],
                                                                                                                   'noise_floor': -139.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'damon20'}],
                                                              'speed': '2502000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '42063599',
                                                              'in_octets': '282493330855',
                                                              'in_ucast_pkts': '317870737',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '18:fd:74:3d:d1:05',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '1369332',
                                                              'out_octets': '69225552014',
                                                              'out_ucast_pkts': '159858289',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 27.853394,
                                'model': 'CubeG-5ac60ay',
                                'poller_hash': 'BM4U+kvf',
                                'serial_number': 'HCR08713BMQ',
                                'sw_version': '7.4.1',
                                'system_mac_address': '18:fd:74:3d:d1:05',
                                'uptime': '2108078'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '282381732919',
                                                                       'in_ucast_pkts': '317808191',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '282381732919',
                                                                                                'in_ucast_pkts': '317808191',
                                                                                                'mac_address': '04:ce:14:fa:4b:df',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '68634069388',
                                                                                                'out_ucast_pkts': '159834417'}],
                                                                       'mac_address': '04:ce:14:fa:4b:dd',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '68634069388',
                                                                       'out_ucast_pkts': '159834417',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 660,
                                                                                                                                                     'mac_address': '04:ce:14:fa:4b:df',
                                                                                                                                                     'noise_floor': -150.0,
                                                                                                                                                     'rssi': -50.0,
                                                                                                                                                     'rx_link_rate': '2502000000',
                                                                                                                                                     'rx_mcs': 10,
                                                                                                                                                     'snr': 100.0,
                                                                                                                                                     'tx_link_rate': '3080000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'damon20'}]},
                                                               {       'bridged_mac_addresses': [       '5c:a6:e6:36:74:05'],
                                                                       'id': '2',
                                                                       'in_octets': '68634069388',
                                                                       'in_ucast_pkts': '159834417',
                                                                       'name': 'ether1',
                                                                       'out_octets': '282381732919',
                                                                       'out_ucast_pkts': '317808191',
                                                                       'poller_hash': 'MDRjZTE0ZmE0YmRkZXRoZXIx'}],
                                         'management_ip': '10.4.0.125',
                                         'manufacturer': 'Mikrotik',
                                         'model': 'CubeG-5ac60ay',
                                         'name': '4246 - Chase Austin - (60ghz)',
                                         'poller_hash': 'BM4U+kvd',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '7.4.1'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_CubeG_5ac60ay_SA_7_4_1_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.CubeG-5ac60ay-SA.7.4.1.01")
        exp_info = {
                'model': 'CubeG-5ac60ay-SA',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 1,
                'sw_version': '7.4.1',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 223140538414,
                'dl_en_packets': 549017489,
                'dl_noise_floor': None,
                'dl_rf_bytes': 219430335281,
                'dl_rf_packets': 457400547,
                'en_if_speed': 1000000000,
                'mem': 28.96728515625,
                'serial_number': 'HCV080HXV2V',
                'ssid': 'UW_60PRO_AC_NE',
                'system_mac_address': '18:fd:74:5b:9b:a2',
                'ul_en_bytes': 116873546482,
                'ul_en_packets': 220234301,
                'ul_noise_floor': None,
                'ul_rf_bytes': 88733558184,
                'ul_rf_packets': 224186341
        }
        exp_sta_stats = {
                '04:ce:14:fa:4b:82': {       'alt_macs': None,
                                             'dev_macs': {       '04:ce:14:fa:50:6d',
                                                                 '24:5a:4c:e1:24:79'},
                                             'dl_link_rate': 962000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.10.21.166',
                                             'mac_address': '04:ce:14:fa:4b:82',
                                             'name': 'Conley and Amanda Banman',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 3,
                                             'ul_noise_floor': -103.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -63,
                                             'ul_snr': 40}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '88733558184',
                                                              'in_ucast_pkts': '224186341',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '04:ce:14:fa:50:6d',
                                                                                                                        '24:5a:4c:e1:24:79'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '83174057838',
                                                                                       'in_ucast_pkts': '218320821',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:ce:14:fa:4b:82',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '210528982733',
                                                                                       'out_ucast_pkts': '447277046'}],
                                                              'mac_address': '04:ce:14:fa:50:6d',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '219430335281',
                                                              'out_ucast_pkts': '457400547',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 459,
                                                                                                                                            'mac_address': '04:ce:14:fa:4b:82',
                                                                                                                                            'noise_floor': -103.0,
                                                                                                                                            'rssi': -63.0,
                                                                                                                                            'rx_mcs': 3,
                                                                                                                                            'snr': 40.0,
                                                                                                                                            'tx_link_rate': '962000000'}],
                                                                                                                   'noise_floor': -103.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'UW_60PRO_AC_NE'}],
                                                              'speed': '962000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '3',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '92825114',
                                                              'in_octets': '223140538414',
                                                              'in_ucast_pkts': '456192375',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '18:fd:74:5b:9b:a2',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '236597',
                                                              'out_octets': '116873546482',
                                                              'out_ucast_pkts': '219997704',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 28.967285,
                                'model': 'CubeG-5ac60ay-SA',
                                'poller_hash': 'BM4U+lBt',
                                'serial_number': 'HCV080HXV2V',
                                'sw_version': '7.4.1',
                                'system_mac_address': '18:fd:74:5b:9b:a2',
                                'uptime': '2812862'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '210528982733',
                                                                       'in_ucast_pkts': '447277046',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '210528982733',
                                                                                                'in_ucast_pkts': '447277046',
                                                                                                'mac_address': '04:ce:14:fa:50:6d',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '83174057838',
                                                                                                'out_ucast_pkts': '218320821'}],
                                                                       'mac_address': '04:ce:14:fa:4b:82',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '83174057838',
                                                                       'out_ucast_pkts': '218320821',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 459,
                                                                                                                                                     'mac_address': '04:ce:14:fa:50:6d',
                                                                                                                                                     'rx_link_rate': '962000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'UW_60PRO_AC_NE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '83174057838',
                                                                       'in_ucast_pkts': '218320821',
                                                                       'name': 'ether1',
                                                                       'out_octets': '210528982733',
                                                                       'out_ucast_pkts': '447277046',
                                                                       'poller_hash': 'MDRjZTE0ZmE0YjgyZXRoZXIx'}],
                                         'management_ip': '10.10.21.166',
                                         'manufacturer': 'Mikrotik',
                                         'name': 'Conley and Amanda Banman',
                                         'poller_hash': 'BM4U+kuC',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '7.4.1'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_Mikrotik_CubeG_5ac60ad_7_1_1_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.Mikrotik CubeG-5ac60ad.7.1.1.01")
        exp_info = {
                'model': 'CubeG-5ac60ad',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 1,
                'sw_version': '7.1.1',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 3609080896469,
                'dl_en_packets': 3148186979,
                'dl_noise_floor': None,
                'dl_rf_bytes': 3612343681616,
                'dl_rf_packets': 3146733780,
                'en_if_speed': 1000000000,
                'mem': 27.7252197265625,
                'serial_number': 'E2A50D683204',
                'ssid': 'MikroTik-f6083',
                'system_mac_address': '08:55:31:f6:00:83',
                'ul_en_bytes': 260513078614,
                'ul_en_packets': 1365817029,
                'ul_noise_floor': None,
                'ul_rf_bytes': 258929083328,
                'ul_rf_packets': 1471314760
        }
        exp_sta_stats = {
                '08:55:31:f6:01:03': {       'alt_macs': None,
                                             'dev_macs': set(),
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '08:55:31:f6:01:03',
                                             'name': 'MTik 60ghz Hasley Macdonald '
                                                     'Slave',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -144.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -64,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '258929083328',
                                                              'in_ucast_pkts': '1471314760',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '258749789770',
                                                                                       'in_ucast_pkts': '1469318330',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '08:55:31:f6:01:03',
                                                                                       'out_discards': '241',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '3612337764252',
                                                                                       'out_ucast_pkts': '3146727667'}],
                                                              'mac_address': '08:55:31:f6:00:84',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '241',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '3612343681616',
                                                              'out_ucast_pkts': '3146733780',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 416,
                                                                                                                                            'mac_address': '08:55:31:f6:01:03',
                                                                                                                                            'noise_floor': -144.0,
                                                                                                                                            'rssi': -64.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -144.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'MikroTik-f6083'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '3',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '122710844',
                                                              'in_octets': '3609080896469',
                                                              'in_ucast_pkts': '3025476135',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '08:55:31:f6:00:83',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '16806909',
                                                              'out_octets': '260513078614',
                                                              'out_ucast_pkts': '1349010120',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 27.72522,
                                'model': 'CubeG-5ac60ad',
                                'poller_hash': 'CFUx9gCE',
                                'serial_number': 'E2A50D683204',
                                'sw_version': '7.1.1',
                                'system_mac_address': '08:55:31:f6:00:83',
                                'uptime': '20588963'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '241',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '3612337764252',
                                                                       'in_ucast_pkts': '3146727667',
                                                                       'links': [       {       'in_discards': '241',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '3612337764252',
                                                                                                'in_ucast_pkts': '3146727667',
                                                                                                'mac_address': '08:55:31:f6:00:84',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '258749789770',
                                                                                                'out_ucast_pkts': '1469318330'}],
                                                                       'mac_address': '08:55:31:f6:01:03',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '258749789770',
                                                                       'out_ucast_pkts': '1469318330',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 416,
                                                                                                                                                     'mac_address': '08:55:31:f6:00:84',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'MikroTik-f6083'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '258749789770',
                                                                       'in_ucast_pkts': '1469318330',
                                                                       'name': 'ether1',
                                                                       'out_octets': '3612337764252',
                                                                       'out_ucast_pkts': '3146727667',
                                                                       'poller_hash': 'MDg1NTMxZjYwMTAzZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': 'MTik 60ghz Hasley Macdonald Slave',
                                         'poller_hash': 'CFUx9gED',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '7.1.1'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_Mikrotik_RB_CubeG_5ac60ad_6_48_1_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.Mikrotik RB CubeG-5ac60ad.6.48.1.01")
        exp_info = {
                'model': 'RB CubeG-5ac60ad',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 1,
                'sw_version': '6.48.1',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 1,
                'dl_en_bytes': 456167866220,
                'dl_en_packets': 10317422468,
                'dl_noise_floor': None,
                'dl_rf_bytes': 455339172455,
                'dl_rf_packets': 5169057167,
                'en_if_speed': 1000000000,
                'mem': 20.220947265625,
                'serial_number': 'E2A40E8D0F56',
                'ssid': 'MikroTik-4c9b4',
                'system_mac_address': '2c:c8:1b:4c:09:b4',
                'ul_en_bytes': 11778577445,
                'ul_en_packets': 30485052,
                'ul_noise_floor': None,
                'ul_rf_bytes': 9220494582,
                'ul_rf_packets': 103609274
        }
        exp_sta_stats = {
                '2c:c8:1b:4c:09:b2': {       'alt_macs': None,
                                             'dev_macs': set(),
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '192.168.88.3',
                                             'mac_address': '2c:c8:1b:4c:09:b2',
                                             'name': 'CSCD-Client',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -137.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -57,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 1.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '9220494582',
                                                              'in_ucast_pkts': '103609274',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '9215123069',
                                                                                       'in_ucast_pkts': '103350941',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '2c:c8:1b:4c:09:b2',
                                                                                       'out_discards': '4091',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '455203677631',
                                                                                       'out_ucast_pkts': '5167483438'}],
                                                              'mac_address': '2c:c8:1b:4c:09:b5',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '4091',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '455339172455',
                                                              'out_ucast_pkts': '5169057167',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 505,
                                                                                                                                            'mac_address': '2c:c8:1b:4c:09:b2',
                                                                                                                                            'noise_floor': -137.0,
                                                                                                                                            'rssi': -57.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -137.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'MikroTik-4c9b4'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '3',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '5140695866',
                                                              'in_octets': '456167866220',
                                                              'in_ucast_pkts': '5176726602',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '2c:c8:1b:4c:09:b4',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '6316196',
                                                              'out_octets': '11778577445',
                                                              'out_ucast_pkts': '24168856',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.220947,
                                'model': 'RB CubeG-5ac60ad',
                                'poller_hash': 'LMgbTAm1',
                                'serial_number': 'E2A40E8D0F56',
                                'sw_version': '6.48.1',
                                'system_mac_address': '2c:c8:1b:4c:09:b4',
                                'uptime': '9234400'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '4091',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '455203677631',
                                                                       'in_ucast_pkts': '5167483438',
                                                                       'links': [       {       'in_discards': '4091',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '455203677631',
                                                                                                'in_ucast_pkts': '5167483438',
                                                                                                'mac_address': '2c:c8:1b:4c:09:b5',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '9215123069',
                                                                                                'out_ucast_pkts': '103350941'}],
                                                                       'mac_address': '2c:c8:1b:4c:09:b2',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '9215123069',
                                                                       'out_ucast_pkts': '103350941',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 505,
                                                                                                                                                     'mac_address': '2c:c8:1b:4c:09:b5',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'MikroTik-4c9b4'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '9215123069',
                                                                       'in_ucast_pkts': '103350941',
                                                                       'name': 'ether1',
                                                                       'out_octets': '455203677631',
                                                                       'out_ucast_pkts': '5167483438',
                                                                       'poller_hash': 'MmNjODFiNGMwOWIyZXRoZXIx'}],
                                         'management_ip': '192.168.88.3',
                                         'manufacturer': 'Mikrotik',
                                         'name': 'CSCD-Client',
                                         'poller_hash': 'LMgbTAmy',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.48.1'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_nRAYG_60ad_7_3_1_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.nRAYG-60ad.7.3.1.01")
        exp_info = {
                'model': 'nRAYG-60ad',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 1,
                'sw_version': '7.3.1',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 11,
                'dl_en_bytes': 93662988795676,
                'dl_en_packets': 140958190278,
                'dl_noise_floor': None,
                'dl_rf_bytes': 93662033349142,
                'dl_rf_packets': 139973765321,
                'en_if_speed': 1000000000,
                'mem': 54.345703125,
                'serial_number': 'DB8C0D328AEB',
                'ssid': 'AN-CPE-CPW-TIK',
                'system_mac_address': '08:55:31:56:ed:e5',
                'ul_en_bytes': 175220759806802,
                'ul_en_packets': 199046487497,
                'ul_noise_floor': None,
                'ul_rf_bytes': 175215795703673,
                'ul_rf_packets': 198950202522
        }
        exp_sta_stats = {
                '08:55:31:54:d8:e8': {       'alt_macs': {'08:55:31:54:d8:e7'},
                                             'dev_macs': {       '00:0b:78:66:f2:8d',
                                                                 '00:90:0b:4f:de:12',
                                                                 '00:90:0b:4f:de:2a',
                                                                 '00:90:7f:07:c9:ce',
                                                                 '00:c0:b7:74:cd:d8',
                                                                 '00:e0:67:2b:a7:ba',
                                                                 '08:55:31:06:c1:fd',
                                                                 '08:55:31:0c:0f:43',
                                                                 '08:55:31:0c:0f:4a',
                                                                 '08:55:31:42:29:23',
                                                                 '08:55:31:42:29:2a',
                                                                 '08:55:31:56:ed:e6',
                                                                 '08:55:31:91:84:f3',
                                                                 '0c:75:bd:96:ac:85',
                                                                 '18:e8:29:40:f1:6d',
                                                                 '18:fd:74:10:04:51',
                                                                 '18:fd:74:19:78:0e',
                                                                 '24:5a:4c:0e:15:ce',
                                                                 '24:5a:4c:5f:0c:7a',
                                                                 '24:5a:4c:5f:0c:92',
                                                                 '24:5a:4c:e2:71:d2',
                                                                 '24:5a:4c:e2:7a:39',
                                                                 '2c:c8:1b:e1:b4:5b',
                                                                 '2c:c8:1b:e1:b4:61',
                                                                 '48:8f:5a:21:99:41',
                                                                 '48:8f:5a:45:2e:63',
                                                                 '48:8f:5a:45:2e:8a',
                                                                 '48:8f:5a:7e:b0:98',
                                                                 '48:8f:5a:81:6b:27',
                                                                 '64:12:25:4d:bd:70',
                                                                 '70:4c:a5:cf:13:bd',
                                                                 '74:4d:28:f0:c1:f3',
                                                                 '74:83:c2:52:75:a9',
                                                                 '74:83:c2:64:ae:21',
                                                                 '74:83:c2:64:bd:93',
                                                                 '74:ac:b9:47:35:09',
                                                                 '74:ac:b9:fe:a0:bc',
                                                                 '78:8a:20:1c:32:b9',
                                                                 '78:8a:20:ac:16:bd',
                                                                 '78:8a:20:e4:2e:e1',
                                                                 '78:8a:20:e4:95:1b',
                                                                 '80:2a:a8:a4:07:bd',
                                                                 '94:56:41:64:fe:17',
                                                                 '9c:3d:cf:5b:21:c6',
                                                                 'b4:fb:e4:68:0d:05',
                                                                 'cc:2d:e0:9d:ff:7f',
                                                                 'd4:76:a0:52:44:a8',
                                                                 'e0:63:da:62:5f:8e',
                                                                 'e0:63:da:d2:52:82',
                                                                 'e0:63:da:dc:48:80',
                                                                 'ec:13:b2:92:df:e8',
                                                                 'ec:b9:07:02:89:57',
                                                                 'f4:92:bf:32:b2:50',
                                                                 'f4:92:bf:bc:8d:0e',
                                                                 'f4:92:bf:f8:f2:f9',
                                                                 'fc:ec:da:6c:3a:20',
                                                                 'fc:ec:da:dc:94:a5',
                                                                 'fc:ec:da:dc:ff:2b'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '08:55:31:54:d8:e8',
                                             'name': 'CPW-CPE SU',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -131.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -51,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 11.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '974634286',
                                                              'in_octets': '93662988795676',
                                                              'in_ucast_pkts': '139983555992',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '08:55:31:56:ed:e5',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '82750177',
                                                              'out_octets': '175220759806802',
                                                              'out_ucast_pkts': '198963737320',
                                                              'speed': '1000000000',
                                                              'type': 6},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '175215795703673',
                                                              'in_ucast_pkts': '198950202522',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '00:0b:78:66:f2:8d',
                                                                                                                        '00:90:0b:4f:de:12',
                                                                                                                        '00:90:0b:4f:de:2a',
                                                                                                                        '00:90:7f:07:c9:ce',
                                                                                                                        '00:c0:b7:74:cd:d8',
                                                                                                                        '00:e0:67:2b:a7:ba',
                                                                                                                        '08:55:31:06:c1:fd',
                                                                                                                        '08:55:31:0c:0f:43',
                                                                                                                        '08:55:31:0c:0f:4a',
                                                                                                                        '08:55:31:42:29:23',
                                                                                                                        '08:55:31:42:29:2a',
                                                                                                                        '08:55:31:56:ed:e6',
                                                                                                                        '08:55:31:91:84:f3',
                                                                                                                        '0c:75:bd:96:ac:85',
                                                                                                                        '18:e8:29:40:f1:6d',
                                                                                                                        '18:fd:74:10:04:51',
                                                                                                                        '18:fd:74:19:78:0e',
                                                                                                                        '24:5a:4c:0e:15:ce',
                                                                                                                        '24:5a:4c:5f:0c:7a',
                                                                                                                        '24:5a:4c:5f:0c:92',
                                                                                                                        '24:5a:4c:e2:71:d2',
                                                                                                                        '24:5a:4c:e2:7a:39',
                                                                                                                        '2c:c8:1b:e1:b4:5b',
                                                                                                                        '2c:c8:1b:e1:b4:61',
                                                                                                                        '48:8f:5a:21:99:41',
                                                                                                                        '48:8f:5a:45:2e:63',
                                                                                                                        '48:8f:5a:45:2e:8a',
                                                                                                                        '48:8f:5a:7e:b0:98',
                                                                                                                        '48:8f:5a:81:6b:27',
                                                                                                                        '64:12:25:4d:bd:70',
                                                                                                                        '70:4c:a5:cf:13:bd',
                                                                                                                        '74:4d:28:f0:c1:f3',
                                                                                                                        '74:83:c2:52:75:a9',
                                                                                                                        '74:83:c2:64:ae:21',
                                                                                                                        '74:83:c2:64:bd:93',
                                                                                                                        '74:ac:b9:47:35:09',
                                                                                                                        '74:ac:b9:fe:a0:bc',
                                                                                                                        '78:8a:20:1c:32:b9',
                                                                                                                        '78:8a:20:ac:16:bd',
                                                                                                                        '78:8a:20:e4:2e:e1',
                                                                                                                        '78:8a:20:e4:95:1b',
                                                                                                                        '80:2a:a8:a4:07:bd',
                                                                                                                        '94:56:41:64:fe:17',
                                                                                                                        '9c:3d:cf:5b:21:c6',
                                                                                                                        'b4:fb:e4:68:0d:05',
                                                                                                                        'cc:2d:e0:9d:ff:7f',
                                                                                                                        'd4:76:a0:52:44:a8',
                                                                                                                        'e0:63:da:62:5f:8e',
                                                                                                                        'e0:63:da:d2:52:82',
                                                                                                                        'e0:63:da:dc:48:80',
                                                                                                                        'ec:13:b2:92:df:e8',
                                                                                                                        'ec:b9:07:02:89:57',
                                                                                                                        'f4:92:bf:32:b2:50',
                                                                                                                        'f4:92:bf:bc:8d:0e',
                                                                                                                        'f4:92:bf:f8:f2:f9',
                                                                                                                        'fc:ec:da:6c:3a:20',
                                                                                                                        'fc:ec:da:dc:94:a5',
                                                                                                                        'fc:ec:da:dc:ff:2b'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '175215795703673',
                                                                                       'in_ucast_pkts': '198950202522',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '08:55:31:54:d8:e8',
                                                                                       'out_discards': '805',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '93662033349142',
                                                                                       'out_ucast_pkts': '139973765321'}],
                                                              'mac_address': '08:55:31:56:ed:e6',
                                                              'mtu': 1500,
                                                              'name': 'wlan60',
                                                              'oper_up': True,
                                                              'out_discards': '805',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '93662033349142',
                                                              'out_ucast_pkts': '139973765321',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 77,
                                                                                                                                            'mac_address': '08:55:31:54:d8:e8',
                                                                                                                                            'noise_floor': -131.0,
                                                                                                                                            'rssi': -51.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -131.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'AN-CPE-CPW-TIK'}],
                                                              'speed': '2310000000',
                                                              'type': 71}],
                                'manufacturer': 'Mikrotik',
                                'mem': 54.345703,
                                'model': 'nRAYG-60ad',
                                'poller_hash': 'CFUxVu3m',
                                'serial_number': 'DB8C0D328AEB',
                                'sw_version': '7.3.1',
                                'system_mac_address': '08:55:31:56:ed:e5',
                                'uptime': '26927235'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '805',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '93662033349142',
                                                                       'in_ucast_pkts': '139973765321',
                                                                       'links': [       {       'in_discards': '805',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '93662033349142',
                                                                                                'in_ucast_pkts': '139973765321',
                                                                                                'mac_address': '08:55:31:56:ed:e6',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '175215795703673',
                                                                                                'out_ucast_pkts': '198950202522'}],
                                                                       'mac_address': '08:55:31:54:d8:e8',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '175215795703673',
                                                                       'out_ucast_pkts': '198950202522',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 77,
                                                                                                                                                     'mac_address': '08:55:31:56:ed:e6',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'AN-CPE-CPW-TIK'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '175215795703673',
                                                                       'in_ucast_pkts': '198950202522',
                                                                       'mac_address': '08:55:31:54:d8:e7',
                                                                       'name': 'ether1',
                                                                       'out_octets': '93662033349142',
                                                                       'out_ucast_pkts': '139973765321',
                                                                       'poller_hash': 'MDg1NTMxNTRkOGU4ZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': 'CPW-CPE SU',
                                         'poller_hash': 'CFUxVNjo',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '7.3.1',
                                         'system_mac_address': '08:55:31:54:d8:e7'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RB_CubeG_5ac60ay_6_49_6_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RB CubeG-5ac60ay.6.49.6.01")
        exp_info = {
                'model': 'RB CubeG-5ac60ay',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 1,
                'sw_version': '6.49.6',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 164409900857,
                'dl_en_packets': 385651643,
                'dl_noise_floor': None,
                'dl_rf_bytes': 164530826600,
                'dl_rf_packets': 268403250,
                'en_if_speed': 1000000000,
                'mem': 22.2564697265625,
                'serial_number': 'HCK083N7KKQ',
                'ssid': 'UW_PTP_3_TO_BIGSTARR',
                'system_mac_address': '18:fd:74:15:c0:df',
                'ul_en_bytes': 20776369030,
                'ul_en_packets': 80855043,
                'ul_noise_floor': None,
                'ul_rf_bytes': 20804124906,
                'ul_rf_packets': 108991554
        }
        exp_sta_stats = {
                '04:ce:14:fc:60:36': {       'alt_macs': None,
                                             'dev_macs': {       '04:ce:14:fc:5f:bd',
                                                                 '18:fd:74:15:c0:e7',
                                                                 '48:8f:5a:ac:f6:28'},
                                             'dl_link_rate': 2502000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.10.22.33',
                                             'mac_address': '04:ce:14:fc:60:36',
                                             'name': 'UW_PTP_3_TO_BIGSTARR_2',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 9,
                                             'ul_noise_floor': -118.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -38,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '20804124906',
                                                              'in_ucast_pkts': '108991554',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '04:ce:14:fc:5f:bd',
                                                                                                                        '18:fd:74:15:c0:e7',
                                                                                                                        '48:8f:5a:ac:f6:28'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '20804124906',
                                                                                       'in_ucast_pkts': '108991554',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:ce:14:fc:60:36',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '164530826600',
                                                                                       'out_ucast_pkts': '268403250'}],
                                                              'mac_address': '04:ce:14:fc:5f:bd',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '164530826600',
                                                              'out_ucast_pkts': '268403250',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 48,
                                                                                                                                            'mac_address': '04:ce:14:fc:60:36',
                                                                                                                                            'noise_floor': -118.0,
                                                                                                                                            'rssi': -38.0,
                                                                                                                                            'rx_mcs': 9,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2502000000'}],
                                                                                                                   'noise_floor': -118.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'UW_PTP_3_TO_BIGSTARR'}],
                                                              'speed': '2502000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '3',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '122909164',
                                                              'in_octets': '164409900857',
                                                              'in_ucast_pkts': '262742479',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '18:fd:74:15:c0:df',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '2450263',
                                                              'out_octets': '20776369030',
                                                              'out_ucast_pkts': '78404780',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 22.25647,
                                'model': 'RB CubeG-5ac60ay',
                                'poller_hash': 'BM4U/F+9',
                                'serial_number': 'HCK083N7KKQ',
                                'sw_version': '6.49.6',
                                'system_mac_address': '18:fd:74:15:c0:df',
                                'uptime': '3976582'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '164530826600',
                                                                       'in_ucast_pkts': '268403250',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '164530826600',
                                                                                                'in_ucast_pkts': '268403250',
                                                                                                'mac_address': '04:ce:14:fc:5f:bd',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '20804124906',
                                                                                                'out_ucast_pkts': '108991554'}],
                                                                       'mac_address': '04:ce:14:fc:60:36',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '20804124906',
                                                                       'out_ucast_pkts': '108991554',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 48,
                                                                                                                                                     'mac_address': '04:ce:14:fc:5f:bd',
                                                                                                                                                     'rx_link_rate': '2502000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'UW_PTP_3_TO_BIGSTARR'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '20804124906',
                                                                       'in_ucast_pkts': '108991554',
                                                                       'name': 'ether1',
                                                                       'out_octets': '164530826600',
                                                                       'out_ucast_pkts': '268403250',
                                                                       'poller_hash': 'MDRjZTE0ZmM2MDM2ZXRoZXIx'}],
                                         'management_ip': '10.10.22.33',
                                         'manufacturer': 'Mikrotik',
                                         'name': 'UW_PTP_3_TO_BIGSTARR_2',
                                         'poller_hash': 'BM4U/GA2',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.49.6'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RB_CubeG_5ac60ay_SA_6_49_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RB CubeG-5ac60ay-SA.6.49.01")
        exp_info = {
                'model': 'RB CubeG-5ac60ay-SA',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 6,
                'sw_version': '6.49',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 13633187406697,
                'dl_en_packets': 11128551936,
                'dl_noise_floor': None,
                'dl_rf_bytes': 13813645422772,
                'dl_rf_packets': 13097995126,
                'en_if_speed': 1000000000,
                'mem': 21.80633544921875,
                'serial_number': 'HCW08AZ1DN5',
                'ssid': 'foothills2ay-ap2',
                'system_mac_address': '18:fd:74:61:31:31',
                'ul_en_bytes': 788413175194,
                'ul_en_packets': 4308660950,
                'ul_noise_floor': None,
                'ul_rf_bytes': 802212036390,
                'ul_rf_packets': 4805684355
        }
        exp_sta_stats = {
                '04:ce:14:fa:4b:eb': {       'alt_macs': None,
                                             'dev_macs': {       '08:55:31:2b:9a:b1',
                                                                 '18:fd:74:3d:cf:97'},
                                             'dl_link_rate': 1540000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:ce:14:fa:4b:eb',
                                             'name': '18:FD:74:3D:CF:97 Stevens-42070',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 6,
                                             'ul_noise_floor': -145.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -55,
                                             'ul_snr': 90},
                '04:ce:14:fc:62:97': {       'alt_macs': None,
                                             'dev_macs': {       '18:fd:74:14:d0:80',
                                                                 '48:a9:8a:01:0a:4a'},
                                             'dl_link_rate': 2502000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:ce:14:fc:62:97',
                                             'name': '18:FD:74:14:D0:80 Perris-41920',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 9,
                                             'ul_noise_floor': -151.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -56,
                                             'ul_snr': 95},
                '08:55:31:75:38:c8': {       'alt_macs': {'08:55:31:75:38:c7'},
                                             'dev_macs': {'dc:2c:6e:b1:ed:33'},
                                             'dl_link_rate': 385000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '08:55:31:75:38:c8',
                                             'name': '08:55:31:75:38:C7 Bigler-41146',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 1,
                                             'ul_noise_floor': -75.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -55,
                                             'ul_snr': 20},
                '18:fd:74:89:69:c5': {       'alt_macs': {'18:fd:74:89:69:c4'},
                                             'dev_macs': {'18:fd:74:68:59:e5'},
                                             'dl_link_rate': 385000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '18:fd:74:89:69:c5',
                                             'name': '18:FD:74:89:69:C4 Shakely-41710',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 1,
                                             'ul_noise_floor': -78.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -58,
                                             'ul_snr': 20},
                '30:ab:6a:fc:db:69': {       'alt_macs': None,
                                             'dev_macs': {       '04:ce:14:fa:5f:a8',
                                                                 '08:55:31:3e:d4:f7',
                                                                 'dc:2c:6e:b3:c6:26'},
                                             'dl_link_rate': 1925000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '30:ab:6a:fc:db:69',
                                             'name': '08:55:31:3E:D4:F7 Orden-41342',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 7,
                                             'ul_noise_floor': -133.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -53,
                                             'ul_snr': 80},
                '48:8f:5a:e3:97:f8': {       'alt_macs': {'48:8f:5a:e3:97:f7'},
                                             'dev_macs': {'a4:13:4e:dd:09:c9'},
                                             'dl_link_rate': 1155000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:e3:97:f8',
                                             'name': '48:8F:5A:E3:97:F7 Takacs-36469',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 4,
                                             'ul_noise_floor': -108.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -68,
                                             'ul_snr': 40}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '802212036390',
                                                              'in_ucast_pkts': '4805684355',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '04:ce:14:fa:5f:a8',
                                                                                                                        '08:55:31:3e:d4:f7',
                                                                                                                        'dc:2c:6e:b3:c6:26'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '50986127544',
                                                                                       'in_ucast_pkts': '410228222',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '30:ab:6a:fc:db:69',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1102136665996',
                                                                                       'out_ucast_pkts': '1325201236'},
                                                                               {       'bridged_mac_addresses': [       '18:fd:74:14:d0:80',
                                                                                                                        '48:a9:8a:01:0a:4a'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '49488542926',
                                                                                       'in_ucast_pkts': '539254445',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:ce:14:fc:62:97',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '974841618409',
                                                                                       'out_ucast_pkts': '1134937652'},
                                                                               {       'bridged_mac_addresses': [       '08:55:31:2b:9a:b1',
                                                                                                                        '18:fd:74:3d:cf:97'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '87562104195',
                                                                                       'in_ucast_pkts': '395427327',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:ce:14:fa:4b:eb',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '922150589627',
                                                                                       'out_ucast_pkts': '990451320'},
                                                                               {       'bridged_mac_addresses': [       '18:fd:74:68:59:e5'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '331731905068',
                                                                                       'in_ucast_pkts': '2060173646',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '18:fd:74:89:69:c5',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '6128846024836',
                                                                                       'out_ucast_pkts': '5065155187'},
                                                                               {       'bridged_mac_addresses': [       'a4:13:4e:dd:09:c9'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '154165700548',
                                                                                       'in_ucast_pkts': '971419233',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:e3:97:f8',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '2844714221536',
                                                                                       'out_ucast_pkts': '2637075641'},
                                                                               {       'bridged_mac_addresses': [       'dc:2c:6e:b1:ed:33'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '90431076006',
                                                                                       'in_ucast_pkts': '340231793',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '08:55:31:75:38:c8',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1519229696952',
                                                                                       'out_ucast_pkts': '1666589828'}],
                                                              'mac_address': '04:ce:14:fa:5f:a8',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '13813645422772',
                                                              'out_ucast_pkts': '13097995126',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 110,
                                                                                                                                            'mac_address': '30:ab:6a:fc:db:69',
                                                                                                                                            'noise_floor': -133.0,
                                                                                                                                            'rssi': -53.0,
                                                                                                                                            'rx_mcs': 7,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '1925000000'},
                                                                                                                                    {       'distance': 254,
                                                                                                                                            'mac_address': '04:ce:14:fc:62:97',
                                                                                                                                            'noise_floor': -151.0,
                                                                                                                                            'rssi': -56.0,
                                                                                                                                            'rx_mcs': 9,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2502000000'},
                                                                                                                                    {       'distance': 218,
                                                                                                                                            'mac_address': '04:ce:14:fa:4b:eb',
                                                                                                                                            'noise_floor': -145.0,
                                                                                                                                            'rssi': -55.0,
                                                                                                                                            'rx_mcs': 6,
                                                                                                                                            'snr': 90.0,
                                                                                                                                            'tx_link_rate': '1540000000'},
                                                                                                                                    {       'distance': 213,
                                                                                                                                            'mac_address': '18:fd:74:89:69:c5',
                                                                                                                                            'noise_floor': -78.0,
                                                                                                                                            'rssi': -58.0,
                                                                                                                                            'rx_mcs': 1,
                                                                                                                                            'snr': 20.0,
                                                                                                                                            'tx_link_rate': '385000000'},
                                                                                                                                    {       'distance': 675,
                                                                                                                                            'mac_address': '48:8f:5a:e3:97:f8',
                                                                                                                                            'noise_floor': -108.0,
                                                                                                                                            'rssi': -68.0,
                                                                                                                                            'rx_mcs': 4,
                                                                                                                                            'snr': 40.0,
                                                                                                                                            'tx_link_rate': '1155000000'},
                                                                                                                                    {       'distance': 675,
                                                                                                                                            'mac_address': '08:55:31:75:38:c8',
                                                                                                                                            'noise_floor': -75.0,
                                                                                                                                            'rssi': -55.0,
                                                                                                                                            'rx_mcs': 1,
                                                                                                                                            'snr': 20.0,
                                                                                                                                            'tx_link_rate': '385000000'}],
                                                                                                                   'noise_floor': -75.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'foothills2ay-ap2'}],
                                                              'speed': '2502000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '3',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '626959059',
                                                              'in_octets': '13633187406697',
                                                              'in_ucast_pkts': '10501592877',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '18:fd:74:61:31:31',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '8376875',
                                                              'out_octets': '788413175194',
                                                              'out_ucast_pkts': '4300284075',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.806335,
                                'model': 'RB CubeG-5ac60ay-SA',
                                'poller_hash': 'BM4U+l+o',
                                'serial_number': 'HCW08AZ1DN5',
                                'sw_version': '6.49',
                                'system_mac_address': '18:fd:74:61:31:31',
                                'uptime': '14854545'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1102136665996',
                                                                       'in_ucast_pkts': '1325201236',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1102136665996',
                                                                                                'in_ucast_pkts': '1325201236',
                                                                                                'mac_address': '04:ce:14:fa:5f:a8',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '50986127544',
                                                                                                'out_ucast_pkts': '410228222'}],
                                                                       'mac_address': '30:ab:6a:fc:db:69',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '50986127544',
                                                                       'out_ucast_pkts': '410228222',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 110,
                                                                                                                                                     'mac_address': '04:ce:14:fa:5f:a8',
                                                                                                                                                     'rx_link_rate': '1925000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'foothills2ay-ap2'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '50986127544',
                                                                       'in_ucast_pkts': '410228222',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1102136665996',
                                                                       'out_ucast_pkts': '1325201236',
                                                                       'poller_hash': 'MzBhYjZhZmNkYjY5ZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': '08:55:31:3E:D4:F7 Orden-41342',
                                         'poller_hash': 'MKtq/Ntp',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.49'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '974841618409',
                                                                       'in_ucast_pkts': '1134937652',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '974841618409',
                                                                                                'in_ucast_pkts': '1134937652',
                                                                                                'mac_address': '04:ce:14:fa:5f:a8',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '49488542926',
                                                                                                'out_ucast_pkts': '539254445'}],
                                                                       'mac_address': '04:ce:14:fc:62:97',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '49488542926',
                                                                       'out_ucast_pkts': '539254445',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 254,
                                                                                                                                                     'mac_address': '04:ce:14:fa:5f:a8',
                                                                                                                                                     'rx_link_rate': '2502000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'foothills2ay-ap2'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '49488542926',
                                                                       'in_ucast_pkts': '539254445',
                                                                       'name': 'ether1',
                                                                       'out_octets': '974841618409',
                                                                       'out_ucast_pkts': '1134937652',
                                                                       'poller_hash': 'MDRjZTE0ZmM2Mjk3ZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': '18:FD:74:14:D0:80 Perris-41920',
                                         'poller_hash': 'BM4U/GKX',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.49.3'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '922150589627',
                                                                       'in_ucast_pkts': '990451320',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '922150589627',
                                                                                                'in_ucast_pkts': '990451320',
                                                                                                'mac_address': '04:ce:14:fa:5f:a8',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '87562104195',
                                                                                                'out_ucast_pkts': '395427327'}],
                                                                       'mac_address': '04:ce:14:fa:4b:eb',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '87562104195',
                                                                       'out_ucast_pkts': '395427327',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 218,
                                                                                                                                                     'mac_address': '04:ce:14:fa:5f:a8',
                                                                                                                                                     'rx_link_rate': '1540000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'foothills2ay-ap2'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '87562104195',
                                                                       'in_ucast_pkts': '395427327',
                                                                       'name': 'ether1',
                                                                       'out_octets': '922150589627',
                                                                       'out_ucast_pkts': '990451320',
                                                                       'poller_hash': 'MDRjZTE0ZmE0YmViZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': '18:FD:74:3D:CF:97 Stevens-42070',
                                         'poller_hash': 'BM4U+kvr',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.49'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '6128846024836',
                                                                       'in_ucast_pkts': '5065155187',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '6128846024836',
                                                                                                'in_ucast_pkts': '5065155187',
                                                                                                'mac_address': '04:ce:14:fa:5f:a8',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '331731905068',
                                                                                                'out_ucast_pkts': '2060173646'}],
                                                                       'mac_address': '18:fd:74:89:69:c5',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '331731905068',
                                                                       'out_ucast_pkts': '2060173646',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 213,
                                                                                                                                                     'mac_address': '04:ce:14:fa:5f:a8',
                                                                                                                                                     'rx_link_rate': '385000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'foothills2ay-ap2'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '331731905068',
                                                                       'in_ucast_pkts': '2060173646',
                                                                       'mac_address': '18:fd:74:89:69:c4',
                                                                       'name': 'ether1',
                                                                       'out_octets': '6128846024836',
                                                                       'out_ucast_pkts': '5065155187',
                                                                       'poller_hash': 'MThmZDc0ODk2OWM1ZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': '18:FD:74:89:69:C4 Shakely-41710',
                                         'poller_hash': 'GP10iWnF',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.49.6',
                                         'system_mac_address': '18:fd:74:89:69:c4'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '2844714221536',
                                                                       'in_ucast_pkts': '2637075641',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '2844714221536',
                                                                                                'in_ucast_pkts': '2637075641',
                                                                                                'mac_address': '04:ce:14:fa:5f:a8',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '154165700548',
                                                                                                'out_ucast_pkts': '971419233'}],
                                                                       'mac_address': '48:8f:5a:e3:97:f8',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '154165700548',
                                                                       'out_ucast_pkts': '971419233',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 675,
                                                                                                                                                     'mac_address': '04:ce:14:fa:5f:a8',
                                                                                                                                                     'rx_link_rate': '1155000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'foothills2ay-ap2'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '154165700548',
                                                                       'in_ucast_pkts': '971419233',
                                                                       'mac_address': '48:8f:5a:e3:97:f7',
                                                                       'name': 'ether1',
                                                                       'out_octets': '2844714221536',
                                                                       'out_ucast_pkts': '2637075641',
                                                                       'poller_hash': 'NDg4ZjVhZTM5N2Y4ZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': '48:8F:5A:E3:97:F7 Takacs-36469',
                                         'poller_hash': 'SI9a45f4',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.49',
                                         'system_mac_address': '48:8f:5a:e3:97:f7'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1519229696952',
                                                                       'in_ucast_pkts': '1666589828',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1519229696952',
                                                                                                'in_ucast_pkts': '1666589828',
                                                                                                'mac_address': '04:ce:14:fa:5f:a8',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '90431076006',
                                                                                                'out_ucast_pkts': '340231793'}],
                                                                       'mac_address': '08:55:31:75:38:c8',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '90431076006',
                                                                       'out_ucast_pkts': '340231793',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 675,
                                                                                                                                                     'mac_address': '04:ce:14:fa:5f:a8',
                                                                                                                                                     'rx_link_rate': '385000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'foothills2ay-ap2'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '90431076006',
                                                                       'in_ucast_pkts': '340231793',
                                                                       'mac_address': '08:55:31:75:38:c7',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1519229696952',
                                                                       'out_ucast_pkts': '1666589828',
                                                                       'poller_hash': 'MDg1NTMxNzUzOGM4ZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': '08:55:31:75:38:C7 Bigler-41146',
                                         'poller_hash': 'CFUxdTjI',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.49',
                                         'system_mac_address': '08:55:31:75:38:c7'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBLHGG_60ad_6_44_1_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBLHGG-60ad.6.44.1.01")
        exp_info = {
                'model': 'RBLHGG-60ad',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 1,
                'sw_version': '6.44.1',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 1593727279493,
                'dl_en_packets': 1496462907,
                'dl_noise_floor': None,
                'dl_rf_bytes': 1585473194386,
                'dl_rf_packets': 1460876111,
                'en_if_speed': 1000000000,
                'mem': 20.11260986328125,
                'serial_number': '90CB0900EA5E',
                'ssid': 'MikroTik-934cb7',
                'system_mac_address': 'b8:69:f4:93:4c:b7',
                'ul_en_bytes': 142466847457,
                'ul_en_packets': 816657899,
                'ul_noise_floor': None,
                'ul_rf_bytes': 136809976320,
                'ul_rf_packets': 783104687
        }
        exp_sta_stats = {
                'b8:69:f4:93:4c:64': {       'alt_macs': {'b8:69:f4:93:4c:63'},
                                             'dev_macs': {       '00:0b:82:d3:65:46',
                                                                 '00:0b:82:d7:35:64',
                                                                 '00:15:6d:9c:16:09',
                                                                 '00:27:22:06:e0:ef',
                                                                 '18:e8:29:34:d5:d5',
                                                                 '18:e8:29:8c:a9:a8',
                                                                 '60:02:b4:53:a6:1d',
                                                                 '64:d1:54:ef:e1:c5',
                                                                 '64:d1:54:ef:e1:c6',
                                                                 '74:4d:28:2a:b2:36',
                                                                 '74:4d:28:81:1b:40',
                                                                 '74:4d:28:be:f2:7f',
                                                                 '74:4d:28:bf:cf:c3',
                                                                 '74:4d:28:bf:cf:c7',
                                                                 '74:4d:28:bf:da:d6',
                                                                 '76:4d:28:59:83:d9',
                                                                 '80:97:1b:00:cd:57',
                                                                 'b4:fb:e4:19:3e:e0',
                                                                 'b4:fb:e4:4f:04:6f',
                                                                 'b4:fb:e4:6a:5f:7b',
                                                                 'b4:fb:e4:6a:67:c9',
                                                                 'b8:69:f4:0c:3d:58',
                                                                 'b8:69:f4:93:4c:b8',
                                                                 'b8:69:f4:ca:3c:51',
                                                                 'cc:2d:e0:ed:fb:ac',
                                                                 'cc:2d:e0:ed:fb:ad',
                                                                 'fc:ec:da:dc:cb:85'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': 'b8:69:f4:93:4c:64',
                                             'name': 'GMBH_Morty',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -141.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -61,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '136809976320',
                                                              'in_ucast_pkts': '783104687',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '00:0b:82:d3:65:46',
                                                                                                                        '00:0b:82:d7:35:64',
                                                                                                                        '00:15:6d:9c:16:09',
                                                                                                                        '00:27:22:06:e0:ef',
                                                                                                                        '18:e8:29:34:d5:d5',
                                                                                                                        '18:e8:29:8c:a9:a8',
                                                                                                                        '60:02:b4:53:a6:1d',
                                                                                                                        '64:d1:54:ef:e1:c5',
                                                                                                                        '64:d1:54:ef:e1:c6',
                                                                                                                        '74:4d:28:2a:b2:36',
                                                                                                                        '74:4d:28:81:1b:40',
                                                                                                                        '74:4d:28:be:f2:7f',
                                                                                                                        '74:4d:28:bf:cf:c3',
                                                                                                                        '74:4d:28:bf:cf:c7',
                                                                                                                        '74:4d:28:bf:da:d6',
                                                                                                                        '76:4d:28:59:83:d9',
                                                                                                                        '80:97:1b:00:cd:57',
                                                                                                                        'b4:fb:e4:19:3e:e0',
                                                                                                                        'b4:fb:e4:4f:04:6f',
                                                                                                                        'b4:fb:e4:6a:5f:7b',
                                                                                                                        'b4:fb:e4:6a:67:c9',
                                                                                                                        'b8:69:f4:0c:3d:58',
                                                                                                                        'b8:69:f4:93:4c:b8',
                                                                                                                        'b8:69:f4:ca:3c:51',
                                                                                                                        'cc:2d:e0:ed:fb:ac',
                                                                                                                        'cc:2d:e0:ed:fb:ad',
                                                                                                                        'fc:ec:da:dc:cb:85'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '136809976320',
                                                                                       'in_ucast_pkts': '783104687',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': 'b8:69:f4:93:4c:64',
                                                                                       'out_discards': '487',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1585473194386',
                                                                                       'out_ucast_pkts': '1460876111'}],
                                                              'mac_address': 'b8:69:f4:93:4c:b8',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '487',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '1585473194386',
                                                              'out_ucast_pkts': '1460876111',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 1286,
                                                                                                                                            'mac_address': 'b8:69:f4:93:4c:64',
                                                                                                                                            'noise_floor': -141.0,
                                                                                                                                            'rssi': -61.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -141.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'MikroTik-934cb7'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '1593727279493',
                                                              'in_ucast_pkts': '1496462907',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'b8:69:f4:93:4c:b7',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '142466847457',
                                                              'out_ucast_pkts': '816657899',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.11261,
                                'model': 'RBLHGG-60ad',
                                'poller_hash': 'uGn0k0y4',
                                'serial_number': '90CB0900EA5E',
                                'sw_version': '6.44.1',
                                'system_mac_address': 'b8:69:f4:93:4c:b7',
                                'uptime': '5311892'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '487',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1585473194386',
                                                                       'in_ucast_pkts': '1460876111',
                                                                       'links': [       {       'in_discards': '487',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1585473194386',
                                                                                                'in_ucast_pkts': '1460876111',
                                                                                                'mac_address': 'b8:69:f4:93:4c:b8',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '136809976320',
                                                                                                'out_ucast_pkts': '783104687'}],
                                                                       'mac_address': 'b8:69:f4:93:4c:64',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '136809976320',
                                                                       'out_ucast_pkts': '783104687',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 1286,
                                                                                                                                                     'mac_address': 'b8:69:f4:93:4c:b8',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'MikroTik-934cb7'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '136809976320',
                                                                       'in_ucast_pkts': '783104687',
                                                                       'mac_address': 'b8:69:f4:93:4c:63',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1585473194386',
                                                                       'out_ucast_pkts': '1460876111',
                                                                       'poller_hash': 'Yjg2OWY0OTM0YzY0ZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': 'GMBH_Morty',
                                         'poller_hash': 'uGn0k0xk',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.44.1',
                                         'system_mac_address': 'b8:69:f4:93:4c:63'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBLHGG_60ad_None_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBLHGG-60ad.None.01")
        exp_info = {
                'model': 'RBLHGG-60ad',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 1,
                'sw_version': '6.44.1',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 344216361050,
                'dl_en_packets': 1938397108,
                'dl_noise_floor': None,
                'dl_rf_bytes': 343571794449,
                'dl_rf_packets': 1931847940,
                'en_if_speed': 1000000000,
                'mem': 19.78912353515625,
                'serial_number': '9B9D094B966D',
                'ssid': 'MikroTik-544668',
                'system_mac_address': 'b8:69:f4:54:46:68',
                'ul_en_bytes': 351800761603,
                'ul_en_packets': 2013228405,
                'ul_noise_floor': None,
                'ul_rf_bytes': 345626457565,
                'ul_rf_packets': 2004807368
        }
        exp_sta_stats = {
                '24:18:1d:92:0c:d1': {       'alt_macs': None,
                                             'dev_macs': {       '24:18:1d:92:0a:0e',
                                                                 'b8:69:f4:1d:a5:73',
                                                                 'b8:69:f4:54:46:5f'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.0.1.149',
                                             'mac_address': '24:18:1d:92:0c:d1',
                                             'name': 'C1303-PTP-CPE',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -145.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -65,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '345626457565',
                                                              'in_ucast_pkts': '2004807368',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '24:18:1d:92:0a:0e',
                                                                                                                        'b8:69:f4:1d:a5:73',
                                                                                                                        'b8:69:f4:54:46:5f'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '345626457565',
                                                                                       'in_ucast_pkts': '2004807368',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:92:0c:d1',
                                                                                       'out_discards': '4705',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '343571794449',
                                                                                       'out_ucast_pkts': '1931847940'}],
                                                              'mac_address': '24:18:1d:92:0a:0e',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '4705',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '343571794449',
                                                              'out_ucast_pkts': '1931847940',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 548,
                                                                                                                                            'mac_address': '24:18:1d:92:0c:d1',
                                                                                                                                            'noise_floor': -145.0,
                                                                                                                                            'rssi': -65.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -145.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'MikroTik-544668'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '344216361050',
                                                              'in_ucast_pkts': '1938397108',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'b8:69:f4:54:46:68',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '351800761603',
                                                              'out_ucast_pkts': '2013228405',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 19.789124,
                                'model': 'RBLHGG-60ad',
                                'poller_hash': 'JBgdkgoO',
                                'serial_number': '9B9D094B966D',
                                'sw_version': '6.44.1',
                                'system_mac_address': 'b8:69:f4:54:46:68',
                                'uptime': '15074000'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '4705',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '343571794449',
                                                                       'in_ucast_pkts': '1931847940',
                                                                       'links': [       {       'in_discards': '4705',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '343571794449',
                                                                                                'in_ucast_pkts': '1931847940',
                                                                                                'mac_address': '24:18:1d:92:0a:0e',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '345626457565',
                                                                                                'out_ucast_pkts': '2004807368'}],
                                                                       'mac_address': '24:18:1d:92:0c:d1',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '345626457565',
                                                                       'out_ucast_pkts': '2004807368',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 548,
                                                                                                                                                     'mac_address': '24:18:1d:92:0a:0e',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'MikroTik-544668'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '345626457565',
                                                                       'in_ucast_pkts': '2004807368',
                                                                       'name': 'ether1',
                                                                       'out_octets': '343571794449',
                                                                       'out_ucast_pkts': '1931847940',
                                                                       'poller_hash': 'MjQxODFkOTIwY2QxZXRoZXIx'}],
                                         'management_ip': '10.0.1.149',
                                         'manufacturer': 'Mikrotik',
                                         'name': 'C1303-PTP-CPE',
                                         'poller_hash': 'JBgdkgzR',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.44.1'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBSXTsq_60ad_6_47_9_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBSXTsq-60ad.6.47.9.01")
        exp_info = {
                'model': 'RBSXTsq-60ad',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 1,
                'sw_version': '6.47.9',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 1,
                'dl_en_bytes': 778773563,
                'dl_en_packets': 14179117,
                'dl_noise_floor': None,
                'dl_rf_bytes': 2724988702,
                'dl_rf_packets': 54605387,
                'en_if_speed': 100000000,
                'mem': 37.24365234375,
                'serial_number': 'A1BD09E38AA9',
                'ssid': 'border.co.za_ClaasANCABH',
                'system_mac_address': 'b8:69:f4:50:65:bd',
                'ul_en_bytes': 1028267478,
                'ul_en_packets': 6680485,
                'ul_noise_floor': None,
                'ul_rf_bytes': 2517711788,
                'ul_rf_packets': 52374598
        }
        exp_sta_stats = {
                '24:18:1d:9a:96:5f': {       'alt_macs': None,
                                             'dev_macs': set(),
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:9a:96:5f',
                                             'name': 'ANCAClaasBH',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -145.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -50,
                                             'ul_snr': 95}
        }
        exp_ne_msg = {
                'data': {       'cpu': 1.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '2517711788',
                                                              'in_ucast_pkts': '52374598',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '2517711788',
                                                                                       'in_ucast_pkts': '52374598',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:9a:96:5f',
                                                                                       'out_discards': '1607',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '2724988702',
                                                                                       'out_ucast_pkts': '54605387'}],
                                                              'mac_address': '24:18:1d:9c:4c:6a',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '1607',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '2724988702',
                                                              'out_ucast_pkts': '54605387',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 20,
                                                                                                                                            'mac_address': '24:18:1d:9a:96:5f',
                                                                                                                                            'noise_floor': -145.0,
                                                                                                                                            'rssi': -50.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -145.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'border.co.za_ClaasANCABH'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '4805477',
                                                              'in_octets': '778773563',
                                                              'in_ucast_pkts': '9373640',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'b8:69:f4:50:65:bd',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '937949',
                                                              'out_octets': '1028267478',
                                                              'out_ucast_pkts': '5742536',
                                                              'speed': '100000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 37.243652,
                                'model': 'RBSXTsq-60ad',
                                'poller_hash': 'JBgdnExq',
                                'serial_number': 'A1BD09E38AA9',
                                'sw_version': '6.47.9',
                                'system_mac_address': 'b8:69:f4:50:65:bd',
                                'uptime': '5128417'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1607',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '2724988702',
                                                                       'in_ucast_pkts': '54605387',
                                                                       'links': [       {       'in_discards': '1607',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '2724988702',
                                                                                                'in_ucast_pkts': '54605387',
                                                                                                'mac_address': '24:18:1d:9c:4c:6a',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '2517711788',
                                                                                                'out_ucast_pkts': '52374598'}],
                                                                       'mac_address': '24:18:1d:9a:96:5f',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '2517711788',
                                                                       'out_ucast_pkts': '52374598',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 20,
                                                                                                                                                     'mac_address': '24:18:1d:9c:4c:6a',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'border.co.za_ClaasANCABH'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '2517711788',
                                                                       'in_ucast_pkts': '52374598',
                                                                       'name': 'ether1',
                                                                       'out_octets': '2724988702',
                                                                       'out_ucast_pkts': '54605387',
                                                                       'poller_hash': 'MjQxODFkOWE5NjVmZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': 'ANCAClaasBH',
                                         'poller_hash': 'JBgdmpZf',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.47.9'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_6_42_12_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad.6.42.12.01")
        exp_info = {
                'model': 'RBwAPG-60ad',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 2,
                'sw_version': '6.42.12',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 575482089922,
                'dl_en_packets': 4763690380,
                'dl_noise_floor': None,
                'dl_rf_bytes': 11263202233028,
                'dl_rf_packets': 16920802575,
                'en_if_speed': 1000000000,
                'mem': 21.9268798828125,
                'serial_number': '8B94079AD7B4',
                'ssid': 'new60hotness',
                'system_mac_address': '64:d1:54:ee:17:96',
                'ul_en_bytes': 13843331039168,
                'ul_en_packets': 10108908581,
                'ul_noise_floor': None,
                'ul_rf_bytes': 24471313175552,
                'ul_rf_packets': 21718532864
        }
        exp_sta_stats = {
                '04:d6:aa:a8:4c:47': {       'alt_macs': None,
                                             'dev_macs': {       '00:27:22:c6:ef:31',
                                                                 '4c:5e:0c:02:b8:59',
                                                                 '64:d1:54:76:c1:7c',
                                                                 '74:4d:28:4a:d1:64',
                                                                 '80:2a:a8:64:f6:93',
                                                                 'cc:2d:e0:af:6e:09',
                                                                 'ec:13:b2:61:5b:c4',
                                                                 'ec:13:b2:61:8a:be'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:4c:47',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -137.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -57,
                                             'ul_snr': 80},
                '30:07:4d:43:04:33': {       'alt_macs': None,
                                             'dev_macs': {       '30:07:4d:7c:94:22',
                                                                 '60:38:e0:87:13:9f',
                                                                 '64:d1:54:ee:17:82',
                                                                 '74:4d:28:a6:c9:0e',
                                                                 'cc:2d:e0:fc:c5:78',
                                                                 'cc:40:d0:0a:29:5f',
                                                                 'ec:13:b2:62:42:9a'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '30:07:4d:43:04:33',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -140.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -55,
                                             'ul_snr': 85}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '24471313175552',
                                                              'in_ucast_pkts': '21718532864',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '00:27:22:c6:ef:31',
                                                                                                                        '4c:5e:0c:02:b8:59',
                                                                                                                        '64:d1:54:76:c1:7c',
                                                                                                                        '74:4d:28:4a:d1:64',
                                                                                                                        '80:2a:a8:64:f6:93',
                                                                                                                        'cc:2d:e0:af:6e:09',
                                                                                                                        'ec:13:b2:61:5b:c4',
                                                                                                                        'ec:13:b2:61:8a:be'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '23997969669627',
                                                                                       'in_ucast_pkts': '17456277237',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:4c:47',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1056091049647',
                                                                                       'out_ucast_pkts': '8851797036'},
                                                                               {       'bridged_mac_addresses': [       '30:07:4d:7c:94:22',
                                                                                                                        '60:38:e0:87:13:9f',
                                                                                                                        '64:d1:54:ee:17:82',
                                                                                                                        '74:4d:28:a6:c9:0e',
                                                                                                                        'cc:2d:e0:fc:c5:78',
                                                                                                                        'cc:40:d0:0a:29:5f',
                                                                                                                        'ec:13:b2:62:42:9a'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '473343505925',
                                                                                       'in_ucast_pkts': '4262255627',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '30:07:4d:43:04:33',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '10207111183381',
                                                                                       'out_ucast_pkts': '8069005539'}],
                                                              'mac_address': '30:07:4d:7c:94:22',
                                                              'mtu': 1560,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '11263202233028',
                                                              'out_ucast_pkts': '16920802575',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 32,
                                                                                                                                            'mac_address': '04:d6:aa:a8:4c:47',
                                                                                                                                            'noise_floor': -137.0,
                                                                                                                                            'rssi': -57.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 29,
                                                                                                                                            'mac_address': '30:07:4d:43:04:33',
                                                                                                                                            'noise_floor': -140.0,
                                                                                                                                            'rssi': -55.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 85.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -137.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'new60hotness'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '575482089922',
                                                              'in_ucast_pkts': '4763690380',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '64:d1:54:ee:17:96',
                                                              'mtu': 1560,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '13843331039168',
                                                              'out_ucast_pkts': '10108908581',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.92688,
                                'model': 'RBwAPG-60ad',
                                'poller_hash': 'MAdNfJQi',
                                'serial_number': '8B94079AD7B4',
                                'sw_version': '6.42.12',
                                'system_mac_address': '64:d1:54:ee:17:96',
                                'uptime': '16970168'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1056091049647',
                                                                       'in_ucast_pkts': '8851797036',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1056091049647',
                                                                                                'in_ucast_pkts': '8851797036',
                                                                                                'mac_address': '30:07:4d:7c:94:22',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '23997969669627',
                                                                                                'out_ucast_pkts': '17456277237'}],
                                                                       'mac_address': '04:d6:aa:a8:4c:47',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '23997969669627',
                                                                       'out_ucast_pkts': '17456277237',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 32,
                                                                                                                                                     'mac_address': '30:07:4d:7c:94:22',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'new60hotness'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '23997969669627',
                                                                       'in_ucast_pkts': '17456277237',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1056091049647',
                                                                       'out_ucast_pkts': '8851797036',
                                                                       'poller_hash': 'MDRkNmFhYTg0YzQ3ZXRoZXIx'}],
                                         'poller_hash': 'BNaqqExH',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '10207111183381',
                                                                       'in_ucast_pkts': '8069005539',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '10207111183381',
                                                                                                'in_ucast_pkts': '8069005539',
                                                                                                'mac_address': '30:07:4d:7c:94:22',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '473343505925',
                                                                                                'out_ucast_pkts': '4262255627'}],
                                                                       'mac_address': '30:07:4d:43:04:33',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '473343505925',
                                                                       'out_ucast_pkts': '4262255627',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 29,
                                                                                                                                                     'mac_address': '30:07:4d:7c:94:22',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'new60hotness'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '473343505925',
                                                                       'in_ucast_pkts': '4262255627',
                                                                       'name': 'ether1',
                                                                       'out_octets': '10207111183381',
                                                                       'out_ucast_pkts': '8069005539',
                                                                       'poller_hash': 'MzAwNzRkNDMwNDMzZXRoZXIx'}],
                                         'poller_hash': 'MAdNQwQz',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_6_43_4_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad.6.43.4.01")
        exp_info = {
                'model': 'RBwAPG-60ad',
                'rf_chan_width': 2160,
                'rf_freq': 64800,
                'sta_count': 1,
                'sw_version': '6.43.4',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 786269214344,
                'dl_en_packets': 751888796,
                'dl_noise_floor': None,
                'dl_rf_bytes': 806524043545,
                'dl_rf_packets': 1421021594,
                'en_if_speed': 1000000000,
                'mem': 14.970703125000002,
                'serial_number': '8B9408348106',
                'ssid': 'MikroTik-48cb83',
                'system_mac_address': 'cc:2d:e0:48:cb:83',
                'ul_en_bytes': 256372185281,
                'ul_en_packets': 492537642,
                'ul_noise_floor': None,
                'ul_rf_bytes': 277012950504,
                'ul_rf_packets': 1175588713
        }
        exp_sta_stats = {
                '30:07:4d:7f:53:0a': {       'alt_macs': None,
                                             'dev_macs': {       '30:07:4d:7f:53:4d',
                                                                 'cc:2d:e0:48:cb:6f',
                                                                 'ec:13:b2:92:29:f8'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '30:07:4d:7f:53:0a',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -130.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -65,
                                             'ul_snr': 65}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '277012950504',
                                                              'in_ucast_pkts': '1175588713',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '30:07:4d:7f:53:4d',
                                                                                                                        'cc:2d:e0:48:cb:6f',
                                                                                                                        'ec:13:b2:92:29:f8'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '277012950504',
                                                                                       'in_ucast_pkts': '1175588713',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '30:07:4d:7f:53:0a',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '806524043545',
                                                                                       'out_ucast_pkts': '1421021594'}],
                                                              'mac_address': '30:07:4d:7f:53:4d',
                                                              'mtu': 1560,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '806524043545',
                                                              'out_ucast_pkts': '1421021594',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 64800,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 170,
                                                                                                                                            'mac_address': '30:07:4d:7f:53:0a',
                                                                                                                                            'noise_floor': -130.0,
                                                                                                                                            'rssi': -65.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -130.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'MikroTik-48cb83'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '786269214344',
                                                              'in_ucast_pkts': '751888796',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:48:cb:83',
                                                              'mtu': 1560,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '256372185281',
                                                              'out_ucast_pkts': '492537642',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 14.970703,
                                'model': 'RBwAPG-60ad',
                                'poller_hash': 'MAdNf1NN',
                                'serial_number': '8B9408348106',
                                'sw_version': '6.43.4',
                                'system_mac_address': 'cc:2d:e0:48:cb:83',
                                'uptime': '15078913'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '806524043545',
                                                                       'in_ucast_pkts': '1421021594',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '806524043545',
                                                                                                'in_ucast_pkts': '1421021594',
                                                                                                'mac_address': '30:07:4d:7f:53:4d',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '277012950504',
                                                                                                'out_ucast_pkts': '1175588713'}],
                                                                       'mac_address': '30:07:4d:7f:53:0a',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '277012950504',
                                                                       'out_ucast_pkts': '1175588713',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 170,
                                                                                                                                                     'mac_address': '30:07:4d:7f:53:4d',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'MikroTik-48cb83'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '277012950504',
                                                                       'in_ucast_pkts': '1175588713',
                                                                       'name': 'ether1',
                                                                       'out_octets': '806524043545',
                                                                       'out_ucast_pkts': '1421021594',
                                                                       'poller_hash': 'MzAwNzRkN2Y1MzBhZXRoZXIx'}],
                                         'poller_hash': 'MAdNf1MK',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_6_44_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad.6.44.01")
        exp_info = {
                'model': 'RBwAPG-60ad',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 2,
                'sw_version': '6.44',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 46109013089,
                'dl_en_packets': 48063421,
                'dl_noise_floor': None,
                'dl_rf_bytes': 47624807732,
                'dl_rf_packets': 75780693,
                'en_if_speed': 1000000000,
                'mem': 18.42041015625,
                'serial_number': '8B9508552284',
                'ssid': 'NU1-NE60G',
                'system_mac_address': 'cc:2d:e0:e2:ef:1e',
                'ul_en_bytes': 4398012842,
                'ul_en_packets': 28995833,
                'ul_noise_floor': None,
                'ul_rf_bytes': 5360307761,
                'ul_rf_packets': 51456041
        }
        exp_sta_stats = {
                '04:d6:aa:aa:68:e9': {       'alt_macs': None,
                                             'dev_macs': {       '04:d6:aa:a8:0f:26',
                                                                 '64:d1:54:40:08:b4',
                                                                 'b8:69:f4:0e:84:23',
                                                                 'f4:1b:a1:8b:fc:dc'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:aa:68:e9',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -152.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -57,
                                             'ul_snr': 95},
                '04:d6:aa:aa:69:06': {       'alt_macs': None,
                                             'dev_macs': {       '4c:18:9a:83:cc:9f',
                                                                 '64:d1:54:40:08:c0'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:aa:69:06',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -129.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -64,
                                             'ul_snr': 65}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '5360307761',
                                                              'in_ucast_pkts': '51456041',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '4c:18:9a:83:cc:9f',
                                                                                                                        '64:d1:54:40:08:c0'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '2870904965',
                                                                                       'in_ucast_pkts': '26919026',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:aa:69:06',
                                                                                       'out_discards': '13',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '25480982945',
                                                                                       'out_ucast_pkts': '39290596'},
                                                                               {       'bridged_mac_addresses': [       '04:d6:aa:a8:0f:26',
                                                                                                                        '64:d1:54:40:08:b4',
                                                                                                                        'b8:69:f4:0e:84:23',
                                                                                                                        'f4:1b:a1:8b:fc:dc'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '2489402796',
                                                                                       'in_ucast_pkts': '24537015',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:aa:68:e9',
                                                                                       'out_discards': '31',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '22143824787',
                                                                                       'out_ucast_pkts': '36490097'}],
                                                              'mac_address': '04:d6:aa:a8:0f:26',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '44',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '47624807732',
                                                              'out_ucast_pkts': '75780693',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 363,
                                                                                                                                            'mac_address': '04:d6:aa:aa:69:06',
                                                                                                                                            'noise_floor': -129.0,
                                                                                                                                            'rssi': -64.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 237,
                                                                                                                                            'mac_address': '04:d6:aa:aa:68:e9',
                                                                                                                                            'noise_floor': -152.0,
                                                                                                                                            'rssi': -57.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -129.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU1-NE60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '46109013089',
                                                              'in_ucast_pkts': '48063421',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:e2:ef:1e',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '4398012842',
                                                              'out_ucast_pkts': '28995833',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 18.42041,
                                'model': 'RBwAPG-60ad',
                                'poller_hash': 'BNaqqA8m',
                                'serial_number': '8B9508552284',
                                'sw_version': '6.44',
                                'system_mac_address': 'cc:2d:e0:e2:ef:1e',
                                'uptime': '1339803'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '13',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '25480982945',
                                                                       'in_ucast_pkts': '39290596',
                                                                       'links': [       {       'in_discards': '13',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '25480982945',
                                                                                                'in_ucast_pkts': '39290596',
                                                                                                'mac_address': '04:d6:aa:a8:0f:26',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '2870904965',
                                                                                                'out_ucast_pkts': '26919026'}],
                                                                       'mac_address': '04:d6:aa:aa:69:06',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '2870904965',
                                                                       'out_ucast_pkts': '26919026',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 363,
                                                                                                                                                     'mac_address': '04:d6:aa:a8:0f:26',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '2870904965',
                                                                       'in_ucast_pkts': '26919026',
                                                                       'name': 'ether1',
                                                                       'out_octets': '25480982945',
                                                                       'out_ucast_pkts': '39290596',
                                                                       'poller_hash': 'MDRkNmFhYWE2OTA2ZXRoZXIx'}],
                                         'poller_hash': 'BNaqqmkG',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '31',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '22143824787',
                                                                       'in_ucast_pkts': '36490097',
                                                                       'links': [       {       'in_discards': '31',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '22143824787',
                                                                                                'in_ucast_pkts': '36490097',
                                                                                                'mac_address': '04:d6:aa:a8:0f:26',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '2489402796',
                                                                                                'out_ucast_pkts': '24537015'}],
                                                                       'mac_address': '04:d6:aa:aa:68:e9',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '2489402796',
                                                                       'out_ucast_pkts': '24537015',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 237,
                                                                                                                                                     'mac_address': '04:d6:aa:a8:0f:26',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '2489402796',
                                                                       'in_ucast_pkts': '24537015',
                                                                       'name': 'ether1',
                                                                       'out_octets': '22143824787',
                                                                       'out_ucast_pkts': '36490097',
                                                                       'poller_hash': 'MDRkNmFhYWE2OGU5ZXRoZXIx'}],
                                         'poller_hash': 'BNaqqmjp',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_6_44_2_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad.6.44.2.01")
        exp_info = {
                'model': 'RBwAPG-60ad',
                'rf_chan_width': 2160,
                'rf_freq': 64800,
                'sta_count': 1,
                'sw_version': '6.44.2',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 245081705263,
                'dl_en_packets': 199827617,
                'dl_noise_floor': None,
                'dl_rf_bytes': 246005854540,
                'dl_rf_packets': 225428086,
                'en_if_speed': 1000000000,
                'mem': 19.43817138671875,
                'serial_number': '8B9408EF2722',
                'ssid': 'RedOak1',
                'system_mac_address': 'cc:2d:e0:62:2d:ab',
                'ul_en_bytes': 18789202517,
                'ul_en_packets': 135992734,
                'ul_noise_floor': None,
                'ul_rf_bytes': 19899569815,
                'ul_rf_packets': 169920872
        }
        exp_sta_stats = {
                '04:d6:aa:66:3d:76': {       'alt_macs': None,
                                             'dev_macs': {       '28:76:10:1a:0d:58',
                                                                 '30:07:4d:56:70:e9',
                                                                 '84:16:f9:58:f2:42',
                                                                 'cc:2d:e0:62:2d:c3'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:66:3d:76',
                                             'name': 'RedOak-STA-B9',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -117.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -67,
                                             'ul_snr': 50}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '19899569815',
                                                              'in_ucast_pkts': '169920872',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '28:76:10:1a:0d:58',
                                                                                                                        '30:07:4d:56:70:e9',
                                                                                                                        '84:16:f9:58:f2:42',
                                                                                                                        'cc:2d:e0:62:2d:c3'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '19899569815',
                                                                                       'in_ucast_pkts': '169920872',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:66:3d:76',
                                                                                       'out_discards': '307',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '246005854540',
                                                                                       'out_ucast_pkts': '225428086'}],
                                                              'mac_address': '30:07:4d:56:70:e9',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '307',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '246005854540',
                                                              'out_ucast_pkts': '225428086',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 64800,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 51,
                                                                                                                                            'mac_address': '04:d6:aa:66:3d:76',
                                                                                                                                            'noise_floor': -117.0,
                                                                                                                                            'rssi': -67.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -117.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'RedOak1'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '245081705263',
                                                              'in_ucast_pkts': '199827617',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:62:2d:ab',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '18789202517',
                                                              'out_ucast_pkts': '135992734',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 19.438171,
                                'model': 'RBwAPG-60ad',
                                'poller_hash': 'MAdNVnDp',
                                'serial_number': '8B9408EF2722',
                                'sw_version': '6.44.2',
                                'system_mac_address': 'cc:2d:e0:62:2d:ab',
                                'uptime': '3918420'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '307',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '246005854540',
                                                                       'in_ucast_pkts': '225428086',
                                                                       'links': [       {       'in_discards': '307',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '246005854540',
                                                                                                'in_ucast_pkts': '225428086',
                                                                                                'mac_address': '30:07:4d:56:70:e9',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '19899569815',
                                                                                                'out_ucast_pkts': '169920872'}],
                                                                       'mac_address': '04:d6:aa:66:3d:76',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '19899569815',
                                                                       'out_ucast_pkts': '169920872',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 51,
                                                                                                                                                     'mac_address': '30:07:4d:56:70:e9',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'RedOak1'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '19899569815',
                                                                       'in_ucast_pkts': '169920872',
                                                                       'name': 'ether1',
                                                                       'out_octets': '246005854540',
                                                                       'out_ucast_pkts': '225428086',
                                                                       'poller_hash': 'MDRkNmFhNjYzZDc2ZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': 'RedOak-STA-B9',
                                         'poller_hash': 'BNaqZj12',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.44.2'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_6_45_8_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad.6.45.8.01")
        exp_info = {
                'model': 'RBwAPG-60ad',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 4,
                'sw_version': '6.45.8',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 4744312846240,
                'dl_en_packets': 4209938248,
                'dl_noise_floor': None,
                'dl_rf_bytes': 4116848455962,
                'dl_rf_packets': 4270719295,
                'en_if_speed': 1000000000,
                'mem': 21.08917236328125,
                'serial_number': '8B9508552284',
                'ssid': 'NU1-NE60G',
                'system_mac_address': 'cc:2d:e0:e2:ef:1e',
                'ul_en_bytes': 385120841084,
                'ul_en_packets': 2050593648,
                'ul_noise_floor': None,
                'ul_rf_bytes': 301566749484,
                'ul_rf_packets': 2337988936
        }
        exp_sta_stats = {
                '04:d6:aa:aa:68:e9': {       'alt_macs': None,
                                             'dev_macs': {       '64:d1:54:40:08:b4',
                                                                 'b8:69:f4:0e:84:23'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:aa:68:e9',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -153.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -58,
                                             'ul_snr': 95},
                '04:d6:aa:aa:69:06': {       'alt_macs': None,
                                             'dev_macs': {       '64:d1:54:40:08:bc',
                                                                 '64:d1:54:40:08:c0'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:aa:69:06',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -117.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -67,
                                             'ul_snr': 50},
                '24:18:1d:63:63:c4': {       'alt_macs': None,
                                             'dev_macs': {       '00:1d:aa:f1:5e:c2',
                                                                 '04:d6:aa:a8:0f:26',
                                                                 'b8:69:f4:3f:bf:71'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:63:63:c4',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -118.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -68,
                                             'ul_snr': 50},
                '24:18:1d:99:68:99': {       'alt_macs': None,
                                             'dev_macs': {       'b8:69:f4:3f:9c:16',
                                                                 'cc:2d:e0:c8:44:69'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:68:99',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -139.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -59,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '301566749484',
                                                              'in_ucast_pkts': '2337988936',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '64:d1:54:40:08:bc',
                                                                                                                        '64:d1:54:40:08:c0'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '33289763462',
                                                                                       'in_ucast_pkts': '294897673',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:aa:69:06',
                                                                                       'out_discards': '19967',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '167933226272',
                                                                                       'out_ucast_pkts': '391258797'},
                                                                               {       'bridged_mac_addresses': [       'b8:69:f4:3f:9c:16',
                                                                                                                        'cc:2d:e0:c8:44:69'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '12243873781',
                                                                                       'in_ucast_pkts': '216008766',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:68:99',
                                                                                       'out_discards': '8563',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '9630689327',
                                                                                       'out_ucast_pkts': '223489969'},
                                                                               {       'bridged_mac_addresses': [       '00:1d:aa:f1:5e:c2',
                                                                                                                        '04:d6:aa:a8:0f:26',
                                                                                                                        'b8:69:f4:3f:bf:71'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '53623273480',
                                                                                       'in_ucast_pkts': '357248633',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:63:63:c4',
                                                                                       'out_discards': '39098',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '122453554213',
                                                                                       'out_ucast_pkts': '463883812'},
                                                                               {       'bridged_mac_addresses': [       '64:d1:54:40:08:b4',
                                                                                                                        'b8:69:f4:0e:84:23'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '199663279051',
                                                                                       'in_ucast_pkts': '1457757838',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:aa:68:e9',
                                                                                       'out_discards': '258335',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '3786253449736',
                                                                                       'out_ucast_pkts': '3165796979'}],
                                                              'mac_address': '04:d6:aa:a8:0f:26',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '326452',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '4116848455962',
                                                              'out_ucast_pkts': '4270719295',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 363,
                                                                                                                                            'mac_address': '04:d6:aa:aa:69:06',
                                                                                                                                            'noise_floor': -117.0,
                                                                                                                                            'rssi': -67.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 120,
                                                                                                                                            'mac_address': '24:18:1d:99:68:99',
                                                                                                                                            'noise_floor': -139.0,
                                                                                                                                            'rssi': -59.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'mac_address': '24:18:1d:63:63:c4',
                                                                                                                                            'noise_floor': -118.0,
                                                                                                                                            'rssi': -68.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'mac_address': '04:d6:aa:aa:68:e9',
                                                                                                                                            'noise_floor': -153.0,
                                                                                                                                            'rssi': -58.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -117.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU1-NE60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '92446711',
                                                              'in_octets': '4744312846240',
                                                              'in_ucast_pkts': '4117491537',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:e2:ef:1e',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '49686079',
                                                              'out_octets': '385120841084',
                                                              'out_ucast_pkts': '2000907569',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.089172,
                                'model': 'RBwAPG-60ad',
                                'poller_hash': 'BNaqqA8m',
                                'serial_number': '8B9508552284',
                                'sw_version': '6.45.8',
                                'system_mac_address': 'cc:2d:e0:e2:ef:1e',
                                'uptime': '20547525'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '19967',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '167933226272',
                                                                       'in_ucast_pkts': '391258797',
                                                                       'links': [       {       'in_discards': '19967',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '167933226272',
                                                                                                'in_ucast_pkts': '391258797',
                                                                                                'mac_address': '04:d6:aa:a8:0f:26',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '33289763462',
                                                                                                'out_ucast_pkts': '294897673'}],
                                                                       'mac_address': '04:d6:aa:aa:69:06',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '33289763462',
                                                                       'out_ucast_pkts': '294897673',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 363,
                                                                                                                                                     'mac_address': '04:d6:aa:a8:0f:26',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '33289763462',
                                                                       'in_ucast_pkts': '294897673',
                                                                       'name': 'ether1',
                                                                       'out_octets': '167933226272',
                                                                       'out_ucast_pkts': '391258797',
                                                                       'poller_hash': 'MDRkNmFhYWE2OTA2ZXRoZXIx'}],
                                         'poller_hash': 'BNaqqmkG',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '8563',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '9630689327',
                                                                       'in_ucast_pkts': '223489969',
                                                                       'links': [       {       'in_discards': '8563',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '9630689327',
                                                                                                'in_ucast_pkts': '223489969',
                                                                                                'mac_address': '04:d6:aa:a8:0f:26',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '12243873781',
                                                                                                'out_ucast_pkts': '216008766'}],
                                                                       'mac_address': '24:18:1d:99:68:99',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '12243873781',
                                                                       'out_ucast_pkts': '216008766',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 120,
                                                                                                                                                     'mac_address': '04:d6:aa:a8:0f:26',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '12243873781',
                                                                       'in_ucast_pkts': '216008766',
                                                                       'name': 'ether1',
                                                                       'out_octets': '9630689327',
                                                                       'out_ucast_pkts': '223489969',
                                                                       'poller_hash': 'MjQxODFkOTk2ODk5ZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWiZ',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '39098',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '122453554213',
                                                                       'in_ucast_pkts': '463883812',
                                                                       'links': [       {       'in_discards': '39098',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '122453554213',
                                                                                                'in_ucast_pkts': '463883812',
                                                                                                'mac_address': '04:d6:aa:a8:0f:26',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '53623273480',
                                                                                                'out_ucast_pkts': '357248633'}],
                                                                       'mac_address': '24:18:1d:63:63:c4',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '53623273480',
                                                                       'out_ucast_pkts': '357248633',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': '04:d6:aa:a8:0f:26',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '53623273480',
                                                                       'in_ucast_pkts': '357248633',
                                                                       'name': 'ether1',
                                                                       'out_octets': '122453554213',
                                                                       'out_ucast_pkts': '463883812',
                                                                       'poller_hash': 'MjQxODFkNjM2M2M0ZXRoZXIx'}],
                                         'poller_hash': 'JBgdY2PE',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '258335',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '3786253449736',
                                                                       'in_ucast_pkts': '3165796979',
                                                                       'links': [       {       'in_discards': '258335',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '3786253449736',
                                                                                                'in_ucast_pkts': '3165796979',
                                                                                                'mac_address': '04:d6:aa:a8:0f:26',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '199663279051',
                                                                                                'out_ucast_pkts': '1457757838'}],
                                                                       'mac_address': '04:d6:aa:aa:68:e9',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '199663279051',
                                                                       'out_ucast_pkts': '1457757838',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': '04:d6:aa:a8:0f:26',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '199663279051',
                                                                       'in_ucast_pkts': '1457757838',
                                                                       'name': 'ether1',
                                                                       'out_octets': '3786253449736',
                                                                       'out_ucast_pkts': '3165796979',
                                                                       'poller_hash': 'MDRkNmFhYWE2OGU5ZXRoZXIx'}],
                                         'poller_hash': 'BNaqqmjp',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_6_45_8_02(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad.6.45.8.02")
        exp_info = {
                'model': 'RBwAPG-60ad',
                'rf_chan_width': 2160,
                'rf_freq': 64800,
                'sta_count': 6,
                'sw_version': '6.45.8',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 9299369672202,
                'dl_en_packets': 7372147707,
                'dl_noise_floor': None,
                'dl_rf_bytes': 9314221424449,
                'dl_rf_packets': 8384322798,
                'en_if_speed': 1000000000,
                'mem': 22.149658203125,
                'serial_number': '8B9507D3AE06',
                'ssid': 'NU1-SE60G',
                'system_mac_address': '64:d1:54:ee:03:55',
                'ul_en_bytes': 644194460178,
                'ul_en_packets': 3226887839,
                'ul_noise_floor': None,
                'ul_rf_bytes': 671052105141,
                'ul_rf_packets': 4154641582
        }
        exp_sta_stats = {
                '04:d6:aa:a2:2e:1c': {       'alt_macs': None,
                                             'dev_macs': {       '64:d1:54:46:c7:a0',
                                                                 '64:d1:54:9b:37:46'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a2:2e:1c',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -130.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -65,
                                             'ul_snr': 65},
                '04:d6:aa:a8:d4:d8': {       'alt_macs': None,
                                             'dev_macs': {       'b8:69:f4:38:c8:e8',
                                                                 'cc:2d:e0:24:c8:f1'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.102.3.217',
                                             'mac_address': '04:d6:aa:a8:d4:d8',
                                             'name': '6 Warnecke St',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -131.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -66,
                                             'ul_snr': 65},
                '04:d6:aa:aa:69:ef': {       'alt_macs': None,
                                             'dev_macs': {       '64:d1:54:40:08:c8',
                                                                 '64:d1:54:40:08:cc'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:aa:69:ef',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -141.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -61,
                                             'ul_snr': 80},
                '24:18:1d:99:62:1a': {       'alt_macs': None,
                                             'dev_macs': {       'b8:69:f4:3f:9c:27',
                                                                 'cc:2d:e0:f7:47:7a'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.102.3.72',
                                             'mac_address': '24:18:1d:99:62:1a',
                                             'name': '1 Orchard Court',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -142.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -62,
                                             'ul_snr': 80},
                '24:18:1d:99:66:dc': {       'alt_macs': None,
                                             'dev_macs': {       '30:07:4d:87:87:c1',
                                                                 'b8:69:f4:3f:9b:e6',
                                                                 'cc:2d:e0:22:61:bd'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.102.3.79',
                                             'mac_address': '24:18:1d:99:66:dc',
                                             'name': '10 Murray St',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -129.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -64,
                                             'ul_snr': 65},
                '6c:c7:ec:9a:19:54': {       'alt_macs': None,
                                             'dev_macs': {       '64:d1:54:3c:16:5a',
                                                                 'c4:ad:34:18:fb:56'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '6c:c7:ec:9a:19:54',
                                             'name': '15 Gawler St',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -139.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -59,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '671052105141',
                                                              'in_ucast_pkts': '4154641582',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '64:d1:54:40:08:c8',
                                                                                                                        '64:d1:54:40:08:cc'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '62697946177',
                                                                                       'in_ucast_pkts': '406806847',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:aa:69:ef',
                                                                                       'out_discards': '5790',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '441481642153',
                                                                                       'out_ucast_pkts': '658117166'},
                                                                               {       'bridged_mac_addresses': [       '64:d1:54:3c:16:5a',
                                                                                                                        'c4:ad:34:18:fb:56'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '238035800932',
                                                                                       'in_ucast_pkts': '1924354179',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '6c:c7:ec:9a:19:54',
                                                                                       'out_discards': '1794',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '4358572574629',
                                                                                       'out_ucast_pkts': '3524135615'},
                                                                               {       'bridged_mac_addresses': [       '30:07:4d:87:87:c1',
                                                                                                                        'b8:69:f4:3f:9b:e6',
                                                                                                                        'cc:2d:e0:22:61:bd'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '16025478008',
                                                                                       'in_ucast_pkts': '233148144',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:66:dc',
                                                                                       'out_discards': '4482',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '51846056492',
                                                                                       'out_ucast_pkts': '260738964'},
                                                                               {       'bridged_mac_addresses': [       'b8:69:f4:3f:9c:27',
                                                                                                                        'cc:2d:e0:f7:47:7a'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '64133272182',
                                                                                       'in_ucast_pkts': '584092074',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:62:1a',
                                                                                       'out_discards': '8890',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '2967591051449',
                                                                                       'out_ucast_pkts': '2279504773'},
                                                                               {       'bridged_mac_addresses': [       'b8:69:f4:38:c8:e8',
                                                                                                                        'cc:2d:e0:24:c8:f1'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '219187573963',
                                                                                       'in_ucast_pkts': '592261864',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d4:d8',
                                                                                       'out_discards': '20014',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '975845813288',
                                                                                       'out_ucast_pkts': '1001467901'},
                                                                               {       'bridged_mac_addresses': [       '64:d1:54:46:c7:a0',
                                                                                                                        '64:d1:54:9b:37:46'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '69587557804',
                                                                                       'in_ucast_pkts': '412563907',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a2:2e:1c',
                                                                                       'out_discards': '8890',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '518883653298',
                                                                                       'out_ucast_pkts': '660347637'}],
                                                              'mac_address': '30:07:4d:87:87:c1',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '50047',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '9314221424449',
                                                              'out_ucast_pkts': '8384322798',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 64800,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 257,
                                                                                                                                            'mac_address': '04:d6:aa:aa:69:ef',
                                                                                                                                            'noise_floor': -141.0,
                                                                                                                                            'rssi': -61.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 141,
                                                                                                                                            'mac_address': '6c:c7:ec:9a:19:54',
                                                                                                                                            'noise_floor': -139.0,
                                                                                                                                            'rssi': -59.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 289,
                                                                                                                                            'mac_address': '24:18:1d:99:66:dc',
                                                                                                                                            'noise_floor': -129.0,
                                                                                                                                            'rssi': -64.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 214,
                                                                                                                                            'mac_address': '24:18:1d:99:62:1a',
                                                                                                                                            'noise_floor': -142.0,
                                                                                                                                            'rssi': -62.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'mac_address': '04:d6:aa:a8:d4:d8',
                                                                                                                                            'noise_floor': -131.0,
                                                                                                                                            'rssi': -66.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 334,
                                                                                                                                            'mac_address': '04:d6:aa:a2:2e:1c',
                                                                                                                                            'noise_floor': -130.0,
                                                                                                                                            'rssi': -65.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -129.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU1-SE60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '81791919',
                                                              'in_octets': '9299369672202',
                                                              'in_ucast_pkts': '7290355788',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '64:d1:54:ee:03:55',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '94286334',
                                                              'out_octets': '644194460178',
                                                              'out_ucast_pkts': '3132601505',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 22.149658,
                                'model': 'RBwAPG-60ad',
                                'poller_hash': 'MAdNh4fB',
                                'serial_number': '8B9507D3AE06',
                                'sw_version': '6.45.8',
                                'system_mac_address': '64:d1:54:ee:03:55',
                                'uptime': '20550400'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '5790',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '441481642153',
                                                                       'in_ucast_pkts': '658117166',
                                                                       'links': [       {       'in_discards': '5790',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '441481642153',
                                                                                                'in_ucast_pkts': '658117166',
                                                                                                'mac_address': '30:07:4d:87:87:c1',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '62697946177',
                                                                                                'out_ucast_pkts': '406806847'}],
                                                                       'mac_address': '04:d6:aa:aa:69:ef',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '62697946177',
                                                                       'out_ucast_pkts': '406806847',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 257,
                                                                                                                                                     'mac_address': '30:07:4d:87:87:c1',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '62697946177',
                                                                       'in_ucast_pkts': '406806847',
                                                                       'name': 'ether1',
                                                                       'out_octets': '441481642153',
                                                                       'out_ucast_pkts': '658117166',
                                                                       'poller_hash': 'MDRkNmFhYWE2OWVmZXRoZXIx'}],
                                         'poller_hash': 'BNaqqmnv',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1794',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '4358572574629',
                                                                       'in_ucast_pkts': '3524135615',
                                                                       'links': [       {       'in_discards': '1794',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '4358572574629',
                                                                                                'in_ucast_pkts': '3524135615',
                                                                                                'mac_address': '30:07:4d:87:87:c1',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '238035800932',
                                                                                                'out_ucast_pkts': '1924354179'}],
                                                                       'mac_address': '6c:c7:ec:9a:19:54',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '238035800932',
                                                                       'out_ucast_pkts': '1924354179',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 141,
                                                                                                                                                     'mac_address': '30:07:4d:87:87:c1',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '238035800932',
                                                                       'in_ucast_pkts': '1924354179',
                                                                       'name': 'ether1',
                                                                       'out_octets': '4358572574629',
                                                                       'out_ucast_pkts': '3524135615',
                                                                       'poller_hash': 'NmNjN2VjOWExOTU0ZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': '15 Gawler St',
                                         'poller_hash': 'bMfsmhlU',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.45.8'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '4482',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '51846056492',
                                                                       'in_ucast_pkts': '260738964',
                                                                       'links': [       {       'in_discards': '4482',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '51846056492',
                                                                                                'in_ucast_pkts': '260738964',
                                                                                                'mac_address': '30:07:4d:87:87:c1',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '16025478008',
                                                                                                'out_ucast_pkts': '233148144'}],
                                                                       'mac_address': '24:18:1d:99:66:dc',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '16025478008',
                                                                       'out_ucast_pkts': '233148144',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 289,
                                                                                                                                                     'mac_address': '30:07:4d:87:87:c1',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '16025478008',
                                                                       'in_ucast_pkts': '233148144',
                                                                       'name': 'ether1',
                                                                       'out_octets': '51846056492',
                                                                       'out_ucast_pkts': '260738964',
                                                                       'poller_hash': 'MjQxODFkOTk2NmRjZXRoZXIx'}],
                                         'management_ip': '10.102.3.79',
                                         'manufacturer': 'Mikrotik',
                                         'name': '10 Murray St',
                                         'poller_hash': 'JBgdmWbc',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.45.8'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '8890',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '2967591051449',
                                                                       'in_ucast_pkts': '2279504773',
                                                                       'links': [       {       'in_discards': '8890',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '2967591051449',
                                                                                                'in_ucast_pkts': '2279504773',
                                                                                                'mac_address': '30:07:4d:87:87:c1',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '64133272182',
                                                                                                'out_ucast_pkts': '584092074'}],
                                                                       'mac_address': '24:18:1d:99:62:1a',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '64133272182',
                                                                       'out_ucast_pkts': '584092074',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 214,
                                                                                                                                                     'mac_address': '30:07:4d:87:87:c1',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '64133272182',
                                                                       'in_ucast_pkts': '584092074',
                                                                       'name': 'ether1',
                                                                       'out_octets': '2967591051449',
                                                                       'out_ucast_pkts': '2279504773',
                                                                       'poller_hash': 'MjQxODFkOTk2MjFhZXRoZXIx'}],
                                         'management_ip': '10.102.3.72',
                                         'manufacturer': 'Mikrotik',
                                         'name': '1 Orchard Court',
                                         'poller_hash': 'JBgdmWIa',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.45.8'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '20014',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '975845813288',
                                                                       'in_ucast_pkts': '1001467901',
                                                                       'links': [       {       'in_discards': '20014',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '975845813288',
                                                                                                'in_ucast_pkts': '1001467901',
                                                                                                'mac_address': '30:07:4d:87:87:c1',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '219187573963',
                                                                                                'out_ucast_pkts': '592261864'}],
                                                                       'mac_address': '04:d6:aa:a8:d4:d8',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '219187573963',
                                                                       'out_ucast_pkts': '592261864',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': '30:07:4d:87:87:c1',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '219187573963',
                                                                       'in_ucast_pkts': '592261864',
                                                                       'name': 'ether1',
                                                                       'out_octets': '975845813288',
                                                                       'out_ucast_pkts': '1001467901',
                                                                       'poller_hash': 'MDRkNmFhYThkNGQ4ZXRoZXIx'}],
                                         'management_ip': '10.102.3.217',
                                         'manufacturer': 'Mikrotik',
                                         'name': '6 Warnecke St',
                                         'poller_hash': 'BNaqqNTY',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.45.8'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '8890',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '518883653298',
                                                                       'in_ucast_pkts': '660347637',
                                                                       'links': [       {       'in_discards': '8890',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '518883653298',
                                                                                                'in_ucast_pkts': '660347637',
                                                                                                'mac_address': '30:07:4d:87:87:c1',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '69587557804',
                                                                                                'out_ucast_pkts': '412563907'}],
                                                                       'mac_address': '04:d6:aa:a2:2e:1c',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '69587557804',
                                                                       'out_ucast_pkts': '412563907',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 334,
                                                                                                                                                     'mac_address': '30:07:4d:87:87:c1',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '69587557804',
                                                                       'in_ucast_pkts': '412563907',
                                                                       'name': 'ether1',
                                                                       'out_octets': '518883653298',
                                                                       'out_ucast_pkts': '660347637',
                                                                       'poller_hash': 'MDRkNmFhYTIyZTFjZXRoZXIx'}],
                                         'poller_hash': 'BNaqoi4c',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_6_45_8_03(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad.6.45.8.03")
        exp_info = {
                'model': 'RBwAPG-60ad',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 3,
                'sw_version': '6.45.8',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 1645563249710,
                'dl_en_packets': 1979028625,
                'dl_noise_floor': None,
                'dl_rf_bytes': 1641115927221,
                'dl_rf_packets': 2069050684,
                'en_if_speed': 1000000000,
                'mem': 22.1588134765625,
                'serial_number': '92220863761B',
                'ssid': 'TN2-NW60G',
                'system_mac_address': 'cc:2d:e0:a6:f4:70',
                'ul_en_bytes': 1521895827352,
                'ul_en_packets': 1678841675,
                'ul_noise_floor': None,
                'ul_rf_bytes': 1520023598581,
                'ul_rf_packets': 1775306665
        }
        exp_sta_stats = {
                '08:c5:e1:da:6b:bc': {       'alt_macs': None,
                                             'dev_macs': {       '04:d6:aa:6b:1f:8a',
                                                                 'cc:2d:e0:55:f2:3a'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '08:c5:e1:da:6b:bc',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -151.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -56,
                                             'ul_snr': 95},
                '24:18:1d:99:68:01': {       'alt_macs': None,
                                             'dev_macs': {'74:4d:28:17:6d:31'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:68:01',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -118.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -68,
                                             'ul_snr': 50},
                'b8:69:f4:91:67:e5': {       'alt_macs': None,
                                             'dev_macs': {       '00:0c:29:a2:73:1c',
                                                                 '00:0c:29:e6:56:16',
                                                                 '04:18:d6:00:63:15',
                                                                 '5c:f9:dd:e4:27:2c',
                                                                 '64:d1:54:3a:a9:75',
                                                                 '64:d1:54:3a:a9:78',
                                                                 '80:18:44:f1:89:bc',
                                                                 '98:f2:b3:e9:05:8c',
                                                                 'b0:61:c7:9f:35:0c',
                                                                 'b8:e8:56:4a:47:cc',
                                                                 'f4:ea:67:79:4c:63'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': 'b8:69:f4:91:67:e5',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -136.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -56,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '1520023598581',
                                                              'in_ucast_pkts': '1775306665',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '74:4d:28:17:6d:31'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '157586984896',
                                                                                       'in_ucast_pkts': '322274573',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:68:01',
                                                                                       'out_discards': '15130',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '719107312788',
                                                                                       'out_ucast_pkts': '635474776'},
                                                                               {       'bridged_mac_addresses': [       '04:d6:aa:6b:1f:8a',
                                                                                                                        'cc:2d:e0:55:f2:3a'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '123928357757',
                                                                                       'in_ucast_pkts': '323871627',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '08:c5:e1:da:6b:bc',
                                                                                       'out_discards': '1545',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '568227038394',
                                                                                       'out_ucast_pkts': '607913053'},
                                                                               {       'bridged_mac_addresses': [       '00:0c:29:a2:73:1c',
                                                                                                                        '00:0c:29:e6:56:16',
                                                                                                                        '04:18:d6:00:63:15',
                                                                                                                        '5c:f9:dd:e4:27:2c',
                                                                                                                        '64:d1:54:3a:a9:75',
                                                                                                                        '64:d1:54:3a:a9:78',
                                                                                                                        '80:18:44:f1:89:bc',
                                                                                                                        '98:f2:b3:e9:05:8c',
                                                                                                                        'b0:61:c7:9f:35:0c',
                                                                                                                        'b8:e8:56:4a:47:cc',
                                                                                                                        'f4:ea:67:79:4c:63'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '1238508255928',
                                                                                       'in_ucast_pkts': '1129160465',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': 'b8:69:f4:91:67:e5',
                                                                                       'out_discards': '178',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '353781576039',
                                                                                       'out_ucast_pkts': '825662855'}],
                                                              'mac_address': '04:d6:aa:6b:1f:8a',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '16853',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '1641115927221',
                                                              'out_ucast_pkts': '2069050684',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'mac_address': '24:18:1d:99:68:01',
                                                                                                                                            'noise_floor': -118.0,
                                                                                                                                            'rssi': -68.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 135,
                                                                                                                                            'mac_address': '08:c5:e1:da:6b:bc',
                                                                                                                                            'noise_floor': -151.0,
                                                                                                                                            'rssi': -56.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 133,
                                                                                                                                            'mac_address': 'b8:69:f4:91:67:e5',
                                                                                                                                            'noise_floor': -136.0,
                                                                                                                                            'rssi': -56.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -118.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'TN2-NW60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '26872998',
                                                              'in_octets': '1645563249710',
                                                              'in_ucast_pkts': '1952155627',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:a6:f4:70',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '18907341',
                                                              'out_octets': '1521895827352',
                                                              'out_ucast_pkts': '1659934334',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 22.158813,
                                'model': 'RBwAPG-60ad',
                                'poller_hash': 'BNaqax+K',
                                'serial_number': '92220863761B',
                                'sw_version': '6.45.8',
                                'system_mac_address': 'cc:2d:e0:a6:f4:70',
                                'uptime': '6015533'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '15130',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '719107312788',
                                                                       'in_ucast_pkts': '635474776',
                                                                       'links': [       {       'in_discards': '15130',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '719107312788',
                                                                                                'in_ucast_pkts': '635474776',
                                                                                                'mac_address': '04:d6:aa:6b:1f:8a',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '157586984896',
                                                                                                'out_ucast_pkts': '322274573'}],
                                                                       'mac_address': '24:18:1d:99:68:01',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '157586984896',
                                                                       'out_ucast_pkts': '322274573',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': '04:d6:aa:6b:1f:8a',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN2-NW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '157586984896',
                                                                       'in_ucast_pkts': '322274573',
                                                                       'name': 'ether1',
                                                                       'out_octets': '719107312788',
                                                                       'out_ucast_pkts': '635474776',
                                                                       'poller_hash': 'MjQxODFkOTk2ODAxZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWgB',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1545',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '568227038394',
                                                                       'in_ucast_pkts': '607913053',
                                                                       'links': [       {       'in_discards': '1545',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '568227038394',
                                                                                                'in_ucast_pkts': '607913053',
                                                                                                'mac_address': '04:d6:aa:6b:1f:8a',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '123928357757',
                                                                                                'out_ucast_pkts': '323871627'}],
                                                                       'mac_address': '08:c5:e1:da:6b:bc',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '123928357757',
                                                                       'out_ucast_pkts': '323871627',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 135,
                                                                                                                                                     'mac_address': '04:d6:aa:6b:1f:8a',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN2-NW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '123928357757',
                                                                       'in_ucast_pkts': '323871627',
                                                                       'name': 'ether1',
                                                                       'out_octets': '568227038394',
                                                                       'out_ucast_pkts': '607913053',
                                                                       'poller_hash': 'MDhjNWUxZGE2YmJjZXRoZXIx'}],
                                         'poller_hash': 'CMXh2mu8',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '178',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '353781576039',
                                                                       'in_ucast_pkts': '825662855',
                                                                       'links': [       {       'in_discards': '178',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '353781576039',
                                                                                                'in_ucast_pkts': '825662855',
                                                                                                'mac_address': '04:d6:aa:6b:1f:8a',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '1238508255928',
                                                                                                'out_ucast_pkts': '1129160465'}],
                                                                       'mac_address': 'b8:69:f4:91:67:e5',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '1238508255928',
                                                                       'out_ucast_pkts': '1129160465',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 133,
                                                                                                                                                     'mac_address': '04:d6:aa:6b:1f:8a',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN2-NW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '1238508255928',
                                                                       'in_ucast_pkts': '1129160465',
                                                                       'name': 'ether1',
                                                                       'out_octets': '353781576039',
                                                                       'out_ucast_pkts': '825662855',
                                                                       'poller_hash': 'Yjg2OWY0OTE2N2U1ZXRoZXIx'}],
                                         'poller_hash': 'uGn0kWfl',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_6_45_8_04(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad.6.45.8.04")
        exp_info = {
                'model': 'RBwAPG-60ad',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 8,
                'sw_version': '6.45.8',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 4366967320168,
                'dl_en_packets': 3544293813,
                'dl_noise_floor': None,
                'dl_rf_bytes': 4369831777435,
                'dl_rf_packets': 3954688354,
                'en_if_speed': 1000000000,
                'mem': 22.46246337890625,
                'serial_number': '92220864C782',
                'ssid': 'TN2-SW60G',
                'system_mac_address': 'cc:2d:e0:a6:f2:f7',
                'ul_en_bytes': 391478926832,
                'ul_en_packets': 1658530198,
                'ul_noise_floor': None,
                'ul_rf_bytes': 396559641871,
                'ul_rf_packets': 2016353415
        }
        exp_sta_stats = {
                '24:18:1d:5a:13:8d': {       'alt_macs': None,
                                             'dev_macs': {'c4:ad:34:f9:8e:57'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:5a:13:8d',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -141.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -61,
                                             'ul_snr': 80},
                '24:18:1d:99:67:a9': {       'alt_macs': None,
                                             'dev_macs': {       'b8:69:f4:3f:9c:2c',
                                                                 'c4:ad:34:f9:8e:45'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:67:a9',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -147.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -67,
                                             'ul_snr': 80},
                '24:18:1d:99:68:6c': {       'alt_macs': None,
                                             'dev_macs': {       '04:d6:aa:6b:1f:ae',
                                                                 '50:c7:bf:45:40:af',
                                                                 'b8:69:f4:3f:9c:13'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:68:6c',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -129.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -64,
                                             'ul_snr': 65},
                '48:8f:5a:51:c7:13': {       'alt_macs': None,
                                             'dev_macs': {'48:8f:5a:94:00:7f'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:51:c7:13',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -129.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -64,
                                             'ul_snr': 65},
                '48:8f:5a:80:66:9b': {       'alt_macs': None,
                                             'dev_macs': {'6c:72:20:3f:35:d1'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:80:66:9b',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -142.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -62,
                                             'ul_snr': 80},
                '6c:c7:ec:92:f6:12': {       'alt_macs': None,
                                             'dev_macs': {'48:8f:5a:83:99:57'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '6c:c7:ec:92:f6:12',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -141.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -61,
                                             'ul_snr': 80},
                '6c:c7:ec:92:f9:c1': {       'alt_macs': None,
                                             'dev_macs': {       '74:4d:28:17:82:2c',
                                                                 'c4:ad:34:2a:7c:00'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '6c:c7:ec:92:f9:c1',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -142.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -62,
                                             'ul_snr': 80},
                '6c:c7:ec:9a:1b:bd': {       'alt_macs': None,
                                             'dev_macs': {       '74:4d:28:c4:24:6c',
                                                                 'c4:ad:34:16:99:c3'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '6c:c7:ec:9a:1b:bd',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -130.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -65,
                                             'ul_snr': 65}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '396559641871',
                                                              'in_ucast_pkts': '2016353415',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '04:d6:aa:6b:1f:ae',
                                                                                                                        '50:c7:bf:45:40:af',
                                                                                                                        'b8:69:f4:3f:9c:13'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '52868408446',
                                                                                       'in_ucast_pkts': '253503059',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:68:6c',
                                                                                       'out_discards': '141',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '357726950910',
                                                                                       'out_ucast_pkts': '401379486'},
                                                                               {       'bridged_mac_addresses': [       '48:8f:5a:94:00:7f'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '14284028632',
                                                                                       'in_ucast_pkts': '120865317',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:51:c7:13',
                                                                                       'out_discards': '204',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '195899630528',
                                                                                       'out_ucast_pkts': '217600027'},
                                                                               {       'bridged_mac_addresses': [       '6c:72:20:3f:35:d1'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '21616391913',
                                                                                       'in_ucast_pkts': '212624922',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:80:66:9b',
                                                                                       'out_discards': '140',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '486241186651',
                                                                                       'out_ucast_pkts': '381939391'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:17:82:2c',
                                                                                                                        'c4:ad:34:2a:7c:00'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '49548360081',
                                                                                       'in_ucast_pkts': '160333550',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '6c:c7:ec:92:f9:c1',
                                                                                       'out_discards': '259',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '160668866849',
                                                                                       'out_ucast_pkts': '218330373'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:c4:24:6c',
                                                                                                                        'c4:ad:34:16:99:c3'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '21218349882',
                                                                                       'in_ucast_pkts': '101412680',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '6c:c7:ec:9a:1b:bd',
                                                                                       'out_discards': '42',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '89355153921',
                                                                                       'out_ucast_pkts': '151382324'},
                                                                               {       'bridged_mac_addresses': [       '48:8f:5a:83:99:57'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '43849481261',
                                                                                       'in_ucast_pkts': '251984310',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '6c:c7:ec:92:f6:12',
                                                                                       'out_discards': '171',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '257209630931',
                                                                                       'out_ucast_pkts': '349618493'},
                                                                               {       'bridged_mac_addresses': [       'c4:ad:34:f9:8e:57'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '25858259739',
                                                                                       'in_ucast_pkts': '110344819',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:5a:13:8d',
                                                                                       'out_discards': '203',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '104123211954',
                                                                                       'out_ucast_pkts': '166611793'},
                                                                               {       'bridged_mac_addresses': [       'b8:69:f4:3f:9c:2c',
                                                                                                                        'c4:ad:34:f9:8e:45'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '167316361917',
                                                                                       'in_ucast_pkts': '805284758',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:67:a9',
                                                                                       'out_discards': '387',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '2718607145691',
                                                                                       'out_ucast_pkts': '2067826467'}],
                                                              'mac_address': '04:d6:aa:6b:1f:ae',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '1547',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '4369831777435',
                                                              'out_ucast_pkts': '3954688354',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 381,
                                                                                                                                            'mac_address': '24:18:1d:99:68:6c',
                                                                                                                                            'noise_floor': -129.0,
                                                                                                                                            'rssi': -64.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 272,
                                                                                                                                            'mac_address': '48:8f:5a:51:c7:13',
                                                                                                                                            'noise_floor': -129.0,
                                                                                                                                            'rssi': -64.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 208,
                                                                                                                                            'mac_address': '48:8f:5a:80:66:9b',
                                                                                                                                            'noise_floor': -142.0,
                                                                                                                                            'rssi': -62.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 346,
                                                                                                                                            'mac_address': '6c:c7:ec:92:f9:c1',
                                                                                                                                            'noise_floor': -142.0,
                                                                                                                                            'rssi': -62.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 273,
                                                                                                                                            'mac_address': '6c:c7:ec:9a:1b:bd',
                                                                                                                                            'noise_floor': -130.0,
                                                                                                                                            'rssi': -65.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 195,
                                                                                                                                            'mac_address': '6c:c7:ec:92:f6:12',
                                                                                                                                            'noise_floor': -141.0,
                                                                                                                                            'rssi': -61.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 258,
                                                                                                                                            'mac_address': '24:18:1d:5a:13:8d',
                                                                                                                                            'noise_floor': -141.0,
                                                                                                                                            'rssi': -61.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 328,
                                                                                                                                            'mac_address': '24:18:1d:99:67:a9',
                                                                                                                                            'noise_floor': -147.0,
                                                                                                                                            'rssi': -67.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -129.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'TN2-SW60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '23364018',
                                                              'in_octets': '4366967320168',
                                                              'in_ucast_pkts': '3520929795',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:a6:f2:f7',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '6521913',
                                                              'out_octets': '391478926832',
                                                              'out_ucast_pkts': '1652008285',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 22.462463,
                                'model': 'RBwAPG-60ad',
                                'poller_hash': 'BNaqax+u',
                                'serial_number': '92220864C782',
                                'sw_version': '6.45.8',
                                'system_mac_address': 'cc:2d:e0:a6:f2:f7',
                                'uptime': '6016687'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '141',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '357726950910',
                                                                       'in_ucast_pkts': '401379486',
                                                                       'links': [       {       'in_discards': '141',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '357726950910',
                                                                                                'in_ucast_pkts': '401379486',
                                                                                                'mac_address': '04:d6:aa:6b:1f:ae',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '52868408446',
                                                                                                'out_ucast_pkts': '253503059'}],
                                                                       'mac_address': '24:18:1d:99:68:6c',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '52868408446',
                                                                       'out_ucast_pkts': '253503059',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 381,
                                                                                                                                                     'mac_address': '04:d6:aa:6b:1f:ae',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN2-SW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '52868408446',
                                                                       'in_ucast_pkts': '253503059',
                                                                       'name': 'ether1',
                                                                       'out_octets': '357726950910',
                                                                       'out_ucast_pkts': '401379486',
                                                                       'poller_hash': 'MjQxODFkOTk2ODZjZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWhs',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '204',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '195899630528',
                                                                       'in_ucast_pkts': '217600027',
                                                                       'links': [       {       'in_discards': '204',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '195899630528',
                                                                                                'in_ucast_pkts': '217600027',
                                                                                                'mac_address': '04:d6:aa:6b:1f:ae',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '14284028632',
                                                                                                'out_ucast_pkts': '120865317'}],
                                                                       'mac_address': '48:8f:5a:51:c7:13',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '14284028632',
                                                                       'out_ucast_pkts': '120865317',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 272,
                                                                                                                                                     'mac_address': '04:d6:aa:6b:1f:ae',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN2-SW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '14284028632',
                                                                       'in_ucast_pkts': '120865317',
                                                                       'name': 'ether1',
                                                                       'out_octets': '195899630528',
                                                                       'out_ucast_pkts': '217600027',
                                                                       'poller_hash': 'NDg4ZjVhNTFjNzEzZXRoZXIx'}],
                                         'poller_hash': 'SI9aUccT',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '140',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '486241186651',
                                                                       'in_ucast_pkts': '381939391',
                                                                       'links': [       {       'in_discards': '140',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '486241186651',
                                                                                                'in_ucast_pkts': '381939391',
                                                                                                'mac_address': '04:d6:aa:6b:1f:ae',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '21616391913',
                                                                                                'out_ucast_pkts': '212624922'}],
                                                                       'mac_address': '48:8f:5a:80:66:9b',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '21616391913',
                                                                       'out_ucast_pkts': '212624922',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 208,
                                                                                                                                                     'mac_address': '04:d6:aa:6b:1f:ae',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN2-SW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '21616391913',
                                                                       'in_ucast_pkts': '212624922',
                                                                       'name': 'ether1',
                                                                       'out_octets': '486241186651',
                                                                       'out_ucast_pkts': '381939391',
                                                                       'poller_hash': 'NDg4ZjVhODA2NjliZXRoZXIx'}],
                                         'poller_hash': 'SI9agGab',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '259',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '160668866849',
                                                                       'in_ucast_pkts': '218330373',
                                                                       'links': [       {       'in_discards': '259',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '160668866849',
                                                                                                'in_ucast_pkts': '218330373',
                                                                                                'mac_address': '04:d6:aa:6b:1f:ae',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '49548360081',
                                                                                                'out_ucast_pkts': '160333550'}],
                                                                       'mac_address': '6c:c7:ec:92:f9:c1',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '49548360081',
                                                                       'out_ucast_pkts': '160333550',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 346,
                                                                                                                                                     'mac_address': '04:d6:aa:6b:1f:ae',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN2-SW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '49548360081',
                                                                       'in_ucast_pkts': '160333550',
                                                                       'name': 'ether1',
                                                                       'out_octets': '160668866849',
                                                                       'out_ucast_pkts': '218330373',
                                                                       'poller_hash': 'NmNjN2VjOTJmOWMxZXRoZXIx'}],
                                         'poller_hash': 'bMfskvnB',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '42',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '89355153921',
                                                                       'in_ucast_pkts': '151382324',
                                                                       'links': [       {       'in_discards': '42',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '89355153921',
                                                                                                'in_ucast_pkts': '151382324',
                                                                                                'mac_address': '04:d6:aa:6b:1f:ae',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '21218349882',
                                                                                                'out_ucast_pkts': '101412680'}],
                                                                       'mac_address': '6c:c7:ec:9a:1b:bd',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '21218349882',
                                                                       'out_ucast_pkts': '101412680',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 273,
                                                                                                                                                     'mac_address': '04:d6:aa:6b:1f:ae',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN2-SW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '21218349882',
                                                                       'in_ucast_pkts': '101412680',
                                                                       'name': 'ether1',
                                                                       'out_octets': '89355153921',
                                                                       'out_ucast_pkts': '151382324',
                                                                       'poller_hash': 'NmNjN2VjOWExYmJkZXRoZXIx'}],
                                         'poller_hash': 'bMfsmhu9',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '171',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '257209630931',
                                                                       'in_ucast_pkts': '349618493',
                                                                       'links': [       {       'in_discards': '171',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '257209630931',
                                                                                                'in_ucast_pkts': '349618493',
                                                                                                'mac_address': '04:d6:aa:6b:1f:ae',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '43849481261',
                                                                                                'out_ucast_pkts': '251984310'}],
                                                                       'mac_address': '6c:c7:ec:92:f6:12',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '43849481261',
                                                                       'out_ucast_pkts': '251984310',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 195,
                                                                                                                                                     'mac_address': '04:d6:aa:6b:1f:ae',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN2-SW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '43849481261',
                                                                       'in_ucast_pkts': '251984310',
                                                                       'name': 'ether1',
                                                                       'out_octets': '257209630931',
                                                                       'out_ucast_pkts': '349618493',
                                                                       'poller_hash': 'NmNjN2VjOTJmNjEyZXRoZXIx'}],
                                         'poller_hash': 'bMfskvYS',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '203',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '104123211954',
                                                                       'in_ucast_pkts': '166611793',
                                                                       'links': [       {       'in_discards': '203',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '104123211954',
                                                                                                'in_ucast_pkts': '166611793',
                                                                                                'mac_address': '04:d6:aa:6b:1f:ae',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '25858259739',
                                                                                                'out_ucast_pkts': '110344819'}],
                                                                       'mac_address': '24:18:1d:5a:13:8d',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '25858259739',
                                                                       'out_ucast_pkts': '110344819',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 258,
                                                                                                                                                     'mac_address': '04:d6:aa:6b:1f:ae',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN2-SW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '25858259739',
                                                                       'in_ucast_pkts': '110344819',
                                                                       'name': 'ether1',
                                                                       'out_octets': '104123211954',
                                                                       'out_ucast_pkts': '166611793',
                                                                       'poller_hash': 'MjQxODFkNWExMzhkZXRoZXIx'}],
                                         'poller_hash': 'JBgdWhON',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '387',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '2718607145691',
                                                                       'in_ucast_pkts': '2067826467',
                                                                       'links': [       {       'in_discards': '387',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '2718607145691',
                                                                                                'in_ucast_pkts': '2067826467',
                                                                                                'mac_address': '04:d6:aa:6b:1f:ae',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '167316361917',
                                                                                                'out_ucast_pkts': '805284758'}],
                                                                       'mac_address': '24:18:1d:99:67:a9',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '167316361917',
                                                                       'out_ucast_pkts': '805284758',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 328,
                                                                                                                                                     'mac_address': '04:d6:aa:6b:1f:ae',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN2-SW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '167316361917',
                                                                       'in_ucast_pkts': '805284758',
                                                                       'name': 'ether1',
                                                                       'out_octets': '2718607145691',
                                                                       'out_ucast_pkts': '2067826467',
                                                                       'poller_hash': 'MjQxODFkOTk2N2E5ZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWep',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_6_45_9_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad.6.45.9.01")
        exp_info = {
                'model': 'RBwAPG-60ad',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 1,
                'sw_version': '6.45.9',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 1062955705997,
                'dl_en_packets': 885394226,
                'dl_noise_floor': None,
                'dl_rf_bytes': 1064531911171,
                'dl_rf_packets': 961274898,
                'en_if_speed': 1000000000,
                'mem': 21.8841552734375,
                'serial_number': 'D68B0DF8D9D6',
                'ssid': 'Main AP',
                'system_mac_address': '08:55:31:0a:d3:56',
                'ul_en_bytes': 68005916372,
                'ul_en_packets': 365348599,
                'ul_noise_floor': None,
                'ul_rf_bytes': 67809815337,
                'ul_rf_packets': 435269797
        }
        exp_sta_stats = {
                '08:55:31:0a:d3:a4': {       'alt_macs': {'08:55:31:0a:d3:a3'},
                                             'dev_macs': {'08:55:31:0a:d3:57'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': 8,
                                             'dl_noise_floor': -152.0,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': -57.0,
                                             'dl_snr': 95.0,
                                             'ip_address': '10.50.66.200',
                                             'mac_address': '08:55:31:0a:d3:a4',
                                             'name': 'Moran to Main Station',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': 2310000000,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -150.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -55,
                                             'ul_snr': 95}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '67809815337',
                                                              'in_ucast_pkts': '435269797',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '08:55:31:0a:d3:57'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '67809815337',
                                                                                       'in_ucast_pkts': '435269797',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '08:55:31:0a:d3:a4',
                                                                                       'out_discards': '770',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1064531911171',
                                                                                       'out_ucast_pkts': '961274898'}],
                                                              'mac_address': '08:55:31:0a:d3:57',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '770',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '1064531911171',
                                                              'out_ucast_pkts': '961274898',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 51,
                                                                                                                                            'mac_address': '08:55:31:0a:d3:a4',
                                                                                                                                            'noise_floor': -150.0,
                                                                                                                                            'rssi': -55.0,
                                                                                                                                            'rx_link_rate': '2310000000',
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000',
                                                                                                                                            'tx_mcs': 8}],
                                                                                                                   'noise_floor': -150.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'Main '
                                                                                                 'AP'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '9573141',
                                                              'in_octets': '1062955705997',
                                                              'in_ucast_pkts': '875821085',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '08:55:31:0a:d3:56',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '9835636',
                                                              'out_octets': '68005916372',
                                                              'out_ucast_pkts': '355512963',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.884155,
                                'model': 'RBwAPG-60ad',
                                'poller_hash': 'CFUxCtNX',
                                'serial_number': 'D68B0DF8D9D6',
                                'sw_version': '6.45.9',
                                'system_mac_address': '08:55:31:0a:d3:56',
                                'uptime': '12567492'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '770',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1064531911171',
                                                                       'in_ucast_pkts': '961274898',
                                                                       'links': [       {       'in_discards': '770',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1064531911171',
                                                                                                'in_ucast_pkts': '961274898',
                                                                                                'mac_address': '08:55:31:0a:d3:57',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '67809815337',
                                                                                                'out_ucast_pkts': '435269797'}],
                                                                       'mac_address': '08:55:31:0a:d3:a4',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '67809815337',
                                                                       'out_ucast_pkts': '435269797',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 51,
                                                                                                                                                     'mac_address': '08:55:31:0a:d3:57',
                                                                                                                                                     'noise_floor': -152.0,
                                                                                                                                                     'rssi': -57.0,
                                                                                                                                                     'rx_link_rate': '2310000000',
                                                                                                                                                     'rx_mcs': 8,
                                                                                                                                                     'snr': 95.0,
                                                                                                                                                     'tx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Main '
                                                                                                          'AP'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '67809815337',
                                                                       'in_ucast_pkts': '435269797',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1064531911171',
                                                                       'out_ucast_pkts': '961274898',
                                                                       'poller_hash': 'MDg1NTMxMGFkM2E0ZXRoZXIx'}],
                                         'management_ip': '10.50.66.200',
                                         'manufacturer': 'Mikrotik',
                                         'model': 'RBwAPG-60ad',
                                         'name': 'Moran to Main Station',
                                         'poller_hash': 'CFUxCtOk',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.45.9'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_6_46_2_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad.6.46.2.01")
        exp_info = {
                'model': 'RBwAPG-60ad',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 1,
                'sw_version': '6.46.2',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 518059662658,
                'dl_en_packets': 564623632,
                'dl_noise_floor': None,
                'dl_rf_bytes': 518507316957,
                'dl_rf_packets': 592150156,
                'en_if_speed': 1000000000,
                'mem': 19.281005859375,
                'serial_number': 'B02F0B957F48',
                'ssid': 'Drew',
                'system_mac_address': 'c4:ad:34:0c:08:31',
                'ul_en_bytes': 452289760428,
                'ul_en_packets': 540697283,
                'ul_noise_floor': None,
                'ul_rf_bytes': 452326263815,
                'ul_rf_packets': 568567127
        }
        exp_sta_stats = {
                'c4:ad:34:0c:07:b1': {       'alt_macs': {'c4:ad:34:0c:07:b0'},
                                             'dev_macs': {       '3c:7c:3f:6a:42:70',
                                                                 'c4:ad:34:0c:08:32'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': 8,
                                             'dl_noise_floor': -148.0,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': -53.0,
                                             'dl_snr': 95.0,
                                             'ip_address': '10.100.2.12',
                                             'mac_address': 'c4:ad:34:0c:07:b1',
                                             'name': 'MikroTik',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': 2310000000,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -150.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -55,
                                             'ul_snr': 95}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '452326263815',
                                                              'in_ucast_pkts': '568567127',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '3c:7c:3f:6a:42:70',
                                                                                                                        'c4:ad:34:0c:08:32'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '452326263815',
                                                                                       'in_ucast_pkts': '568567127',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': 'c4:ad:34:0c:07:b1',
                                                                                       'out_discards': '87',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '518507316957',
                                                                                       'out_ucast_pkts': '592150156'}],
                                                              'mac_address': 'c4:ad:34:0c:08:32',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '87',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '518507316957',
                                                              'out_ucast_pkts': '592150156',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 56,
                                                                                                                                            'mac_address': 'c4:ad:34:0c:07:b1',
                                                                                                                                            'noise_floor': -150.0,
                                                                                                                                            'rssi': -55.0,
                                                                                                                                            'rx_link_rate': '2310000000',
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000',
                                                                                                                                            'tx_mcs': 8}],
                                                                                                                   'noise_floor': -150.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'Drew'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '1372637',
                                                              'in_octets': '518059662658',
                                                              'in_ucast_pkts': '563250995',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'c4:ad:34:0c:08:31',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '2563567',
                                                              'out_octets': '452289760428',
                                                              'out_ucast_pkts': '538133716',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 19.281006,
                                'model': 'RBwAPG-60ad',
                                'poller_hash': 'xK00DAgy',
                                'serial_number': 'B02F0B957F48',
                                'sw_version': '6.46.2',
                                'system_mac_address': 'c4:ad:34:0c:08:31',
                                'uptime': '4397822'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '87',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '518507316957',
                                                                       'in_ucast_pkts': '592150156',
                                                                       'links': [       {       'in_discards': '87',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '518507316957',
                                                                                                'in_ucast_pkts': '592150156',
                                                                                                'mac_address': 'c4:ad:34:0c:08:32',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '452326263815',
                                                                                                'out_ucast_pkts': '568567127'}],
                                                                       'mac_address': 'c4:ad:34:0c:07:b1',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '452326263815',
                                                                       'out_ucast_pkts': '568567127',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 56,
                                                                                                                                                     'mac_address': 'c4:ad:34:0c:08:32',
                                                                                                                                                     'noise_floor': -148.0,
                                                                                                                                                     'rssi': -53.0,
                                                                                                                                                     'rx_link_rate': '2310000000',
                                                                                                                                                     'rx_mcs': 8,
                                                                                                                                                     'snr': 95.0,
                                                                                                                                                     'tx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Drew'}]},
                                                               {       'bridged_mac_addresses': [       '3c:7c:3f:6a:42:70'],
                                                                       'id': '2',
                                                                       'in_octets': '452326263815',
                                                                       'in_ucast_pkts': '568567127',
                                                                       'mac_address': 'c4:ad:34:0c:07:b0',
                                                                       'name': 'ether1',
                                                                       'out_octets': '518507316957',
                                                                       'out_ucast_pkts': '592150156',
                                                                       'poller_hash': 'YzRhZDM0MGMwN2IxZXRoZXIx'}],
                                         'management_ip': '10.100.2.12',
                                         'manufacturer': 'Mikrotik',
                                         'model': 'RBwAPG-60ad',
                                         'name': 'MikroTik',
                                         'poller_hash': 'xK00DAex',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.46.2',
                                         'system_mac_address': 'c4:ad:34:0c:07:b0'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_44_1_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.44.1.01")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 64800,
                'sta_count': 3,
                'sw_version': None,
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 71788721372,
                'dl_en_packets': 95858029,
                'dl_noise_floor': None,
                'dl_rf_bytes': 74063879248,
                'dl_rf_packets': 132918365,
                'en_if_speed': 1000000000,
                'mem': 20.5963134765625,
                'serial_number': None,
                'ssid': 'Tx12.60S',
                'system_mac_address': 'cc:2d:e0:64:b3:f2',
                'ul_en_bytes': 7596960405,
                'ul_en_packets': 30580673,
                'ul_noise_floor': None,
                'ul_rf_bytes': 7228493499,
                'ul_rf_packets': 38436379
        }
        exp_sta_stats = {
                '6c:c7:ec:35:59:14': {       'alt_macs': None,
                                             'dev_macs': {       '48:f8:b3:bf:50:19',
                                                                 '74:4d:28:e0:5e:00'},
                                             'dl_link_rate': None,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '6c:c7:ec:35:59:14',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': None,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': None,
                                             'ul_snr': 50},
                '6c:c7:ec:94:e9:43': {       'alt_macs': None,
                                             'dev_macs': {       '04:d6:aa:6b:1b:28',
                                                                 '4c:5e:0c:e0:e6:95',
                                                                 '74:4d:28:e0:3f:6a'},
                                             'dl_link_rate': None,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '6c:c7:ec:94:e9:43',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': None,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': None,
                                             'ul_snr': 80},
                '74:4d:28:2e:53:fa': {       'alt_macs': {'74:4d:28:2e:53:f9'},
                                             'dev_macs': {'74:4d:28:81:59:02'},
                                             'dl_link_rate': None,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '74:4d:28:2e:53:fa',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': None,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': None,
                                             'ul_snr': 65}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '7228493499',
                                                              'in_ucast_pkts': '38436379',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '74:4d:28:81:59:02'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '309023747',
                                                                                       'in_ucast_pkts': '5680820',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '74:4d:28:2e:53:fa',
                                                                                       'out_discards': '159',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '3084963382',
                                                                                       'out_ucast_pkts': '27802662'},
                                                                               {       'bridged_mac_addresses': [       '04:d6:aa:6b:1b:28',
                                                                                                                        '4c:5e:0c:e0:e6:95',
                                                                                                                        '74:4d:28:e0:3f:6a'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '3422238880',
                                                                                       'in_ucast_pkts': '15046730',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '6c:c7:ec:94:e9:43',
                                                                                       'out_discards': '313',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '25250024028',
                                                                                       'out_ucast_pkts': '46542374'},
                                                                               {       'bridged_mac_addresses': [       '48:f8:b3:bf:50:19',
                                                                                                                        '74:4d:28:e0:5e:00'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '3497230872',
                                                                                       'in_ucast_pkts': '17708829',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '6c:c7:ec:35:59:14',
                                                                                       'out_discards': '1335',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '45728891838',
                                                                                       'out_ucast_pkts': '58573329'}],
                                                              'mac_address': '04:d6:aa:6b:1b:28',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '1807',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '74063879248',
                                                              'out_ucast_pkts': '132918365',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 64800,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'mac_address': '74:4d:28:2e:53:fa',
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0},
                                                                                                                                    {       'mac_address': '6c:c7:ec:94:e9:43',
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0},
                                                                                                                                    {       'mac_address': '6c:c7:ec:35:59:14',
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0}]}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'Tx12.60S'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '71788721372',
                                                              'in_ucast_pkts': '95858029',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:64:b3:f2',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '7596960405',
                                                              'out_ucast_pkts': '30580673',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.596313,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'BNaqaxso',
                                'system_mac_address': 'cc:2d:e0:64:b3:f2',
                                'uptime': '682894'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '159',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '3084963382',
                                                                       'in_ucast_pkts': '27802662',
                                                                       'links': [       {       'in_discards': '159',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '3084963382',
                                                                                                'in_ucast_pkts': '27802662',
                                                                                                'mac_address': '04:d6:aa:6b:1b:28',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '309023747',
                                                                                                'out_ucast_pkts': '5680820'}],
                                                                       'mac_address': '74:4d:28:2e:53:fa',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '309023747',
                                                                       'out_ucast_pkts': '5680820',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': '04:d6:aa:6b:1b:28'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Tx12.60S'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '309023747',
                                                                       'in_ucast_pkts': '5680820',
                                                                       'mac_address': '74:4d:28:2e:53:f9',
                                                                       'name': 'ether1',
                                                                       'out_octets': '3084963382',
                                                                       'out_ucast_pkts': '27802662',
                                                                       'poller_hash': 'NzQ0ZDI4MmU1M2ZhZXRoZXIx'}],
                                         'poller_hash': 'dE0oLlP6',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': '74:4d:28:2e:53:f9'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '313',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '25250024028',
                                                                       'in_ucast_pkts': '46542374',
                                                                       'links': [       {       'in_discards': '313',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '25250024028',
                                                                                                'in_ucast_pkts': '46542374',
                                                                                                'mac_address': '04:d6:aa:6b:1b:28',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '3422238880',
                                                                                                'out_ucast_pkts': '15046730'}],
                                                                       'mac_address': '6c:c7:ec:94:e9:43',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '3422238880',
                                                                       'out_ucast_pkts': '15046730',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': '04:d6:aa:6b:1b:28'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Tx12.60S'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '3422238880',
                                                                       'in_ucast_pkts': '15046730',
                                                                       'name': 'ether1',
                                                                       'out_octets': '25250024028',
                                                                       'out_ucast_pkts': '46542374',
                                                                       'poller_hash': 'NmNjN2VjOTRlOTQzZXRoZXIx'}],
                                         'poller_hash': 'bMfslOlD',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1335',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '45728891838',
                                                                       'in_ucast_pkts': '58573329',
                                                                       'links': [       {       'in_discards': '1335',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '45728891838',
                                                                                                'in_ucast_pkts': '58573329',
                                                                                                'mac_address': '04:d6:aa:6b:1b:28',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '3497230872',
                                                                                                'out_ucast_pkts': '17708829'}],
                                                                       'mac_address': '6c:c7:ec:35:59:14',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '3497230872',
                                                                       'out_ucast_pkts': '17708829',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': '04:d6:aa:6b:1b:28'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Tx12.60S'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '3497230872',
                                                                       'in_ucast_pkts': '17708829',
                                                                       'name': 'ether1',
                                                                       'out_octets': '45728891838',
                                                                       'out_ucast_pkts': '58573329',
                                                                       'poller_hash': 'NmNjN2VjMzU1OTE0ZXRoZXIx'}],
                                         'poller_hash': 'bMfsNVkU',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_44_5_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.44.5.01")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 2,
                'sw_version': '6.44.5',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 887444822995,
                'dl_en_packets': 818042215,
                'dl_noise_floor': None,
                'dl_rf_bytes': 887903061906,
                'dl_rf_packets': 894876174,
                'en_if_speed': 1000000000,
                'mem': 22.100830078125,
                'serial_number': '8AA50864F3F4',
                'ssid': '324',
                'system_mac_address': 'cc:2d:e0:b9:42:f3',
                'ul_en_bytes': 89996740763,
                'ul_en_packets': 510111957,
                'ul_noise_floor': None,
                'ul_rf_bytes': 88060721730,
                'ul_rf_packets': 582798648
        }
        exp_sta_stats = {
                '24:18:1d:26:d1:ca': {       'alt_macs': None,
                                             'dev_macs': {       '34:42:62:a8:57:8f',
                                                                 '58:c1:7a:9e:46:87',
                                                                 '5c:5f:67:b1:e4:6e',
                                                                 '5c:ea:1d:88:9c:67',
                                                                 '80:5e:c0:2e:9b:28',
                                                                 '88:ae:07:34:24:72',
                                                                 '94:57:a5:9a:f8:29',
                                                                 'cc:2d:e0:bc:40:af',
                                                                 'd4:ca:6d:35:4e:10'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.10.8.13',
                                             'mac_address': '24:18:1d:26:d1:ca',
                                             'name': 'South Bldg client',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -141.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -61,
                                             'ul_snr': 80},
                '24:18:1d:27:c8:67': {       'alt_macs': None,
                                             'dev_macs': {       '00:5b:94:21:5f:4a',
                                                                 '18:65:71:96:73:5d',
                                                                 '24:18:1d:26:d6:86',
                                                                 '58:c1:7a:9d:80:8f',
                                                                 '58:c1:7a:9d:f6:63',
                                                                 '58:c1:7a:9d:f7:38',
                                                                 '58:c1:7a:9e:47:35',
                                                                 '9c:b7:0d:c9:c6:d6',
                                                                 'a4:08:ea:74:66:72',
                                                                 'b8:a1:75:ed:22:d2',
                                                                 'cc:2d:e0:bc:60:35',
                                                                 'd4:ca:6d:87:95:48',
                                                                 'f8:62:14:e5:4e:dd'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.10.8.10',
                                             'mac_address': '24:18:1d:27:c8:67',
                                             'name': 'ManCamp 60ghz client',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -139.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -59,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '88060721730',
                                                              'in_ucast_pkts': '582798648',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '34:42:62:a8:57:8f',
                                                                                                                        '58:c1:7a:9e:46:87',
                                                                                                                        '5c:5f:67:b1:e4:6e',
                                                                                                                        '5c:ea:1d:88:9c:67',
                                                                                                                        '80:5e:c0:2e:9b:28',
                                                                                                                        '88:ae:07:34:24:72',
                                                                                                                        '94:57:a5:9a:f8:29',
                                                                                                                        'cc:2d:e0:bc:40:af',
                                                                                                                        'd4:ca:6d:35:4e:10'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '31803912568',
                                                                                       'in_ucast_pkts': '158357604',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:26:d1:ca',
                                                                                       'out_discards': '161',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '109374984801',
                                                                                       'out_ucast_pkts': '197010378'},
                                                                               {       'bridged_mac_addresses': [       '00:5b:94:21:5f:4a',
                                                                                                                        '18:65:71:96:73:5d',
                                                                                                                        '24:18:1d:26:d6:86',
                                                                                                                        '58:c1:7a:9d:80:8f',
                                                                                                                        '58:c1:7a:9d:f6:63',
                                                                                                                        '58:c1:7a:9d:f7:38',
                                                                                                                        '58:c1:7a:9e:47:35',
                                                                                                                        '9c:b7:0d:c9:c6:d6',
                                                                                                                        'a4:08:ea:74:66:72',
                                                                                                                        'b8:a1:75:ed:22:d2',
                                                                                                                        'cc:2d:e0:bc:60:35',
                                                                                                                        'd4:ca:6d:87:95:48',
                                                                                                                        'f8:62:14:e5:4e:dd'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '56256809162',
                                                                                       'in_ucast_pkts': '424441044',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:27:c8:67',
                                                                                       'out_discards': '168',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '778528077105',
                                                                                       'out_ucast_pkts': '697865796'}],
                                                              'mac_address': '24:18:1d:26:d6:86',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '329',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '887903061906',
                                                              'out_ucast_pkts': '894876174',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 87,
                                                                                                                                            'mac_address': '24:18:1d:26:d1:ca',
                                                                                                                                            'noise_floor': -141.0,
                                                                                                                                            'rssi': -61.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 44,
                                                                                                                                            'mac_address': '24:18:1d:27:c8:67',
                                                                                                                                            'noise_floor': -139.0,
                                                                                                                                            'rssi': -59.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -139.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': '324'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '887444822995',
                                                              'in_ucast_pkts': '818042215',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:b9:42:f3',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '89996740763',
                                                              'out_ucast_pkts': '510111957',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 22.10083,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'JBgdJtaG',
                                'serial_number': '8AA50864F3F4',
                                'sw_version': '6.44.5',
                                'system_mac_address': 'cc:2d:e0:b9:42:f3',
                                'uptime': '7119050'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '161',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '109374984801',
                                                                       'in_ucast_pkts': '197010378',
                                                                       'links': [       {       'in_discards': '161',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '109374984801',
                                                                                                'in_ucast_pkts': '197010378',
                                                                                                'mac_address': '24:18:1d:26:d6:86',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '31803912568',
                                                                                                'out_ucast_pkts': '158357604'}],
                                                                       'mac_address': '24:18:1d:26:d1:ca',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '31803912568',
                                                                       'out_ucast_pkts': '158357604',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 87,
                                                                                                                                                     'mac_address': '24:18:1d:26:d6:86',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': '324'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '31803912568',
                                                                       'in_ucast_pkts': '158357604',
                                                                       'name': 'ether1',
                                                                       'out_octets': '109374984801',
                                                                       'out_ucast_pkts': '197010378',
                                                                       'poller_hash': 'MjQxODFkMjZkMWNhZXRoZXIx'}],
                                         'management_ip': '10.10.8.13',
                                         'manufacturer': 'Mikrotik',
                                         'name': 'South Bldg client',
                                         'poller_hash': 'JBgdJtHK',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.44.5'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '168',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '778528077105',
                                                                       'in_ucast_pkts': '697865796',
                                                                       'links': [       {       'in_discards': '168',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '778528077105',
                                                                                                'in_ucast_pkts': '697865796',
                                                                                                'mac_address': '24:18:1d:26:d6:86',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '56256809162',
                                                                                                'out_ucast_pkts': '424441044'}],
                                                                       'mac_address': '24:18:1d:27:c8:67',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '56256809162',
                                                                       'out_ucast_pkts': '424441044',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 44,
                                                                                                                                                     'mac_address': '24:18:1d:26:d6:86',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': '324'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '56256809162',
                                                                       'in_ucast_pkts': '424441044',
                                                                       'name': 'ether1',
                                                                       'out_octets': '778528077105',
                                                                       'out_ucast_pkts': '697865796',
                                                                       'poller_hash': 'MjQxODFkMjdjODY3ZXRoZXIx'}],
                                         'management_ip': '10.10.8.10',
                                         'manufacturer': 'Mikrotik',
                                         'name': 'ManCamp 60ghz client',
                                         'poller_hash': 'JBgdJ8hn',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.44.5'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_45_5_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.45.5.01")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 0,
                'sw_version': '6.45.5',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 3975571,
                'dl_en_packets': 85064,
                'dl_noise_floor': None,
                'dl_rf_bytes': 0,
                'dl_rf_packets': 0,
                'en_if_speed': 1000000000,
                'mem': 20.43914794921875,
                'serial_number': '81ED080F7D06',
                'ssid': 'COU-E60G',
                'system_mac_address': 'cc:2d:e0:be:6d:c9',
                'ul_en_bytes': 3634446,
                'ul_en_packets': 45769,
                'ul_noise_floor': None,
                'ul_rf_bytes': 0,
                'ul_rf_packets': 0
        }
        exp_sta_stats = {
         
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '0',
                                                              'in_ucast_pkts': '0',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '04:d6:aa:b1:19:2d',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '0',
                                                              'out_ucast_pkts': '0',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1'}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'COU-E60G'}],
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '39712',
                                                              'in_octets': '3975571',
                                                              'in_ucast_pkts': '45352',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:be:6d:c9',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '20292',
                                                              'out_octets': '3634446',
                                                              'out_ucast_pkts': '25477',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.439148,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'BNaqsRkt',
                                'serial_number': '81ED080F7D06',
                                'sw_version': '6.45.5',
                                'system_mac_address': 'cc:2d:e0:be:6d:c9',
                                'uptime': '36925'}
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_45_5_02(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.45.5.02")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 3,
                'sw_version': '6.45.5',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 5541181801243,
                'dl_en_packets': 4692241378,
                'dl_noise_floor': None,
                'dl_rf_bytes': 5543872674683,
                'dl_rf_packets': 5603143633,
                'en_if_speed': 1000000000,
                'mem': 21.40960693359375,
                'serial_number': '81ED08EFF018',
                'ssid': 'COU-N60G',
                'system_mac_address': 'cc:2d:e0:be:6d:9e',
                'ul_en_bytes': 1064486727127,
                'ul_en_packets': 2041269791,
                'ul_noise_floor': None,
                'ul_rf_bytes': 1084396497164,
                'ul_rf_packets': 3059991523
        }
        exp_sta_stats = {
                '04:d6:aa:a8:d6:fc': {       'alt_macs': None,
                                             'dev_macs': {       '04:d6:aa:b1:19:2a',
                                                                 'b8:69:f4:38:c9:d5',
                                                                 'cc:2d:e0:22:62:ab'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d6:fc',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -141.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -61,
                                             'ul_snr': 80},
                '24:18:1d:99:67:d0': {       'alt_macs': None,
                                             'dev_macs': {       'b8:69:f4:3f:9b:84',
                                                                 'c4:ad:34:7d:47:8a'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:67:d0',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -139.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -59,
                                             'ul_snr': 80},
                '6c:c7:ec:97:c5:43': {       'alt_macs': None,
                                             'dev_macs': {'cc:2d:e0:32:08:83'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '6c:c7:ec:97:c5:43',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -129.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -64,
                                             'ul_snr': 65}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '1084396497164',
                                                              'in_ucast_pkts': '3059991523',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '04:d6:aa:b1:19:2a',
                                                                                                                        'b8:69:f4:38:c9:d5',
                                                                                                                        'cc:2d:e0:22:62:ab'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '62412393012',
                                                                                       'in_ucast_pkts': '725051820',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d6:fc',
                                                                                       'out_discards': '627',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1224535850976',
                                                                                       'out_ucast_pkts': '1378019341'},
                                                                               {       'bridged_mac_addresses': [       'b8:69:f4:3f:9b:84',
                                                                                                                        'c4:ad:34:7d:47:8a'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '317903777595',
                                                                                       'in_ucast_pkts': '610218410',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:67:d0',
                                                                                       'out_discards': '573',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '421095832000',
                                                                                       'out_ucast_pkts': '689170498'},
                                                                               {       'bridged_mac_addresses': [       'cc:2d:e0:32:08:83'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '195270735205',
                                                                                       'in_ucast_pkts': '651935557',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '6c:c7:ec:97:c5:43',
                                                                                       'out_discards': '535',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1686700173763',
                                                                                       'out_ucast_pkts': '1470155817'}],
                                                              'mac_address': '04:d6:aa:b1:19:2a',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '2377',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '5543872674683',
                                                              'out_ucast_pkts': '5603143633',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 244,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d6:fc',
                                                                                                                                            'noise_floor': -141.0,
                                                                                                                                            'rssi': -61.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 210,
                                                                                                                                            'mac_address': '24:18:1d:99:67:d0',
                                                                                                                                            'noise_floor': -139.0,
                                                                                                                                            'rssi': -59.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 240,
                                                                                                                                            'mac_address': '6c:c7:ec:97:c5:43',
                                                                                                                                            'noise_floor': -129.0,
                                                                                                                                            'rssi': -64.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -129.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'COU-N60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '127155834',
                                                              'in_octets': '5541181801243',
                                                              'in_ucast_pkts': '4565085544',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:be:6d:9e',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '34683411',
                                                              'out_octets': '1064486727127',
                                                              'out_ucast_pkts': '2006586380',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.409607,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'BNaqsRkq',
                                'serial_number': '81ED08EFF018',
                                'sw_version': '6.45.5',
                                'system_mac_address': 'cc:2d:e0:be:6d:9e',
                                'uptime': '6599619'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '627',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1224535850976',
                                                                       'in_ucast_pkts': '1378019341',
                                                                       'links': [       {       'in_discards': '627',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1224535850976',
                                                                                                'in_ucast_pkts': '1378019341',
                                                                                                'mac_address': '04:d6:aa:b1:19:2a',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '62412393012',
                                                                                                'out_ucast_pkts': '725051820'}],
                                                                       'mac_address': '04:d6:aa:a8:d6:fc',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '62412393012',
                                                                       'out_ucast_pkts': '725051820',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 244,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:19:2a',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'COU-N60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '62412393012',
                                                                       'in_ucast_pkts': '725051820',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1224535850976',
                                                                       'out_ucast_pkts': '1378019341',
                                                                       'poller_hash': 'MDRkNmFhYThkNmZjZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNb8',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '573',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '421095832000',
                                                                       'in_ucast_pkts': '689170498',
                                                                       'links': [       {       'in_discards': '573',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '421095832000',
                                                                                                'in_ucast_pkts': '689170498',
                                                                                                'mac_address': '04:d6:aa:b1:19:2a',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '317903777595',
                                                                                                'out_ucast_pkts': '610218410'}],
                                                                       'mac_address': '24:18:1d:99:67:d0',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '317903777595',
                                                                       'out_ucast_pkts': '610218410',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 210,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:19:2a',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'COU-N60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '317903777595',
                                                                       'in_ucast_pkts': '610218410',
                                                                       'name': 'ether1',
                                                                       'out_octets': '421095832000',
                                                                       'out_ucast_pkts': '689170498',
                                                                       'poller_hash': 'MjQxODFkOTk2N2QwZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWfQ',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '535',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1686700173763',
                                                                       'in_ucast_pkts': '1470155817',
                                                                       'links': [       {       'in_discards': '535',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1686700173763',
                                                                                                'in_ucast_pkts': '1470155817',
                                                                                                'mac_address': '04:d6:aa:b1:19:2a',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '195270735205',
                                                                                                'out_ucast_pkts': '651935557'}],
                                                                       'mac_address': '6c:c7:ec:97:c5:43',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '195270735205',
                                                                       'out_ucast_pkts': '651935557',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 240,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:19:2a',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'COU-N60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '195270735205',
                                                                       'in_ucast_pkts': '651935557',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1686700173763',
                                                                       'out_ucast_pkts': '1470155817',
                                                                       'poller_hash': 'NmNjN2VjOTdjNTQzZXRoZXIx'}],
                                         'poller_hash': 'bMfsl8VD',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_45_5_03(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.45.5.03")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 3,
                'sw_version': '6.45.5',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 11207790787312,
                'dl_en_packets': 8214547626,
                'dl_noise_floor': None,
                'dl_rf_bytes': 11197811940675,
                'dl_rf_packets': 8942851066,
                'en_if_speed': 1000000000,
                'mem': 21.1639404296875,
                'serial_number': '81ED08893CEC',
                'ssid': 'COU-S60G',
                'system_mac_address': 'cc:2d:e0:be:6d:68',
                'ul_en_bytes': 537029562641,
                'ul_en_packets': 3870562303,
                'ul_noise_floor': None,
                'ul_rf_bytes': 546407029567,
                'ul_rf_packets': 4721487716
        }
        exp_sta_stats = {
                '04:d6:aa:a4:cb:cc': {       'alt_macs': None,
                                             'dev_macs': {       '04:d6:aa:b1:18:b4',
                                                                 'c4:ad:34:7b:ea:0a'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a4:cb:cc',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -141.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -61,
                                             'ul_snr': 80},
                '24:18:1d:57:aa:60': {       'alt_macs': None,
                                             'dev_macs': {       '80:2a:a8:2f:39:64',
                                                                 'b8:69:f4:45:f4:ed'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:57:aa:60',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -153.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -58,
                                             'ul_snr': 95},
                '24:18:1d:99:67:97': {       'alt_macs': None,
                                             'dev_macs': {'48:8f:5a:0a:97:27'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:67:97',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -119.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -69,
                                             'ul_snr': 50}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '546407029567',
                                                              'in_ucast_pkts': '4721487716',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '80:2a:a8:2f:39:64',
                                                                                                                        'b8:69:f4:45:f4:ed'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '84609744358',
                                                                                       'in_ucast_pkts': '727291552',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:57:aa:60',
                                                                                       'out_discards': '1336',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '589342076819',
                                                                                       'out_ucast_pkts': '911806610'},
                                                                               {       'bridged_mac_addresses': [       '04:d6:aa:b1:18:b4',
                                                                                                                        'c4:ad:34:7b:ea:0a'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '200276854279',
                                                                                       'in_ucast_pkts': '2160095094',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a4:cb:cc',
                                                                                       'out_discards': '868',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '4834190705511',
                                                                                       'out_ucast_pkts': '3565156338'},
                                                                               {       'bridged_mac_addresses': [       '48:8f:5a:0a:97:27'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '22360143458',
                                                                                       'in_ucast_pkts': '292748361',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:67:97',
                                                                                       'out_discards': '942',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '206250723068',
                                                                                       'out_ucast_pkts': '369993418'}],
                                                              'mac_address': '04:d6:aa:b1:18:b4',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '4363',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '11197811940675',
                                                              'out_ucast_pkts': '8942851066',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 221,
                                                                                                                                            'mac_address': '24:18:1d:57:aa:60',
                                                                                                                                            'noise_floor': -153.0,
                                                                                                                                            'rssi': -58.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 107,
                                                                                                                                            'mac_address': '04:d6:aa:a4:cb:cc',
                                                                                                                                            'noise_floor': -141.0,
                                                                                                                                            'rssi': -61.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 220,
                                                                                                                                            'mac_address': '24:18:1d:99:67:97',
                                                                                                                                            'noise_floor': -119.0,
                                                                                                                                            'rssi': -69.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -119.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'COU-S60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '125257995',
                                                              'in_octets': '11207790787312',
                                                              'in_ucast_pkts': '8089289631',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:be:6d:68',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '31315451',
                                                              'out_octets': '537029562641',
                                                              'out_ucast_pkts': '3839246852',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.16394,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'BNaqsRi0',
                                'serial_number': '81ED08893CEC',
                                'sw_version': '6.45.5',
                                'system_mac_address': 'cc:2d:e0:be:6d:68',
                                'uptime': '6599483'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1336',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '589342076819',
                                                                       'in_ucast_pkts': '911806610',
                                                                       'links': [       {       'in_discards': '1336',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '589342076819',
                                                                                                'in_ucast_pkts': '911806610',
                                                                                                'mac_address': '04:d6:aa:b1:18:b4',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '84609744358',
                                                                                                'out_ucast_pkts': '727291552'}],
                                                                       'mac_address': '24:18:1d:57:aa:60',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '84609744358',
                                                                       'out_ucast_pkts': '727291552',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 221,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:18:b4',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'COU-S60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '84609744358',
                                                                       'in_ucast_pkts': '727291552',
                                                                       'name': 'ether1',
                                                                       'out_octets': '589342076819',
                                                                       'out_ucast_pkts': '911806610',
                                                                       'poller_hash': 'MjQxODFkNTdhYTYwZXRoZXIx'}],
                                         'poller_hash': 'JBgdV6pg',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '868',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '4834190705511',
                                                                       'in_ucast_pkts': '3565156338',
                                                                       'links': [       {       'in_discards': '868',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '4834190705511',
                                                                                                'in_ucast_pkts': '3565156338',
                                                                                                'mac_address': '04:d6:aa:b1:18:b4',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '200276854279',
                                                                                                'out_ucast_pkts': '2160095094'}],
                                                                       'mac_address': '04:d6:aa:a4:cb:cc',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '200276854279',
                                                                       'out_ucast_pkts': '2160095094',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 107,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:18:b4',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'COU-S60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '200276854279',
                                                                       'in_ucast_pkts': '2160095094',
                                                                       'name': 'ether1',
                                                                       'out_octets': '4834190705511',
                                                                       'out_ucast_pkts': '3565156338',
                                                                       'poller_hash': 'MDRkNmFhYTRjYmNjZXRoZXIx'}],
                                         'poller_hash': 'BNaqpMvM',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '942',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '206250723068',
                                                                       'in_ucast_pkts': '369993418',
                                                                       'links': [       {       'in_discards': '942',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '206250723068',
                                                                                                'in_ucast_pkts': '369993418',
                                                                                                'mac_address': '04:d6:aa:b1:18:b4',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '22360143458',
                                                                                                'out_ucast_pkts': '292748361'}],
                                                                       'mac_address': '24:18:1d:99:67:97',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '22360143458',
                                                                       'out_ucast_pkts': '292748361',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 220,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:18:b4',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'COU-S60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '22360143458',
                                                                       'in_ucast_pkts': '292748361',
                                                                       'name': 'ether1',
                                                                       'out_octets': '206250723068',
                                                                       'out_ucast_pkts': '369993418',
                                                                       'poller_hash': 'MjQxODFkOTk2Nzk3ZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWeX',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_45_5_04(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.45.5.04")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 5,
                'sw_version': '6.45.5',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 8220918723057,
                'dl_en_packets': 7180307643,
                'dl_noise_floor': None,
                'dl_rf_bytes': 8209343373116,
                'dl_rf_packets': 8345369618,
                'en_if_speed': 1000000000,
                'mem': 22.27020263671875,
                'serial_number': '8AA508C6DC9A',
                'ssid': 'NU5-NE60G',
                'system_mac_address': 'cc:2d:e0:b9:49:4c',
                'ul_en_bytes': 1138804817611,
                'ul_en_packets': 3290827510,
                'ul_noise_floor': None,
                'ul_rf_bytes': 1157636774854,
                'ul_rf_packets': 4512426163
        }
        exp_sta_stats = {
                '04:d6:aa:a8:d3:67': {       'alt_macs': None,
                                             'dev_macs': {       '64:d1:54:b8:e7:f8',
                                                                 'b8:69:f4:33:1d:22'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d3:67',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -136.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -66,
                                             'ul_snr': 70},
                '24:18:1d:57:ab:3c': {       'alt_macs': None,
                                             'dev_macs': {'48:8f:5a:0a:89:00'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:57:ab:3c',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -117.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -67,
                                             'ul_snr': 50},
                '24:18:1d:5a:12:4b': {       'alt_macs': None,
                                             'dev_macs': {'74:4d:28:c4:34:69'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:5a:12:4b',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -152.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -57,
                                             'ul_snr': 95},
                'b8:69:f4:91:50:e5': {       'alt_macs': None,
                                             'dev_macs': {       '74:4d:28:a0:61:38',
                                                                 '74:4d:28:a0:61:39',
                                                                 'e0:55:3d:77:f0:16'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': 'b8:69:f4:91:50:e5',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -138.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -58,
                                             'ul_snr': 80},
                'b8:69:f4:91:66:03': {       'alt_macs': {'b8:69:f4:91:66:02'},
                                             'dev_macs': {       '04:d6:aa:b1:16:20',
                                                                 'cc:2d:e0:22:76:a1'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': 'b8:69:f4:91:66:03',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -118.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -68,
                                             'ul_snr': 50}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '1157636774854',
                                                              'in_ucast_pkts': '4512426163',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '64:d1:54:b8:e7:f8',
                                                                                                                        'b8:69:f4:33:1d:22'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '174271110835',
                                                                                       'in_ucast_pkts': '1532818345',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d3:67',
                                                                                       'out_discards': '6791',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '4197141229423',
                                                                                       'out_ucast_pkts': '3423556331'},
                                                                               {       'bridged_mac_addresses': [       '04:d6:aa:b1:16:20',
                                                                                                                        'cc:2d:e0:22:76:a1'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '91036006279',
                                                                                       'in_ucast_pkts': '654435020',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': 'b8:69:f4:91:66:03',
                                                                                       'out_discards': '1671',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '520314053557',
                                                                                       'out_ucast_pkts': '902546426'},
                                                                               {       'bridged_mac_addresses': [       '48:8f:5a:0a:89:00'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '28352640617',
                                                                                       'in_ucast_pkts': '293219063',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:57:ab:3c',
                                                                                       'out_discards': '878',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '243654062992',
                                                                                       'out_ucast_pkts': '426360961'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:c4:34:69'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '160073711267',
                                                                                       'in_ucast_pkts': '579794582',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:5a:12:4b',
                                                                                       'out_discards': '228',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '409528781133',
                                                                                       'out_ucast_pkts': '787186699'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:a0:61:38',
                                                                                                                        '74:4d:28:a0:61:39',
                                                                                                                        'e0:55:3d:77:f0:16'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '703903305856',
                                                                                       'in_ucast_pkts': '1452159153',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': 'b8:69:f4:91:50:e5',
                                                                                       'out_discards': '368',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '2838705246011',
                                                                                       'out_ucast_pkts': '2805719201'}],
                                                              'mac_address': '04:d6:aa:b1:16:20',
                                                              'mtu': 1500,
                                                              'name': 'NU5-NE60G',
                                                              'oper_up': True,
                                                              'out_discards': '9936',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '8209343373116',
                                                              'out_ucast_pkts': '8345369618',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 165,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d3:67',
                                                                                                                                            'noise_floor': -136.0,
                                                                                                                                            'rssi': -66.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 70.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 125,
                                                                                                                                            'mac_address': 'b8:69:f4:91:66:03',
                                                                                                                                            'noise_floor': -118.0,
                                                                                                                                            'rssi': -68.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 387,
                                                                                                                                            'mac_address': '24:18:1d:57:ab:3c',
                                                                                                                                            'noise_floor': -117.0,
                                                                                                                                            'rssi': -67.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 135,
                                                                                                                                            'mac_address': '24:18:1d:5a:12:4b',
                                                                                                                                            'noise_floor': -152.0,
                                                                                                                                            'rssi': -57.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 135,
                                                                                                                                            'mac_address': 'b8:69:f4:91:50:e5',
                                                                                                                                            'noise_floor': -138.0,
                                                                                                                                            'rssi': -58.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -117.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU5-NE60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '87844984',
                                                              'in_octets': '8220918723057',
                                                              'in_ucast_pkts': '7092462659',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:b9:49:4c',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '17532605',
                                                              'out_octets': '1138804817611',
                                                              'out_ucast_pkts': '3273294905',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 22.270203,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'BNaqsRYg',
                                'serial_number': '8AA508C6DC9A',
                                'sw_version': '6.45.5',
                                'system_mac_address': 'cc:2d:e0:b9:49:4c',
                                'uptime': '6458481'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '6791',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '4197141229423',
                                                                       'in_ucast_pkts': '3423556331',
                                                                       'links': [       {       'in_discards': '6791',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '4197141229423',
                                                                                                'in_ucast_pkts': '3423556331',
                                                                                                'mac_address': '04:d6:aa:b1:16:20',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '174271110835',
                                                                                                'out_ucast_pkts': '1532818345'}],
                                                                       'mac_address': '04:d6:aa:a8:d3:67',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '174271110835',
                                                                       'out_ucast_pkts': '1532818345',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 165,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:16:20',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU5-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '174271110835',
                                                                       'in_ucast_pkts': '1532818345',
                                                                       'name': 'ether1',
                                                                       'out_octets': '4197141229423',
                                                                       'out_ucast_pkts': '3423556331',
                                                                       'poller_hash': 'MDRkNmFhYThkMzY3ZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNNn',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1671',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '520314053557',
                                                                       'in_ucast_pkts': '902546426',
                                                                       'links': [       {       'in_discards': '1671',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '520314053557',
                                                                                                'in_ucast_pkts': '902546426',
                                                                                                'mac_address': '04:d6:aa:b1:16:20',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '91036006279',
                                                                                                'out_ucast_pkts': '654435020'}],
                                                                       'mac_address': 'b8:69:f4:91:66:03',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '91036006279',
                                                                       'out_ucast_pkts': '654435020',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 125,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:16:20',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU5-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '91036006279',
                                                                       'in_ucast_pkts': '654435020',
                                                                       'mac_address': 'b8:69:f4:91:66:02',
                                                                       'name': 'ether1',
                                                                       'out_octets': '520314053557',
                                                                       'out_ucast_pkts': '902546426',
                                                                       'poller_hash': 'Yjg2OWY0OTE2NjAzZXRoZXIx'}],
                                         'poller_hash': 'uGn0kWYD',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': 'b8:69:f4:91:66:02'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '878',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '243654062992',
                                                                       'in_ucast_pkts': '426360961',
                                                                       'links': [       {       'in_discards': '878',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '243654062992',
                                                                                                'in_ucast_pkts': '426360961',
                                                                                                'mac_address': '04:d6:aa:b1:16:20',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '28352640617',
                                                                                                'out_ucast_pkts': '293219063'}],
                                                                       'mac_address': '24:18:1d:57:ab:3c',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '28352640617',
                                                                       'out_ucast_pkts': '293219063',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 387,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:16:20',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU5-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '28352640617',
                                                                       'in_ucast_pkts': '293219063',
                                                                       'name': 'ether1',
                                                                       'out_octets': '243654062992',
                                                                       'out_ucast_pkts': '426360961',
                                                                       'poller_hash': 'MjQxODFkNTdhYjNjZXRoZXIx'}],
                                         'poller_hash': 'JBgdV6s8',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '228',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '409528781133',
                                                                       'in_ucast_pkts': '787186699',
                                                                       'links': [       {       'in_discards': '228',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '409528781133',
                                                                                                'in_ucast_pkts': '787186699',
                                                                                                'mac_address': '04:d6:aa:b1:16:20',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '160073711267',
                                                                                                'out_ucast_pkts': '579794582'}],
                                                                       'mac_address': '24:18:1d:5a:12:4b',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '160073711267',
                                                                       'out_ucast_pkts': '579794582',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 135,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:16:20',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU5-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '160073711267',
                                                                       'in_ucast_pkts': '579794582',
                                                                       'name': 'ether1',
                                                                       'out_octets': '409528781133',
                                                                       'out_ucast_pkts': '787186699',
                                                                       'poller_hash': 'MjQxODFkNWExMjRiZXRoZXIx'}],
                                         'poller_hash': 'JBgdWhJL',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '368',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '2838705246011',
                                                                       'in_ucast_pkts': '2805719201',
                                                                       'links': [       {       'in_discards': '368',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '2838705246011',
                                                                                                'in_ucast_pkts': '2805719201',
                                                                                                'mac_address': '04:d6:aa:b1:16:20',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '703903305856',
                                                                                                'out_ucast_pkts': '1452159153'}],
                                                                       'mac_address': 'b8:69:f4:91:50:e5',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '703903305856',
                                                                       'out_ucast_pkts': '1452159153',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 135,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:16:20',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU5-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '703903305856',
                                                                       'in_ucast_pkts': '1452159153',
                                                                       'name': 'ether1',
                                                                       'out_octets': '2838705246011',
                                                                       'out_ucast_pkts': '2805719201',
                                                                       'poller_hash': 'Yjg2OWY0OTE1MGU1ZXRoZXIx'}],
                                         'poller_hash': 'uGn0kVDl',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_45_5_05(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.45.5.05")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 4,
                'sw_version': '6.45.5',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 10566569629644,
                'dl_en_packets': 8000865831,
                'dl_noise_floor': None,
                'dl_rf_bytes': 10555479915664,
                'dl_rf_packets': 8841392561,
                'en_if_speed': 1000000000,
                'mem': 21.56982421875,
                'serial_number': '8AA508C5C6A7',
                'ssid': 'NU5-SE60G',
                'system_mac_address': 'cc:2d:e0:b9:49:e2',
                'ul_en_bytes': 734747165435,
                'ul_en_packets': 2967038894,
                'ul_noise_floor': None,
                'ul_rf_bytes': 746780182005,
                'ul_rf_packets': 3874086908
        }
        exp_sta_stats = {
                '04:d6:aa:a4:cb:ae': {       'alt_macs': None,
                                             'dev_macs': {'48:8f:5a:0a:0f:6e'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a4:cb:ae',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -141.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -61,
                                             'ul_snr': 80},
                '04:d6:aa:a8:d6:de': {       'alt_macs': None,
                                             'dev_macs': {       'b8:69:f4:38:c9:07',
                                                                 'b8:69:f4:99:2f:21'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d6:de',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -139.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -59,
                                             'ul_snr': 80},
                '24:18:1d:99:67:a0': {       'alt_macs': None,
                                             'dev_macs': {       '04:d6:aa:b1:16:2d',
                                                                 '08:55:31:66:35:6a',
                                                                 'b8:69:f4:3f:9b:1d'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:67:a0',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -151.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -56,
                                             'ul_snr': 95},
                'b8:69:f4:91:66:73': {       'alt_macs': {'b8:69:f4:91:66:72'},
                                             'dev_macs': {'cc:2d:e0:ad:f5:e5'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': 'b8:69:f4:91:66:73',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -119.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -69,
                                             'ul_snr': 50}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '746780182005',
                                                              'in_ucast_pkts': '3874086908',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       'b8:69:f4:38:c9:07',
                                                                                                                        'b8:69:f4:99:2f:21'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '250386271202',
                                                                                       'in_ucast_pkts': '2115633282',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d6:de',
                                                                                       'out_discards': '694',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '8004395035780',
                                                                                       'out_ucast_pkts': '6055038621'},
                                                                               {       'bridged_mac_addresses': [       'cc:2d:e0:ad:f5:e5'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '197955055524',
                                                                                       'in_ucast_pkts': '906293895',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': 'b8:69:f4:91:66:73',
                                                                                       'out_discards': '8735',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1089409059113',
                                                                                       'out_ucast_pkts': '1328600116'},
                                                                               {       'bridged_mac_addresses': [       '48:8f:5a:0a:0f:6e'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '297974746034',
                                                                                       'in_ucast_pkts': '845213371',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a4:cb:ae',
                                                                                       'out_discards': '613',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1461342172947',
                                                                                       'out_ucast_pkts': '1450597685'},
                                                                               {       'bridged_mac_addresses': [       '04:d6:aa:b1:16:2d',
                                                                                                                        '08:55:31:66:35:6a',
                                                                                                                        'b8:69:f4:3f:9b:1d'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '464109245',
                                                                                       'in_ucast_pkts': '6946360',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:67:a0',
                                                                                       'out_discards': '116',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '333647824',
                                                                                       'out_ucast_pkts': '7156139'}],
                                                              'mac_address': '04:d6:aa:b1:16:2d',
                                                              'mtu': 1500,
                                                              'name': 'NU5-SE60G',
                                                              'oper_up': True,
                                                              'out_discards': '10158',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '10555479915664',
                                                              'out_ucast_pkts': '8841392561',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 136,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d6:de',
                                                                                                                                            'noise_floor': -139.0,
                                                                                                                                            'rssi': -59.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 161,
                                                                                                                                            'mac_address': 'b8:69:f4:91:66:73',
                                                                                                                                            'noise_floor': -119.0,
                                                                                                                                            'rssi': -69.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 180,
                                                                                                                                            'mac_address': '04:d6:aa:a4:cb:ae',
                                                                                                                                            'noise_floor': -141.0,
                                                                                                                                            'rssi': -61.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 147,
                                                                                                                                            'mac_address': '24:18:1d:99:67:a0',
                                                                                                                                            'noise_floor': -151.0,
                                                                                                                                            'rssi': -56.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -119.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU5-SE60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '81370317',
                                                              'in_octets': '10566569629644',
                                                              'in_ucast_pkts': '7919495514',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:b9:49:e2',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '24008007',
                                                              'out_octets': '734747165435',
                                                              'out_ucast_pkts': '2943030887',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.569824,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'BNaqsRYt',
                                'serial_number': '8AA508C5C6A7',
                                'sw_version': '6.45.5',
                                'system_mac_address': 'cc:2d:e0:b9:49:e2',
                                'uptime': '6457360'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '694',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '8004395035780',
                                                                       'in_ucast_pkts': '6055038621',
                                                                       'links': [       {       'in_discards': '694',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '8004395035780',
                                                                                                'in_ucast_pkts': '6055038621',
                                                                                                'mac_address': '04:d6:aa:b1:16:2d',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '250386271202',
                                                                                                'out_ucast_pkts': '2115633282'}],
                                                                       'mac_address': '04:d6:aa:a8:d6:de',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '250386271202',
                                                                       'out_ucast_pkts': '2115633282',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 136,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:16:2d',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU5-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '250386271202',
                                                                       'in_ucast_pkts': '2115633282',
                                                                       'name': 'ether1',
                                                                       'out_octets': '8004395035780',
                                                                       'out_ucast_pkts': '6055038621',
                                                                       'poller_hash': 'MDRkNmFhYThkNmRlZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNbe',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '8735',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1089409059113',
                                                                       'in_ucast_pkts': '1328600116',
                                                                       'links': [       {       'in_discards': '8735',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1089409059113',
                                                                                                'in_ucast_pkts': '1328600116',
                                                                                                'mac_address': '04:d6:aa:b1:16:2d',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '197955055524',
                                                                                                'out_ucast_pkts': '906293895'}],
                                                                       'mac_address': 'b8:69:f4:91:66:73',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '197955055524',
                                                                       'out_ucast_pkts': '906293895',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 161,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:16:2d',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU5-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '197955055524',
                                                                       'in_ucast_pkts': '906293895',
                                                                       'mac_address': 'b8:69:f4:91:66:72',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1089409059113',
                                                                       'out_ucast_pkts': '1328600116',
                                                                       'poller_hash': 'Yjg2OWY0OTE2NjczZXRoZXIx'}],
                                         'poller_hash': 'uGn0kWZz',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': 'b8:69:f4:91:66:72'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '613',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1461342172947',
                                                                       'in_ucast_pkts': '1450597685',
                                                                       'links': [       {       'in_discards': '613',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1461342172947',
                                                                                                'in_ucast_pkts': '1450597685',
                                                                                                'mac_address': '04:d6:aa:b1:16:2d',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '297974746034',
                                                                                                'out_ucast_pkts': '845213371'}],
                                                                       'mac_address': '04:d6:aa:a4:cb:ae',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '297974746034',
                                                                       'out_ucast_pkts': '845213371',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 180,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:16:2d',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU5-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '297974746034',
                                                                       'in_ucast_pkts': '845213371',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1461342172947',
                                                                       'out_ucast_pkts': '1450597685',
                                                                       'poller_hash': 'MDRkNmFhYTRjYmFlZXRoZXIx'}],
                                         'poller_hash': 'BNaqpMuu',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '116',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '333647824',
                                                                       'in_ucast_pkts': '7156139',
                                                                       'links': [       {       'in_discards': '116',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '333647824',
                                                                                                'in_ucast_pkts': '7156139',
                                                                                                'mac_address': '04:d6:aa:b1:16:2d',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '464109245',
                                                                                                'out_ucast_pkts': '6946360'}],
                                                                       'mac_address': '24:18:1d:99:67:a0',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '464109245',
                                                                       'out_ucast_pkts': '6946360',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 147,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:16:2d',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU5-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '464109245',
                                                                       'in_ucast_pkts': '6946360',
                                                                       'name': 'ether1',
                                                                       'out_octets': '333647824',
                                                                       'out_ucast_pkts': '7156139',
                                                                       'poller_hash': 'MjQxODFkOTk2N2EwZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWeg',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_45_6_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.45.6.01")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 5,
                'sw_version': '6.45.6',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 784038343564,
                'dl_en_packets': 619692822,
                'dl_noise_floor': None,
                'dl_rf_bytes': 790832876632,
                'dl_rf_packets': 894313812,
                'en_if_speed': 1000000000,
                'mem': 21.2554931640625,
                'serial_number': '8AA5083A2BC8',
                'ssid': 'TN3-NE60G',
                'system_mac_address': 'cc:2d:e0:b9:4a:42',
                'ul_en_bytes': 76070640089,
                'ul_en_packets': 276051827,
                'ul_noise_floor': None,
                'ul_rf_bytes': 83586598527,
                'ul_rf_packets': 549804257
        }
        exp_sta_stats = {
                '04:d6:aa:a8:d1:87': {       'alt_macs': None,
                                             'dev_macs': {       '64:d1:54:9e:79:7a',
                                                                 'b8:69:f4:32:ee:03'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d1:87',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -142.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -62,
                                             'ul_snr': 80},
                '04:d6:aa:a8:d3:8c': {       'alt_macs': None,
                                             'dev_macs': {       '48:8f:5a:93:c0:00',
                                                                 'b8:69:f4:38:c9:73'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d3:8c',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -142.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -62,
                                             'ul_snr': 80},
                '04:d6:aa:a8:d6:83': {       'alt_macs': None,
                                             'dev_macs': {       '64:d1:54:f5:aa:56',
                                                                 'b8:69:f4:33:21:b0'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d6:83',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -128.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -63,
                                             'ul_snr': 65},
                '24:18:1d:64:ec:97': {       'alt_macs': None,
                                             'dev_macs': {       '64:d1:54:90:98:1c',
                                                                 'b8:69:f4:45:f3:99'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:64:ec:97',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -129.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -64,
                                             'ul_snr': 65},
                '24:18:1d:64:ed:ec': {       'alt_macs': None,
                                             'dev_macs': {       '04:d6:aa:b1:1c:6e',
                                                                 '64:d1:54:88:7a:2c',
                                                                 'b8:69:f4:45:f1:fc'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:64:ed:ec',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -128.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -63,
                                             'ul_snr': 65}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '83586598527',
                                                              'in_ucast_pkts': '549804257',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '48:8f:5a:93:c0:00',
                                                                                                                        'b8:69:f4:38:c9:73'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '3887938802',
                                                                                       'in_ucast_pkts': '70057308',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d3:8c',
                                                                                       'out_discards': '28',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '74913960953',
                                                                                       'out_ucast_pkts': '113712910'},
                                                                               {       'bridged_mac_addresses': [       '64:d1:54:f5:aa:56',
                                                                                                                        'b8:69:f4:33:21:b0'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '2345216691',
                                                                                       'in_ucast_pkts': '64432975',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d6:83',
                                                                                       'out_discards': '104',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '2615612368',
                                                                                       'out_ucast_pkts': '67693058'},
                                                                               {       'bridged_mac_addresses': [       '64:d1:54:9e:79:7a',
                                                                                                                        'b8:69:f4:32:ee:03'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '9364799363',
                                                                                       'in_ucast_pkts': '102011671',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d1:87',
                                                                                       'out_discards': '31',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '82566196769',
                                                                                       'out_ucast_pkts': '123299059'},
                                                                               {       'bridged_mac_addresses': [       '04:d6:aa:b1:1c:6e',
                                                                                                                        '64:d1:54:88:7a:2c',
                                                                                                                        'b8:69:f4:45:f1:fc'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '21002723485',
                                                                                       'in_ucast_pkts': '161861802',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:64:ed:ec',
                                                                                       'out_discards': '86',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '462318379923',
                                                                                       'out_ucast_pkts': '387343155'},
                                                                               {       'bridged_mac_addresses': [       '64:d1:54:90:98:1c',
                                                                                                                        'b8:69:f4:45:f3:99'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '46985920186',
                                                                                       'in_ucast_pkts': '151440501',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:64:ec:97',
                                                                                       'out_discards': '92',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '168418726619',
                                                                                       'out_ucast_pkts': '202265630'}],
                                                              'mac_address': '04:d6:aa:b1:1c:6e',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '341',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '790832876632',
                                                              'out_ucast_pkts': '894313812',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 106,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d3:8c',
                                                                                                                                            'noise_floor': -142.0,
                                                                                                                                            'rssi': -62.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 268,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d6:83',
                                                                                                                                            'noise_floor': -128.0,
                                                                                                                                            'rssi': -63.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 64,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d1:87',
                                                                                                                                            'noise_floor': -142.0,
                                                                                                                                            'rssi': -62.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 201,
                                                                                                                                            'mac_address': '24:18:1d:64:ed:ec',
                                                                                                                                            'noise_floor': -128.0,
                                                                                                                                            'rssi': -63.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 262,
                                                                                                                                            'mac_address': '24:18:1d:64:ec:97',
                                                                                                                                            'noise_floor': -129.0,
                                                                                                                                            'rssi': -64.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -128.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'TN3-NE60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '8573660',
                                                              'in_octets': '784038343564',
                                                              'in_ucast_pkts': '611119162',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:b9:4a:42',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '5636195',
                                                              'out_octets': '76070640089',
                                                              'out_ucast_pkts': '270415632',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.255493,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'BNaqsRxu',
                                'serial_number': '8AA5083A2BC8',
                                'sw_version': '6.45.6',
                                'system_mac_address': 'cc:2d:e0:b9:4a:42',
                                'uptime': '6017866'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '28',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '74913960953',
                                                                       'in_ucast_pkts': '113712910',
                                                                       'links': [       {       'in_discards': '28',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '74913960953',
                                                                                                'in_ucast_pkts': '113712910',
                                                                                                'mac_address': '04:d6:aa:b1:1c:6e',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '3887938802',
                                                                                                'out_ucast_pkts': '70057308'}],
                                                                       'mac_address': '04:d6:aa:a8:d3:8c',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '3887938802',
                                                                       'out_ucast_pkts': '70057308',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 106,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:1c:6e',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN3-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '3887938802',
                                                                       'in_ucast_pkts': '70057308',
                                                                       'name': 'ether1',
                                                                       'out_octets': '74913960953',
                                                                       'out_ucast_pkts': '113712910',
                                                                       'poller_hash': 'MDRkNmFhYThkMzhjZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNOM',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '104',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '2615612368',
                                                                       'in_ucast_pkts': '67693058',
                                                                       'links': [       {       'in_discards': '104',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '2615612368',
                                                                                                'in_ucast_pkts': '67693058',
                                                                                                'mac_address': '04:d6:aa:b1:1c:6e',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '2345216691',
                                                                                                'out_ucast_pkts': '64432975'}],
                                                                       'mac_address': '04:d6:aa:a8:d6:83',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '2345216691',
                                                                       'out_ucast_pkts': '64432975',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 268,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:1c:6e',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN3-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '2345216691',
                                                                       'in_ucast_pkts': '64432975',
                                                                       'name': 'ether1',
                                                                       'out_octets': '2615612368',
                                                                       'out_ucast_pkts': '67693058',
                                                                       'poller_hash': 'MDRkNmFhYThkNjgzZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNaD',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '31',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '82566196769',
                                                                       'in_ucast_pkts': '123299059',
                                                                       'links': [       {       'in_discards': '31',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '82566196769',
                                                                                                'in_ucast_pkts': '123299059',
                                                                                                'mac_address': '04:d6:aa:b1:1c:6e',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '9364799363',
                                                                                                'out_ucast_pkts': '102011671'}],
                                                                       'mac_address': '04:d6:aa:a8:d1:87',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '9364799363',
                                                                       'out_ucast_pkts': '102011671',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 64,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:1c:6e',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN3-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '9364799363',
                                                                       'in_ucast_pkts': '102011671',
                                                                       'name': 'ether1',
                                                                       'out_octets': '82566196769',
                                                                       'out_ucast_pkts': '123299059',
                                                                       'poller_hash': 'MDRkNmFhYThkMTg3ZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNGH',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '86',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '462318379923',
                                                                       'in_ucast_pkts': '387343155',
                                                                       'links': [       {       'in_discards': '86',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '462318379923',
                                                                                                'in_ucast_pkts': '387343155',
                                                                                                'mac_address': '04:d6:aa:b1:1c:6e',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '21002723485',
                                                                                                'out_ucast_pkts': '161861802'}],
                                                                       'mac_address': '24:18:1d:64:ed:ec',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '21002723485',
                                                                       'out_ucast_pkts': '161861802',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 201,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:1c:6e',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN3-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '21002723485',
                                                                       'in_ucast_pkts': '161861802',
                                                                       'name': 'ether1',
                                                                       'out_octets': '462318379923',
                                                                       'out_ucast_pkts': '387343155',
                                                                       'poller_hash': 'MjQxODFkNjRlZGVjZXRoZXIx'}],
                                         'poller_hash': 'JBgdZO3s',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '92',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '168418726619',
                                                                       'in_ucast_pkts': '202265630',
                                                                       'links': [       {       'in_discards': '92',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '168418726619',
                                                                                                'in_ucast_pkts': '202265630',
                                                                                                'mac_address': '04:d6:aa:b1:1c:6e',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '46985920186',
                                                                                                'out_ucast_pkts': '151440501'}],
                                                                       'mac_address': '24:18:1d:64:ec:97',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '46985920186',
                                                                       'out_ucast_pkts': '151440501',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 262,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:1c:6e',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN3-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '46985920186',
                                                                       'in_ucast_pkts': '151440501',
                                                                       'name': 'ether1',
                                                                       'out_octets': '168418726619',
                                                                       'out_ucast_pkts': '202265630',
                                                                       'poller_hash': 'MjQxODFkNjRlYzk3ZXRoZXIx'}],
                                         'poller_hash': 'JBgdZOyX',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_45_6_02(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.45.6.02")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 2,
                'sw_version': '6.45.6',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 304647326492,
                'dl_en_packets': 325412376,
                'dl_noise_floor': None,
                'dl_rf_bytes': 306441808962,
                'dl_rf_packets': 414819015,
                'en_if_speed': 1000000000,
                'mem': 21.38824462890625,
                'serial_number': '8AA508EC1F40',
                'ssid': 'TN3-SE60G',
                'system_mac_address': 'cc:2d:e0:b9:4a:71',
                'ul_en_bytes': 108293473774,
                'ul_en_packets': 228714991,
                'ul_noise_floor': None,
                'ul_rf_bytes': 109889824252,
                'ul_rf_packets': 322545290
        }
        exp_sta_stats = {
                '24:18:1d:64:ec:92': {       'alt_macs': None,
                                             'dev_macs': {       '04:d6:aa:b1:16:21',
                                                                 'b8:69:f4:45:f3:c4',
                                                                 'cc:2d:e0:24:b4:bc'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:64:ec:92',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -152.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -57,
                                             'ul_snr': 95},
                '6c:c7:ec:9a:1a:be': {       'alt_macs': None,
                                             'dev_macs': {'74:4d:28:c4:38:3e'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '6c:c7:ec:9a:1a:be',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -129.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -64,
                                             'ul_snr': 65}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '109889824252',
                                                              'in_ucast_pkts': '322545290',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '04:d6:aa:b1:16:21',
                                                                                                                        'b8:69:f4:45:f3:c4',
                                                                                                                        'cc:2d:e0:24:b4:bc'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '46101371783',
                                                                                       'in_ucast_pkts': '142940464',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:64:ec:92',
                                                                                       'out_discards': '57',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '146618367866',
                                                                                       'out_ucast_pkts': '188959503'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:c4:38:3e'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '63788452469',
                                                                                       'in_ucast_pkts': '179604826',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '6c:c7:ec:9a:1a:be',
                                                                                       'out_discards': '34',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '159823441096',
                                                                                       'out_ucast_pkts': '225859512'}],
                                                              'mac_address': '04:d6:aa:b1:16:21',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '91',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '306441808962',
                                                              'out_ucast_pkts': '414819015',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 103,
                                                                                                                                            'mac_address': '24:18:1d:64:ec:92',
                                                                                                                                            'noise_floor': -152.0,
                                                                                                                                            'rssi': -57.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 312,
                                                                                                                                            'mac_address': '6c:c7:ec:9a:1a:be',
                                                                                                                                            'noise_floor': -129.0,
                                                                                                                                            'rssi': -64.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -129.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'TN3-SE60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '10289285',
                                                              'in_octets': '304647326492',
                                                              'in_ucast_pkts': '315123091',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:b9:4a:71',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '3920759',
                                                              'out_octets': '108293473774',
                                                              'out_ucast_pkts': '224794232',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.388245,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'BNaqsRYh',
                                'serial_number': '8AA508EC1F40',
                                'sw_version': '6.45.6',
                                'system_mac_address': 'cc:2d:e0:b9:4a:71',
                                'uptime': '6018045'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '57',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '146618367866',
                                                                       'in_ucast_pkts': '188959503',
                                                                       'links': [       {       'in_discards': '57',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '146618367866',
                                                                                                'in_ucast_pkts': '188959503',
                                                                                                'mac_address': '04:d6:aa:b1:16:21',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '46101371783',
                                                                                                'out_ucast_pkts': '142940464'}],
                                                                       'mac_address': '24:18:1d:64:ec:92',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '46101371783',
                                                                       'out_ucast_pkts': '142940464',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 103,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:16:21',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN3-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '46101371783',
                                                                       'in_ucast_pkts': '142940464',
                                                                       'name': 'ether1',
                                                                       'out_octets': '146618367866',
                                                                       'out_ucast_pkts': '188959503',
                                                                       'poller_hash': 'MjQxODFkNjRlYzkyZXRoZXIx'}],
                                         'poller_hash': 'JBgdZOyS',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '34',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '159823441096',
                                                                       'in_ucast_pkts': '225859512',
                                                                       'links': [       {       'in_discards': '34',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '159823441096',
                                                                                                'in_ucast_pkts': '225859512',
                                                                                                'mac_address': '04:d6:aa:b1:16:21',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '63788452469',
                                                                                                'out_ucast_pkts': '179604826'}],
                                                                       'mac_address': '6c:c7:ec:9a:1a:be',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '63788452469',
                                                                       'out_ucast_pkts': '179604826',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 312,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:16:21',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN3-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '63788452469',
                                                                       'in_ucast_pkts': '179604826',
                                                                       'name': 'ether1',
                                                                       'out_octets': '159823441096',
                                                                       'out_ucast_pkts': '225859512',
                                                                       'poller_hash': 'NmNjN2VjOWExYWJlZXRoZXIx'}],
                                         'poller_hash': 'bMfsmhq+',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_45_6_03(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.45.6.03")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 2,
                'sw_version': '6.45.6',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 899574434837,
                'dl_en_packets': 705590411,
                'dl_noise_floor': None,
                'dl_rf_bytes': 899264060558,
                'dl_rf_packets': 787066023,
                'en_if_speed': 1000000000,
                'mem': 20.71380615234375,
                'serial_number': '8AA508DBF0C3',
                'ssid': 'TN3-NW60G',
                'system_mac_address': 'cc:2d:e0:bc:31:09',
                'ul_en_bytes': 80527959882,
                'ul_en_packets': 417146845,
                'ul_noise_floor': None,
                'ul_rf_bytes': 81936716362,
                'ul_rf_packets': 508143943
        }
        exp_sta_stats = {
                '24:18:1d:5a:13:23': {       'alt_macs': None,
                                             'dev_macs': {'c4:ad:34:7d:48:d4'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:5a:13:23',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -150.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -55,
                                             'ul_snr': 95},
                '24:18:1d:9a:93:3d': {       'alt_macs': None,
                                             'dev_macs': {       '24:18:1d:26:d2:bb',
                                                                 'b8:69:f4:3f:9a:f0',
                                                                 'd4:ca:6d:a2:87:73'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:9a:93:3d',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -153.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -58,
                                             'ul_snr': 95}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '81936716362',
                                                              'in_ucast_pkts': '508143943',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '24:18:1d:26:d2:bb',
                                                                                                                        'b8:69:f4:3f:9a:f0',
                                                                                                                        'd4:ca:6d:a2:87:73'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '41110911649',
                                                                                       'in_ucast_pkts': '275460329',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:9a:93:3d',
                                                                                       'out_discards': '62',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '506801322404',
                                                                                       'out_ucast_pkts': '442636140'},
                                                                               {       'bridged_mac_addresses': [       'c4:ad:34:7d:48:d4'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '40825804713',
                                                                                       'in_ucast_pkts': '232683614',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:5a:13:23',
                                                                                       'out_discards': '160',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '392462738154',
                                                                                       'out_ucast_pkts': '344429883'}],
                                                              'mac_address': '24:18:1d:26:d2:bb',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '222',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '899264060558',
                                                              'out_ucast_pkts': '787066023',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 159,
                                                                                                                                            'mac_address': '24:18:1d:9a:93:3d',
                                                                                                                                            'noise_floor': -153.0,
                                                                                                                                            'rssi': -58.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 79,
                                                                                                                                            'mac_address': '24:18:1d:5a:13:23',
                                                                                                                                            'noise_floor': -150.0,
                                                                                                                                            'rssi': -55.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -150.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'TN3-NW60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '10289264',
                                                              'in_octets': '899574434837',
                                                              'in_ucast_pkts': '695301147',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:bc:31:09',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '3921701',
                                                              'out_octets': '80527959882',
                                                              'out_ucast_pkts': '413225144',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.713806,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'JBgdJtK7',
                                'serial_number': '8AA508DBF0C3',
                                'sw_version': '6.45.6',
                                'system_mac_address': 'cc:2d:e0:bc:31:09',
                                'uptime': '6018156'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '62',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '506801322404',
                                                                       'in_ucast_pkts': '442636140',
                                                                       'links': [       {       'in_discards': '62',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '506801322404',
                                                                                                'in_ucast_pkts': '442636140',
                                                                                                'mac_address': '24:18:1d:26:d2:bb',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '41110911649',
                                                                                                'out_ucast_pkts': '275460329'}],
                                                                       'mac_address': '24:18:1d:9a:93:3d',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '41110911649',
                                                                       'out_ucast_pkts': '275460329',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 159,
                                                                                                                                                     'mac_address': '24:18:1d:26:d2:bb',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN3-NW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '41110911649',
                                                                       'in_ucast_pkts': '275460329',
                                                                       'name': 'ether1',
                                                                       'out_octets': '506801322404',
                                                                       'out_ucast_pkts': '442636140',
                                                                       'poller_hash': 'MjQxODFkOWE5MzNkZXRoZXIx'}],
                                         'poller_hash': 'JBgdmpM9',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '160',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '392462738154',
                                                                       'in_ucast_pkts': '344429883',
                                                                       'links': [       {       'in_discards': '160',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '392462738154',
                                                                                                'in_ucast_pkts': '344429883',
                                                                                                'mac_address': '24:18:1d:26:d2:bb',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '40825804713',
                                                                                                'out_ucast_pkts': '232683614'}],
                                                                       'mac_address': '24:18:1d:5a:13:23',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '40825804713',
                                                                       'out_ucast_pkts': '232683614',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 79,
                                                                                                                                                     'mac_address': '24:18:1d:26:d2:bb',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN3-NW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '40825804713',
                                                                       'in_ucast_pkts': '232683614',
                                                                       'name': 'ether1',
                                                                       'out_octets': '392462738154',
                                                                       'out_ucast_pkts': '344429883',
                                                                       'poller_hash': 'MjQxODFkNWExMzIzZXRoZXIx'}],
                                         'poller_hash': 'JBgdWhMj',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_45_8_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.45.8.01")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 2,
                'sw_version': '6.45.8',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 5880838697935,
                'dl_en_packets': 4402841283,
                'dl_noise_floor': None,
                'dl_rf_bytes': 5859910370448,
                'dl_rf_packets': 4732730779,
                'en_if_speed': 1000000000,
                'mem': 21.12884521484375,
                'serial_number': '81ED086CD43A',
                'ssid': 'KP2-N60G',
                'system_mac_address': 'cc:2d:e0:be:6e:3b',
                'ul_en_bytes': 279548658130,
                'ul_en_packets': 1716930989,
                'ul_noise_floor': None,
                'ul_rf_bytes': 272679565954,
                'ul_rf_packets': 2119043705
        }
        exp_sta_stats = {
                '24:18:1d:63:65:83': {       'alt_macs': None,
                                             'dev_macs': {       '04:d6:aa:b1:18:fc',
                                                                 'b8:69:f4:3f:b7:5e',
                                                                 'cc:2d:e0:29:c0:3d'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:63:65:83',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -151.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -56,
                                             'ul_snr': 95},
                '24:18:1d:99:63:9f': {       'alt_macs': None,
                                             'dev_macs': {       'b8:69:f4:3f:b7:5d',
                                                                 'cc:2d:e0:c8:46:45'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:63:9f',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -130.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -65,
                                             'ul_snr': 65}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '272679565954',
                                                              'in_ucast_pkts': '2119043705',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       'b8:69:f4:3f:b7:5d',
                                                                                                                        'cc:2d:e0:c8:46:45'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '252507546159',
                                                                                       'in_ucast_pkts': '1784832687',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:63:9f',
                                                                                       'out_discards': '594',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '5518965534656',
                                                                                       'out_ucast_pkts': '4193099844'},
                                                                               {       'bridged_mac_addresses': [       '04:d6:aa:b1:18:fc',
                                                                                                                        'b8:69:f4:3f:b7:5e',
                                                                                                                        'cc:2d:e0:29:c0:3d'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '20172019795',
                                                                                       'in_ucast_pkts': '334211018',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:63:65:83',
                                                                                       'out_discards': '356',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '340944835792',
                                                                                       'out_ucast_pkts': '539630935'}],
                                                              'mac_address': '04:d6:aa:b1:18:fc',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '950',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '5859910370448',
                                                              'out_ucast_pkts': '4732730779',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 196,
                                                                                                                                            'mac_address': '24:18:1d:99:63:9f',
                                                                                                                                            'noise_floor': -130.0,
                                                                                                                                            'rssi': -65.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 54,
                                                                                                                                            'mac_address': '24:18:1d:63:65:83',
                                                                                                                                            'noise_floor': -151.0,
                                                                                                                                            'rssi': -56.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -130.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'KP2-N60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '77163931',
                                                              'in_octets': '5880838697935',
                                                              'in_ucast_pkts': '4325677352',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:be:6e:3b',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '11133152',
                                                              'out_octets': '279548658130',
                                                              'out_ucast_pkts': '1705797837',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.128845,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'BNaqsRj8',
                                'serial_number': '81ED086CD43A',
                                'sw_version': '6.45.8',
                                'system_mac_address': 'cc:2d:e0:be:6e:3b',
                                'uptime': '32108816'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '594',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '5518965534656',
                                                                       'in_ucast_pkts': '4193099844',
                                                                       'links': [       {       'in_discards': '594',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '5518965534656',
                                                                                                'in_ucast_pkts': '4193099844',
                                                                                                'mac_address': '04:d6:aa:b1:18:fc',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '252507546159',
                                                                                                'out_ucast_pkts': '1784832687'}],
                                                                       'mac_address': '24:18:1d:99:63:9f',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '252507546159',
                                                                       'out_ucast_pkts': '1784832687',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 196,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:18:fc',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'KP2-N60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '252507546159',
                                                                       'in_ucast_pkts': '1784832687',
                                                                       'name': 'ether1',
                                                                       'out_octets': '5518965534656',
                                                                       'out_ucast_pkts': '4193099844',
                                                                       'poller_hash': 'MjQxODFkOTk2MzlmZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWOf',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '356',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '340944835792',
                                                                       'in_ucast_pkts': '539630935',
                                                                       'links': [       {       'in_discards': '356',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '340944835792',
                                                                                                'in_ucast_pkts': '539630935',
                                                                                                'mac_address': '04:d6:aa:b1:18:fc',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '20172019795',
                                                                                                'out_ucast_pkts': '334211018'}],
                                                                       'mac_address': '24:18:1d:63:65:83',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '20172019795',
                                                                       'out_ucast_pkts': '334211018',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 54,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:18:fc',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'KP2-N60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '20172019795',
                                                                       'in_ucast_pkts': '334211018',
                                                                       'name': 'ether1',
                                                                       'out_octets': '340944835792',
                                                                       'out_ucast_pkts': '539630935',
                                                                       'poller_hash': 'MjQxODFkNjM2NTgzZXRoZXIx'}],
                                         'poller_hash': 'JBgdY2WD',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_45_8_02(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.45.8.02")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 5,
                'sw_version': '6.45.8',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 8372659498789,
                'dl_en_packets': 6252072691,
                'dl_noise_floor': None,
                'dl_rf_bytes': 8353553768768,
                'dl_rf_packets': 6765356862,
                'en_if_speed': 1000000000,
                'mem': 21.47979736328125,
                'serial_number': '81ED0809497C',
                'ssid': 'KP2-SE60G',
                'system_mac_address': 'cc:2d:e0:be:6c:95',
                'ul_en_bytes': 476326438753,
                'ul_en_packets': 2664974567,
                'ul_noise_floor': None,
                'ul_rf_bytes': 480858267751,
                'ul_rf_packets': 3173032218
        }
        exp_sta_stats = {
                '04:d6:aa:a4:c9:e1': {       'alt_macs': None,
                                             'dev_macs': {'cc:2d:e0:29:c1:fd'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a4:c9:e1',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -117.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -67,
                                             'ul_snr': 50},
                '24:18:1d:57:ad:09': {       'alt_macs': None,
                                             'dev_macs': {'74:4d:28:bd:4a:60'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:57:ad:09',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -117.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -67,
                                             'ul_snr': 50},
                '24:18:1d:99:68:87': {       'alt_macs': None,
                                             'dev_macs': {'c4:ad:34:f9:8d:82'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:68:87',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -150.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -55,
                                             'ul_snr': 95},
                '48:8f:5a:51:ec:78': {       'alt_macs': None,
                                             'dev_macs': {       '24:18:1d:22:a3:b3',
                                                                 '48:8f:5a:93:cf:60'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:51:ec:78',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -148.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -53,
                                             'ul_snr': 95},
                '48:8f:5a:80:66:f9': {       'alt_macs': {'48:8f:5a:80:66:f8'},
                                             'dev_macs': {'48:8f:5a:93:ac:d8'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:80:66:f9',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -130.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -65,
                                             'ul_snr': 65}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '480858267751',
                                                              'in_ucast_pkts': '3173032218',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '24:18:1d:22:a3:b3',
                                                                                                                        '48:8f:5a:93:cf:60'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '5730360729',
                                                                                       'in_ucast_pkts': '85456230',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:51:ec:78',
                                                                                       'out_discards': '141',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '48390924174',
                                                                                       'out_ucast_pkts': '107079743'},
                                                                               {       'bridged_mac_addresses': [       '48:8f:5a:93:ac:d8'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '36689932844',
                                                                                       'in_ucast_pkts': '128005007',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:80:66:f9',
                                                                                       'out_discards': '152',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '95009579449',
                                                                                       'out_ucast_pkts': '155958902'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:bd:4a:60'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '101063558345',
                                                                                       'in_ucast_pkts': '624216678',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:57:ad:09',
                                                                                       'out_discards': '400',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '782031045261',
                                                                                       'out_ucast_pkts': '928230880'},
                                                                               {       'bridged_mac_addresses': [       'cc:2d:e0:29:c1:fd'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '9663258105',
                                                                                       'in_ucast_pkts': '204370703',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a4:c9:e1',
                                                                                       'out_discards': '598',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '75721651892',
                                                                                       'out_ucast_pkts': '235971803'},
                                                                               {       'bridged_mac_addresses': [       'c4:ad:34:f9:8d:82'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '233524379112',
                                                                                       'in_ucast_pkts': '1510214192',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:68:87',
                                                                                       'out_discards': '245',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '5411502469619',
                                                                                       'out_ucast_pkts': '3907237177'}],
                                                              'mac_address': '24:18:1d:22:a3:b3',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '2506',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '8353553768768',
                                                              'out_ucast_pkts': '6765356862',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 42,
                                                                                                                                            'mac_address': '48:8f:5a:51:ec:78',
                                                                                                                                            'noise_floor': -148.0,
                                                                                                                                            'rssi': -53.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 255,
                                                                                                                                            'mac_address': '48:8f:5a:80:66:f9',
                                                                                                                                            'noise_floor': -130.0,
                                                                                                                                            'rssi': -65.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 85,
                                                                                                                                            'mac_address': '24:18:1d:57:ad:09',
                                                                                                                                            'noise_floor': -117.0,
                                                                                                                                            'rssi': -67.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 271,
                                                                                                                                            'mac_address': '04:d6:aa:a4:c9:e1',
                                                                                                                                            'noise_floor': -117.0,
                                                                                                                                            'rssi': -67.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 113,
                                                                                                                                            'mac_address': '24:18:1d:99:68:87',
                                                                                                                                            'noise_floor': -150.0,
                                                                                                                                            'rssi': -55.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -117.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'KP2-SE60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '46112326',
                                                              'in_octets': '8372659498789',
                                                              'in_ucast_pkts': '6205960365',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:be:6c:95',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '42187347',
                                                              'out_octets': '476326438753',
                                                              'out_ucast_pkts': '2622787220',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.479797,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'JBgdIqOz',
                                'serial_number': '81ED0809497C',
                                'sw_version': '6.45.8',
                                'system_mac_address': 'cc:2d:e0:be:6c:95',
                                'uptime': '32109443'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '141',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '48390924174',
                                                                       'in_ucast_pkts': '107079743',
                                                                       'links': [       {       'in_discards': '141',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '48390924174',
                                                                                                'in_ucast_pkts': '107079743',
                                                                                                'mac_address': '24:18:1d:22:a3:b3',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '5730360729',
                                                                                                'out_ucast_pkts': '85456230'}],
                                                                       'mac_address': '48:8f:5a:51:ec:78',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '5730360729',
                                                                       'out_ucast_pkts': '85456230',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 42,
                                                                                                                                                     'mac_address': '24:18:1d:22:a3:b3',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'KP2-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '5730360729',
                                                                       'in_ucast_pkts': '85456230',
                                                                       'name': 'ether1',
                                                                       'out_octets': '48390924174',
                                                                       'out_ucast_pkts': '107079743',
                                                                       'poller_hash': 'NDg4ZjVhNTFlYzc4ZXRoZXIx'}],
                                         'poller_hash': 'SI9aUex4',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '152',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '95009579449',
                                                                       'in_ucast_pkts': '155958902',
                                                                       'links': [       {       'in_discards': '152',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '95009579449',
                                                                                                'in_ucast_pkts': '155958902',
                                                                                                'mac_address': '24:18:1d:22:a3:b3',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '36689932844',
                                                                                                'out_ucast_pkts': '128005007'}],
                                                                       'mac_address': '48:8f:5a:80:66:f9',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '36689932844',
                                                                       'out_ucast_pkts': '128005007',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 255,
                                                                                                                                                     'mac_address': '24:18:1d:22:a3:b3',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'KP2-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '36689932844',
                                                                       'in_ucast_pkts': '128005007',
                                                                       'mac_address': '48:8f:5a:80:66:f8',
                                                                       'name': 'ether1',
                                                                       'out_octets': '95009579449',
                                                                       'out_ucast_pkts': '155958902',
                                                                       'poller_hash': 'NDg4ZjVhODA2NmY5ZXRoZXIx'}],
                                         'poller_hash': 'SI9agGb5',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': '48:8f:5a:80:66:f8'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '400',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '782031045261',
                                                                       'in_ucast_pkts': '928230880',
                                                                       'links': [       {       'in_discards': '400',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '782031045261',
                                                                                                'in_ucast_pkts': '928230880',
                                                                                                'mac_address': '24:18:1d:22:a3:b3',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '101063558345',
                                                                                                'out_ucast_pkts': '624216678'}],
                                                                       'mac_address': '24:18:1d:57:ad:09',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '101063558345',
                                                                       'out_ucast_pkts': '624216678',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 85,
                                                                                                                                                     'mac_address': '24:18:1d:22:a3:b3',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'KP2-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '101063558345',
                                                                       'in_ucast_pkts': '624216678',
                                                                       'name': 'ether1',
                                                                       'out_octets': '782031045261',
                                                                       'out_ucast_pkts': '928230880',
                                                                       'poller_hash': 'MjQxODFkNTdhZDA5ZXRoZXIx'}],
                                         'poller_hash': 'JBgdV60J',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '598',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '75721651892',
                                                                       'in_ucast_pkts': '235971803',
                                                                       'links': [       {       'in_discards': '598',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '75721651892',
                                                                                                'in_ucast_pkts': '235971803',
                                                                                                'mac_address': '24:18:1d:22:a3:b3',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '9663258105',
                                                                                                'out_ucast_pkts': '204370703'}],
                                                                       'mac_address': '04:d6:aa:a4:c9:e1',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '9663258105',
                                                                       'out_ucast_pkts': '204370703',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 271,
                                                                                                                                                     'mac_address': '24:18:1d:22:a3:b3',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'KP2-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '9663258105',
                                                                       'in_ucast_pkts': '204370703',
                                                                       'name': 'ether1',
                                                                       'out_octets': '75721651892',
                                                                       'out_ucast_pkts': '235971803',
                                                                       'poller_hash': 'MDRkNmFhYTRjOWUxZXRoZXIx'}],
                                         'poller_hash': 'BNaqpMnh',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '245',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '5411502469619',
                                                                       'in_ucast_pkts': '3907237177',
                                                                       'links': [       {       'in_discards': '245',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '5411502469619',
                                                                                                'in_ucast_pkts': '3907237177',
                                                                                                'mac_address': '24:18:1d:22:a3:b3',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '233524379112',
                                                                                                'out_ucast_pkts': '1510214192'}],
                                                                       'mac_address': '24:18:1d:99:68:87',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '233524379112',
                                                                       'out_ucast_pkts': '1510214192',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 113,
                                                                                                                                                     'mac_address': '24:18:1d:22:a3:b3',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'KP2-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '233524379112',
                                                                       'in_ucast_pkts': '1510214192',
                                                                       'name': 'ether1',
                                                                       'out_octets': '5411502469619',
                                                                       'out_ucast_pkts': '3907237177',
                                                                       'poller_hash': 'MjQxODFkOTk2ODg3ZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWiH',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_45_8_03(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.45.8.03")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 0,
                'sw_version': '6.45.8',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 13495933222,
                'dl_en_packets': 231335299,
                'dl_noise_floor': None,
                'dl_rf_bytes': 0,
                'dl_rf_packets': 0,
                'en_if_speed': 1000000000,
                'mem': 20.0927734375,
                'serial_number': '8AA5084EB9AC',
                'ssid': 'KP2-SW60G',
                'system_mac_address': 'cc:2d:e0:bc:30:e7',
                'ul_en_bytes': 7426289078,
                'ul_en_packets': 59663192,
                'ul_noise_floor': None,
                'ul_rf_bytes': 0,
                'ul_rf_packets': 0
        }
        exp_sta_stats = {
         
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '0',
                                                              'in_ucast_pkts': '0',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '24:18:1d:25:97:9a',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '0',
                                                              'out_ucast_pkts': '0',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1'}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'KP2-SW60G'}],
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '86692046',
                                                              'in_octets': '13495933222',
                                                              'in_ucast_pkts': '144643253',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:bc:30:e7',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '1605478',
                                                              'out_octets': '7426289078',
                                                              'out_ucast_pkts': '58057714',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.092773,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'JBgdJZea',
                                'serial_number': '8AA5084EB9AC',
                                'sw_version': '6.45.8',
                                'system_mac_address': 'cc:2d:e0:bc:30:e7',
                                'uptime': '32108920'}
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_45_9_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.45.9.01")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 8,
                'sw_version': '6.45.9',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 6246558244914,
                'dl_en_packets': 5006800272,
                'dl_noise_floor': None,
                'dl_rf_bytes': 6254944947260,
                'dl_rf_packets': 5993983547,
                'en_if_speed': 1000000000,
                'mem': 21.20361328125,
                'serial_number': 'BF950BE4682C',
                'ssid': 'TN1-NW60G',
                'system_mac_address': 'c4:ad:34:7c:d3:a4',
                'ul_en_bytes': 1028818681239,
                'ul_en_packets': 2917569438,
                'ul_noise_floor': None,
                'ul_rf_bytes': 1057224292449,
                'ul_rf_packets': 3840577788
        }
        exp_sta_stats = {
                '04:d6:aa:a4:cb:f8': {       'alt_macs': None,
                                             'dev_macs': {'cc:2d:e0:a4:00:14'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a4:cb:f8',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -148.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -58,
                                             'ul_snr': 90},
                '04:d6:aa:a8:d5:6d': {       'alt_macs': None,
                                             'dev_macs': {       'c4:ad:34:7c:d3:a5',
                                                                 'cc:2d:e0:20:20:17'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d5:6d',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -148.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -53,
                                             'ul_snr': 95},
                '04:d6:aa:a8:d5:ed': {       'alt_macs': None,
                                             'dev_macs': {       '74:4d:28:bd:44:69',
                                                                 'b8:69:f4:33:21:79'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d5:ed',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -148.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -53,
                                             'ul_snr': 95},
                '24:18:1d:99:65:a0': {       'alt_macs': None,
                                             'dev_macs': {       '74:4d:28:17:7c:ab',
                                                                 'b8:69:f4:3f:9b:e4'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:65:a0',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -142.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -62,
                                             'ul_snr': 80},
                '24:18:1d:99:65:de': {       'alt_macs': None,
                                             'dev_macs': {       '64:d1:54:88:7c:8d',
                                                                 'b8:69:f4:3f:9a:db'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:65:de',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -141.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -61,
                                             'ul_snr': 80},
                '24:18:1d:99:66:6e': {       'alt_macs': None,
                                             'dev_macs': {'74:4d:28:0f:70:b1'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:66:6e',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -146.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -51,
                                             'ul_snr': 95},
                '24:18:1d:99:66:88': {       'alt_macs': None,
                                             'dev_macs': {'f0:9f:c2:17:cb:eb'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:66:88',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -118.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -68,
                                             'ul_snr': 50},
                '24:18:1d:99:67:1c': {       'alt_macs': None,
                                             'dev_macs': {'cc:2d:e0:fc:d7:65'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:67:1c',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -130.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -65,
                                             'ul_snr': 65}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '1057224292449',
                                                              'in_ucast_pkts': '3840577788',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       'f0:9f:c2:17:cb:eb'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '552704015494',
                                                                                       'in_ucast_pkts': '768360751',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:66:88',
                                                                                       'out_discards': '10567',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '787631766011',
                                                                                       'out_ucast_pkts': '954904354'},
                                                                               {       'bridged_mac_addresses': [       'cc:2d:e0:fc:d7:65'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '33936434157',
                                                                                       'in_ucast_pkts': '383768490',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:67:1c',
                                                                                       'out_discards': '15919',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '697679146691',
                                                                                       'out_ucast_pkts': '628010130'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:17:7c:ab',
                                                                                                                        'b8:69:f4:3f:9b:e4'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '184262407040',
                                                                                       'in_ucast_pkts': '867251710',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:65:a0',
                                                                                       'out_discards': '7618',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1906179566697',
                                                                                       'out_ucast_pkts': '1517873316'},
                                                                               {       'bridged_mac_addresses': [       'c4:ad:34:7c:d3:a5',
                                                                                                                        'cc:2d:e0:20:20:17'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '77191639887',
                                                                                       'in_ucast_pkts': '480185768',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d5:6d',
                                                                                       'out_discards': '451',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1019215759176',
                                                                                       'out_ucast_pkts': '868940323'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:bd:44:69',
                                                                                                                        'b8:69:f4:33:21:79'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '33466692891',
                                                                                       'in_ucast_pkts': '399203629',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d5:ed',
                                                                                       'out_discards': '3822',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '786209989320',
                                                                                       'out_ucast_pkts': '718369785'},
                                                                               {       'bridged_mac_addresses': [       '64:d1:54:88:7c:8d',
                                                                                                                        'b8:69:f4:3f:9a:db'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '97415286940',
                                                                                       'in_ucast_pkts': '419192075',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:65:de',
                                                                                       'out_discards': '2423',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '596222450961',
                                                                                       'out_ucast_pkts': '659746311'},
                                                                               {       'bridged_mac_addresses': [       'cc:2d:e0:a4:00:14'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '47545707598',
                                                                                       'in_ucast_pkts': '214284212',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a4:cb:f8',
                                                                                       'out_discards': '736',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '142179154478',
                                                                                       'out_ucast_pkts': '246661284'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:0f:70:b1'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '30698149533',
                                                                                       'in_ucast_pkts': '308326371',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:66:6e',
                                                                                       'out_discards': '567',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '319627046840',
                                                                                       'out_ucast_pkts': '399476686'}],
                                                              'mac_address': 'c4:ad:34:7c:d3:a5',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '42197',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '6254944947260',
                                                              'out_ucast_pkts': '5993983547',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 411,
                                                                                                                                            'mac_address': '24:18:1d:99:66:88',
                                                                                                                                            'noise_floor': -118.0,
                                                                                                                                            'rssi': -68.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'mac_address': '24:18:1d:99:67:1c',
                                                                                                                                            'noise_floor': -130.0,
                                                                                                                                            'rssi': -65.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'mac_address': '24:18:1d:99:65:a0',
                                                                                                                                            'noise_floor': -142.0,
                                                                                                                                            'rssi': -62.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 137,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d5:6d',
                                                                                                                                            'noise_floor': -148.0,
                                                                                                                                            'rssi': -53.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 304,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d5:ed',
                                                                                                                                            'noise_floor': -148.0,
                                                                                                                                            'rssi': -53.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 254,
                                                                                                                                            'mac_address': '24:18:1d:99:65:de',
                                                                                                                                            'noise_floor': -141.0,
                                                                                                                                            'rssi': -61.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 149,
                                                                                                                                            'mac_address': '04:d6:aa:a4:cb:f8',
                                                                                                                                            'noise_floor': -148.0,
                                                                                                                                            'rssi': -58.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 90.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 100,
                                                                                                                                            'mac_address': '24:18:1d:99:66:6e',
                                                                                                                                            'noise_floor': -146.0,
                                                                                                                                            'rssi': -51.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -118.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'TN1-NW60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '15096011',
                                                              'in_octets': '6246558244914',
                                                              'in_ucast_pkts': '4991704261',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'c4:ad:34:7c:d3:a4',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '66694189',
                                                              'out_octets': '1028818681239',
                                                              'out_ucast_pkts': '2850875249',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.203613,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'xK00fNOl',
                                'serial_number': 'BF950BE4682C',
                                'sw_version': '6.45.9',
                                'system_mac_address': 'c4:ad:34:7c:d3:a4',
                                'uptime': '17497921'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '10567',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '787631766011',
                                                                       'in_ucast_pkts': '954904354',
                                                                       'links': [       {       'in_discards': '10567',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '787631766011',
                                                                                                'in_ucast_pkts': '954904354',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:a5',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '552704015494',
                                                                                                'out_ucast_pkts': '768360751'}],
                                                                       'mac_address': '24:18:1d:99:66:88',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '552704015494',
                                                                       'out_ucast_pkts': '768360751',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 411,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:a5',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-NW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '552704015494',
                                                                       'in_ucast_pkts': '768360751',
                                                                       'name': 'ether1',
                                                                       'out_octets': '787631766011',
                                                                       'out_ucast_pkts': '954904354',
                                                                       'poller_hash': 'MjQxODFkOTk2Njg4ZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWaI',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '15919',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '697679146691',
                                                                       'in_ucast_pkts': '628010130',
                                                                       'links': [       {       'in_discards': '15919',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '697679146691',
                                                                                                'in_ucast_pkts': '628010130',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:a5',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '33936434157',
                                                                                                'out_ucast_pkts': '383768490'}],
                                                                       'mac_address': '24:18:1d:99:67:1c',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '33936434157',
                                                                       'out_ucast_pkts': '383768490',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': 'c4:ad:34:7c:d3:a5',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-NW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '33936434157',
                                                                       'in_ucast_pkts': '383768490',
                                                                       'name': 'ether1',
                                                                       'out_octets': '697679146691',
                                                                       'out_ucast_pkts': '628010130',
                                                                       'poller_hash': 'MjQxODFkOTk2NzFjZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWcc',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '7618',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1906179566697',
                                                                       'in_ucast_pkts': '1517873316',
                                                                       'links': [       {       'in_discards': '7618',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1906179566697',
                                                                                                'in_ucast_pkts': '1517873316',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:a5',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '184262407040',
                                                                                                'out_ucast_pkts': '867251710'}],
                                                                       'mac_address': '24:18:1d:99:65:a0',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '184262407040',
                                                                       'out_ucast_pkts': '867251710',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': 'c4:ad:34:7c:d3:a5',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-NW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '184262407040',
                                                                       'in_ucast_pkts': '867251710',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1906179566697',
                                                                       'out_ucast_pkts': '1517873316',
                                                                       'poller_hash': 'MjQxODFkOTk2NWEwZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWWg',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '451',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1019215759176',
                                                                       'in_ucast_pkts': '868940323',
                                                                       'links': [       {       'in_discards': '451',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1019215759176',
                                                                                                'in_ucast_pkts': '868940323',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:a5',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '77191639887',
                                                                                                'out_ucast_pkts': '480185768'}],
                                                                       'mac_address': '04:d6:aa:a8:d5:6d',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '77191639887',
                                                                       'out_ucast_pkts': '480185768',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 137,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:a5',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-NW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '77191639887',
                                                                       'in_ucast_pkts': '480185768',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1019215759176',
                                                                       'out_ucast_pkts': '868940323',
                                                                       'poller_hash': 'MDRkNmFhYThkNTZkZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNVt',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '3822',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '786209989320',
                                                                       'in_ucast_pkts': '718369785',
                                                                       'links': [       {       'in_discards': '3822',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '786209989320',
                                                                                                'in_ucast_pkts': '718369785',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:a5',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '33466692891',
                                                                                                'out_ucast_pkts': '399203629'}],
                                                                       'mac_address': '04:d6:aa:a8:d5:ed',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '33466692891',
                                                                       'out_ucast_pkts': '399203629',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 304,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:a5',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-NW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '33466692891',
                                                                       'in_ucast_pkts': '399203629',
                                                                       'name': 'ether1',
                                                                       'out_octets': '786209989320',
                                                                       'out_ucast_pkts': '718369785',
                                                                       'poller_hash': 'MDRkNmFhYThkNWVkZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNXt',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '2423',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '596222450961',
                                                                       'in_ucast_pkts': '659746311',
                                                                       'links': [       {       'in_discards': '2423',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '596222450961',
                                                                                                'in_ucast_pkts': '659746311',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:a5',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '97415286940',
                                                                                                'out_ucast_pkts': '419192075'}],
                                                                       'mac_address': '24:18:1d:99:65:de',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '97415286940',
                                                                       'out_ucast_pkts': '419192075',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 254,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:a5',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-NW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '97415286940',
                                                                       'in_ucast_pkts': '419192075',
                                                                       'name': 'ether1',
                                                                       'out_octets': '596222450961',
                                                                       'out_ucast_pkts': '659746311',
                                                                       'poller_hash': 'MjQxODFkOTk2NWRlZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWXe',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '736',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '142179154478',
                                                                       'in_ucast_pkts': '246661284',
                                                                       'links': [       {       'in_discards': '736',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '142179154478',
                                                                                                'in_ucast_pkts': '246661284',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:a5',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '47545707598',
                                                                                                'out_ucast_pkts': '214284212'}],
                                                                       'mac_address': '04:d6:aa:a4:cb:f8',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '47545707598',
                                                                       'out_ucast_pkts': '214284212',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 149,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:a5',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-NW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '47545707598',
                                                                       'in_ucast_pkts': '214284212',
                                                                       'name': 'ether1',
                                                                       'out_octets': '142179154478',
                                                                       'out_ucast_pkts': '246661284',
                                                                       'poller_hash': 'MDRkNmFhYTRjYmY4ZXRoZXIx'}],
                                         'poller_hash': 'BNaqpMv4',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '567',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '319627046840',
                                                                       'in_ucast_pkts': '399476686',
                                                                       'links': [       {       'in_discards': '567',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '319627046840',
                                                                                                'in_ucast_pkts': '399476686',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:a5',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '30698149533',
                                                                                                'out_ucast_pkts': '308326371'}],
                                                                       'mac_address': '24:18:1d:99:66:6e',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '30698149533',
                                                                       'out_ucast_pkts': '308326371',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 100,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:a5',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-NW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '30698149533',
                                                                       'in_ucast_pkts': '308326371',
                                                                       'name': 'ether1',
                                                                       'out_octets': '319627046840',
                                                                       'out_ucast_pkts': '399476686',
                                                                       'poller_hash': 'MjQxODFkOTk2NjZlZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWZu',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_45_9_02(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.45.9.02")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 3,
                'sw_version': '6.45.9',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 5173039273821,
                'dl_en_packets': 3956580769,
                'dl_noise_floor': None,
                'dl_rf_bytes': 5167400824255,
                'dl_rf_packets': 4343321446,
                'en_if_speed': 1000000000,
                'mem': 21.2860107421875,
                'serial_number': 'D6950C1E349D',
                'ssid': 'TN1-SW60G',
                'system_mac_address': '48:8f:5a:83:c0:6b',
                'ul_en_bytes': 427982562226,
                'ul_en_packets': 2049160335,
                'ul_noise_floor': None,
                'ul_rf_bytes': 432011282248,
                'ul_rf_packets': 2422646201
        }
        exp_sta_stats = {
                '04:d6:aa:a8:d4:90': {       'alt_macs': None,
                                             'dev_macs': {       'b8:69:f4:33:19:95',
                                                                 'c4:ad:34:7d:49:44'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d4:90',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -146.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -51,
                                             'ul_snr': 95},
                '24:18:1d:63:65:8e': {       'alt_macs': None,
                                             'dev_macs': {       '48:8f:5a:83:c0:6c',
                                                                 '74:4d:28:0f:6b:39',
                                                                 'b8:69:f4:45:f4:a6'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:63:65:8e',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -151.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -56,
                                             'ul_snr': 95},
                '24:18:1d:99:66:1c': {       'alt_macs': None,
                                             'dev_macs': {'cc:2d:e0:c8:43:9e'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:66:1c',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -146.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -51,
                                             'ul_snr': 95}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '432011282248',
                                                              'in_ucast_pkts': '2422646201',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '48:8f:5a:83:c0:6c',
                                                                                                                        '74:4d:28:0f:6b:39',
                                                                                                                        'b8:69:f4:45:f4:a6'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '270716589772',
                                                                                       'in_ucast_pkts': '1444088702',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:63:65:8e',
                                                                                       'out_discards': '380',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '3228858787721',
                                                                                       'out_ucast_pkts': '2636463078'},
                                                                               {       'bridged_mac_addresses': [       'b8:69:f4:33:19:95',
                                                                                                                        'c4:ad:34:7d:49:44'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '13863993500',
                                                                                       'in_ucast_pkts': '218655377',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d4:90',
                                                                                       'out_discards': '110',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '155580957718',
                                                                                       'out_ucast_pkts': '277051714'},
                                                                               {       'bridged_mac_addresses': [       'cc:2d:e0:c8:43:9e'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '147430698976',
                                                                                       'in_ucast_pkts': '759902122',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:66:1c',
                                                                                       'out_discards': '384',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1782961078816',
                                                                                       'out_ucast_pkts': '1429806654'}],
                                                              'mac_address': '48:8f:5a:83:c0:6c',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '874',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '5167400824255',
                                                              'out_ucast_pkts': '4343321446',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 184,
                                                                                                                                            'mac_address': '24:18:1d:63:65:8e',
                                                                                                                                            'noise_floor': -151.0,
                                                                                                                                            'rssi': -56.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 83,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d4:90',
                                                                                                                                            'noise_floor': -146.0,
                                                                                                                                            'rssi': -51.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 74,
                                                                                                                                            'mac_address': '24:18:1d:99:66:1c',
                                                                                                                                            'noise_floor': -146.0,
                                                                                                                                            'rssi': -51.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -146.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'TN1-SW60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '15081083',
                                                              'in_octets': '5173039273821',
                                                              'in_ucast_pkts': '3941499686',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '48:8f:5a:83:c0:6b',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '29012467',
                                                              'out_octets': '427982562226',
                                                              'out_ucast_pkts': '2020147868',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.28601,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'SI9ag8Bs',
                                'serial_number': 'D6950C1E349D',
                                'sw_version': '6.45.9',
                                'system_mac_address': '48:8f:5a:83:c0:6b',
                                'uptime': '17496527'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '380',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '3228858787721',
                                                                       'in_ucast_pkts': '2636463078',
                                                                       'links': [       {       'in_discards': '380',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '3228858787721',
                                                                                                'in_ucast_pkts': '2636463078',
                                                                                                'mac_address': '48:8f:5a:83:c0:6c',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '270716589772',
                                                                                                'out_ucast_pkts': '1444088702'}],
                                                                       'mac_address': '24:18:1d:63:65:8e',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '270716589772',
                                                                       'out_ucast_pkts': '1444088702',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 184,
                                                                                                                                                     'mac_address': '48:8f:5a:83:c0:6c',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-SW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '270716589772',
                                                                       'in_ucast_pkts': '1444088702',
                                                                       'name': 'ether1',
                                                                       'out_octets': '3228858787721',
                                                                       'out_ucast_pkts': '2636463078',
                                                                       'poller_hash': 'MjQxODFkNjM2NThlZXRoZXIx'}],
                                         'poller_hash': 'JBgdY2WO',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '110',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '155580957718',
                                                                       'in_ucast_pkts': '277051714',
                                                                       'links': [       {       'in_discards': '110',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '155580957718',
                                                                                                'in_ucast_pkts': '277051714',
                                                                                                'mac_address': '48:8f:5a:83:c0:6c',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '13863993500',
                                                                                                'out_ucast_pkts': '218655377'}],
                                                                       'mac_address': '04:d6:aa:a8:d4:90',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '13863993500',
                                                                       'out_ucast_pkts': '218655377',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 83,
                                                                                                                                                     'mac_address': '48:8f:5a:83:c0:6c',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-SW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '13863993500',
                                                                       'in_ucast_pkts': '218655377',
                                                                       'name': 'ether1',
                                                                       'out_octets': '155580957718',
                                                                       'out_ucast_pkts': '277051714',
                                                                       'poller_hash': 'MDRkNmFhYThkNDkwZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNSQ',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '384',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1782961078816',
                                                                       'in_ucast_pkts': '1429806654',
                                                                       'links': [       {       'in_discards': '384',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1782961078816',
                                                                                                'in_ucast_pkts': '1429806654',
                                                                                                'mac_address': '48:8f:5a:83:c0:6c',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '147430698976',
                                                                                                'out_ucast_pkts': '759902122'}],
                                                                       'mac_address': '24:18:1d:99:66:1c',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '147430698976',
                                                                       'out_ucast_pkts': '759902122',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 74,
                                                                                                                                                     'mac_address': '48:8f:5a:83:c0:6c',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-SW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '147430698976',
                                                                       'in_ucast_pkts': '759902122',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1782961078816',
                                                                       'out_ucast_pkts': '1429806654',
                                                                       'poller_hash': 'MjQxODFkOTk2NjFjZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWYc',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_45_9_03(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.45.9.03")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 64800,
                'sta_count': 7,
                'sw_version': '6.45.9',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 8902663509711,
                'dl_en_packets': 6644051147,
                'dl_noise_floor': None,
                'dl_rf_bytes': 8902952427175,
                'dl_rf_packets': 7594687043,
                'en_if_speed': 100000000,
                'mem': 21.5240478515625,
                'serial_number': 'D6950C8C6ED7',
                'ssid': 'TN1-W60G',
                'system_mac_address': '48:8f:5a:83:be:06',
                'ul_en_bytes': 624270595131,
                'ul_en_packets': 3623407076,
                'ul_noise_floor': None,
                'ul_rf_bytes': 647455769609,
                'ul_rf_packets': 4513479477
        }
        exp_sta_stats = {
                '04:d6:aa:a4:c9:d2': {       'alt_macs': None,
                                             'dev_macs': {       'b8:69:f4:33:18:d6',
                                                                 'cc:2d:e0:32:05:26'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a4:c9:d2',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -152.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -57,
                                             'ul_snr': 95},
                '04:d6:aa:a4:cb:e0': {       'alt_macs': None,
                                             'dev_macs': {'48:8f:5a:0a:9d:09'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a4:cb:e0',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -119.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -69,
                                             'ul_snr': 50},
                '04:d6:aa:a8:d3:8f': {       'alt_macs': None,
                                             'dev_macs': {'cc:2d:e0:22:62:3b'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d3:8f',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -153.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -58,
                                             'ul_snr': 95},
                '04:d6:aa:a8:d4:61': {       'alt_macs': None,
                                             'dev_macs': {'80:2a:a8:2f:39:24'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d4:61',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -142.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -62,
                                             'ul_snr': 80},
                '04:d6:aa:a8:d7:2a': {       'alt_macs': None,
                                             'dev_macs': {       '48:8f:5a:83:be:07',
                                                                 '48:8f:5a:93:c3:41'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d7:2a',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -151.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -56,
                                             'ul_snr': 95},
                '04:d6:aa:a8:d7:a0': {       'alt_macs': None,
                                             'dev_macs': {'cc:2d:e0:29:d8:23'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d7:a0',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -152.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -57,
                                             'ul_snr': 95},
                '24:18:1d:99:65:39': {       'alt_macs': None,
                                             'dev_macs': {'48:8f:5a:83:99:49'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:65:39',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -130.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -65,
                                             'ul_snr': 65}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '647455769609',
                                                              'in_ucast_pkts': '4513479477',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '48:8f:5a:83:be:07',
                                                                                                                        '48:8f:5a:93:c3:41'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '67602729750',
                                                                                       'in_ucast_pkts': '598214383',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d7:2a',
                                                                                       'out_discards': '1216',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1337465262904',
                                                                                       'out_ucast_pkts': '1059941401'},
                                                                               {       'bridged_mac_addresses': [       '48:8f:5a:83:99:49'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '115621156894',
                                                                                       'in_ucast_pkts': '784323671',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:65:39',
                                                                                       'out_discards': '11737',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1498388918090',
                                                                                       'out_ucast_pkts': '1251505334'},
                                                                               {       'bridged_mac_addresses': [       'cc:2d:e0:29:d8:23'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '24250929686',
                                                                                       'in_ucast_pkts': '288893299',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d7:a0',
                                                                                       'out_discards': '1665',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '314277505288',
                                                                                       'out_ucast_pkts': '398885870'},
                                                                               {       'bridged_mac_addresses': [       'cc:2d:e0:22:62:3b'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '179737115683',
                                                                                       'in_ucast_pkts': '786009834',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d3:8f',
                                                                                       'out_discards': '2691',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1546859983390',
                                                                                       'out_ucast_pkts': '1335519314'},
                                                                               {       'bridged_mac_addresses': [       '80:2a:a8:2f:39:24'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '116358224531',
                                                                                       'in_ucast_pkts': '681724416',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d4:61',
                                                                                       'out_discards': '5929',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1477976148928',
                                                                                       'out_ucast_pkts': '1268102738'},
                                                                               {       'bridged_mac_addresses': [       '48:8f:5a:0a:9d:09'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '38394516368',
                                                                                       'in_ucast_pkts': '448509716',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a4:cb:e0',
                                                                                       'out_discards': '14075',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '725225244703',
                                                                                       'out_ucast_pkts': '676746792'},
                                                                               {       'bridged_mac_addresses': [       'b8:69:f4:33:18:d6',
                                                                                                                        'cc:2d:e0:32:05:26'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '105491096697',
                                                                                       'in_ucast_pkts': '925804158',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a4:c9:d2',
                                                                                       'out_discards': '1816',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '2002759363872',
                                                                                       'out_ucast_pkts': '1603985594'}],
                                                              'mac_address': '48:8f:5a:83:be:07',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '39129',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '8902952427175',
                                                              'out_ucast_pkts': '7594687043',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 64800,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 112,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d7:2a',
                                                                                                                                            'noise_floor': -151.0,
                                                                                                                                            'rssi': -56.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 273,
                                                                                                                                            'mac_address': '24:18:1d:99:65:39',
                                                                                                                                            'noise_floor': -130.0,
                                                                                                                                            'rssi': -65.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 161,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d7:a0',
                                                                                                                                            'noise_floor': -152.0,
                                                                                                                                            'rssi': -57.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 155,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d3:8f',
                                                                                                                                            'noise_floor': -153.0,
                                                                                                                                            'rssi': -58.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'mac_address': '04:d6:aa:a8:d4:61',
                                                                                                                                            'noise_floor': -142.0,
                                                                                                                                            'rssi': -62.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 390,
                                                                                                                                            'mac_address': '04:d6:aa:a4:cb:e0',
                                                                                                                                            'noise_floor': -119.0,
                                                                                                                                            'rssi': -69.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 147,
                                                                                                                                            'mac_address': '04:d6:aa:a4:c9:d2',
                                                                                                                                            'noise_floor': -152.0,
                                                                                                                                            'rssi': -57.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -119.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'TN1-W60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '15079212',
                                                              'in_octets': '8902663509711',
                                                              'in_ucast_pkts': '6628971935',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '48:8f:5a:83:be:06',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '64383387',
                                                              'out_octets': '624270595131',
                                                              'out_ucast_pkts': '3559023689',
                                                              'speed': '100000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.524048,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'SI9ag74H',
                                'serial_number': 'D6950C8C6ED7',
                                'sw_version': '6.45.9',
                                'system_mac_address': '48:8f:5a:83:be:06',
                                'uptime': '17494820'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1216',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1337465262904',
                                                                       'in_ucast_pkts': '1059941401',
                                                                       'links': [       {       'in_discards': '1216',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1337465262904',
                                                                                                'in_ucast_pkts': '1059941401',
                                                                                                'mac_address': '48:8f:5a:83:be:07',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '67602729750',
                                                                                                'out_ucast_pkts': '598214383'}],
                                                                       'mac_address': '04:d6:aa:a8:d7:2a',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '67602729750',
                                                                       'out_ucast_pkts': '598214383',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 112,
                                                                                                                                                     'mac_address': '48:8f:5a:83:be:07',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-W60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '67602729750',
                                                                       'in_ucast_pkts': '598214383',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1337465262904',
                                                                       'out_ucast_pkts': '1059941401',
                                                                       'poller_hash': 'MDRkNmFhYThkNzJhZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNcq',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '11737',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1498388918090',
                                                                       'in_ucast_pkts': '1251505334',
                                                                       'links': [       {       'in_discards': '11737',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1498388918090',
                                                                                                'in_ucast_pkts': '1251505334',
                                                                                                'mac_address': '48:8f:5a:83:be:07',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '115621156894',
                                                                                                'out_ucast_pkts': '784323671'}],
                                                                       'mac_address': '24:18:1d:99:65:39',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '115621156894',
                                                                       'out_ucast_pkts': '784323671',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 273,
                                                                                                                                                     'mac_address': '48:8f:5a:83:be:07',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-W60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '115621156894',
                                                                       'in_ucast_pkts': '784323671',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1498388918090',
                                                                       'out_ucast_pkts': '1251505334',
                                                                       'poller_hash': 'MjQxODFkOTk2NTM5ZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWU5',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1665',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '314277505288',
                                                                       'in_ucast_pkts': '398885870',
                                                                       'links': [       {       'in_discards': '1665',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '314277505288',
                                                                                                'in_ucast_pkts': '398885870',
                                                                                                'mac_address': '48:8f:5a:83:be:07',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '24250929686',
                                                                                                'out_ucast_pkts': '288893299'}],
                                                                       'mac_address': '04:d6:aa:a8:d7:a0',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '24250929686',
                                                                       'out_ucast_pkts': '288893299',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 161,
                                                                                                                                                     'mac_address': '48:8f:5a:83:be:07',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-W60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '24250929686',
                                                                       'in_ucast_pkts': '288893299',
                                                                       'name': 'ether1',
                                                                       'out_octets': '314277505288',
                                                                       'out_ucast_pkts': '398885870',
                                                                       'poller_hash': 'MDRkNmFhYThkN2EwZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNeg',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '2691',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1546859983390',
                                                                       'in_ucast_pkts': '1335519314',
                                                                       'links': [       {       'in_discards': '2691',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1546859983390',
                                                                                                'in_ucast_pkts': '1335519314',
                                                                                                'mac_address': '48:8f:5a:83:be:07',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '179737115683',
                                                                                                'out_ucast_pkts': '786009834'}],
                                                                       'mac_address': '04:d6:aa:a8:d3:8f',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '179737115683',
                                                                       'out_ucast_pkts': '786009834',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 155,
                                                                                                                                                     'mac_address': '48:8f:5a:83:be:07',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-W60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '179737115683',
                                                                       'in_ucast_pkts': '786009834',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1546859983390',
                                                                       'out_ucast_pkts': '1335519314',
                                                                       'poller_hash': 'MDRkNmFhYThkMzhmZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNOP',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '5929',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1477976148928',
                                                                       'in_ucast_pkts': '1268102738',
                                                                       'links': [       {       'in_discards': '5929',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1477976148928',
                                                                                                'in_ucast_pkts': '1268102738',
                                                                                                'mac_address': '48:8f:5a:83:be:07',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '116358224531',
                                                                                                'out_ucast_pkts': '681724416'}],
                                                                       'mac_address': '04:d6:aa:a8:d4:61',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '116358224531',
                                                                       'out_ucast_pkts': '681724416',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': '48:8f:5a:83:be:07',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-W60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '116358224531',
                                                                       'in_ucast_pkts': '681724416',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1477976148928',
                                                                       'out_ucast_pkts': '1268102738',
                                                                       'poller_hash': 'MDRkNmFhYThkNDYxZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNRh',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '14075',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '725225244703',
                                                                       'in_ucast_pkts': '676746792',
                                                                       'links': [       {       'in_discards': '14075',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '725225244703',
                                                                                                'in_ucast_pkts': '676746792',
                                                                                                'mac_address': '48:8f:5a:83:be:07',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '38394516368',
                                                                                                'out_ucast_pkts': '448509716'}],
                                                                       'mac_address': '04:d6:aa:a4:cb:e0',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '38394516368',
                                                                       'out_ucast_pkts': '448509716',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 390,
                                                                                                                                                     'mac_address': '48:8f:5a:83:be:07',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-W60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '38394516368',
                                                                       'in_ucast_pkts': '448509716',
                                                                       'name': 'ether1',
                                                                       'out_octets': '725225244703',
                                                                       'out_ucast_pkts': '676746792',
                                                                       'poller_hash': 'MDRkNmFhYTRjYmUwZXRoZXIx'}],
                                         'poller_hash': 'BNaqpMvg',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1816',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '2002759363872',
                                                                       'in_ucast_pkts': '1603985594',
                                                                       'links': [       {       'in_discards': '1816',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '2002759363872',
                                                                                                'in_ucast_pkts': '1603985594',
                                                                                                'mac_address': '48:8f:5a:83:be:07',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '105491096697',
                                                                                                'out_ucast_pkts': '925804158'}],
                                                                       'mac_address': '04:d6:aa:a4:c9:d2',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '105491096697',
                                                                       'out_ucast_pkts': '925804158',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 147,
                                                                                                                                                     'mac_address': '48:8f:5a:83:be:07',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN1-W60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '105491096697',
                                                                       'in_ucast_pkts': '925804158',
                                                                       'name': 'ether1',
                                                                       'out_octets': '2002759363872',
                                                                       'out_ucast_pkts': '1603985594',
                                                                       'poller_hash': 'MDRkNmFhYTRjOWQyZXRoZXIx'}],
                                         'poller_hash': 'BNaqpMnS',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_45beta62_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.45beta62.01")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 2,
                'sw_version': '6.45beta62',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 1,
                'dl_en_bytes': 9109329746173,
                'dl_en_packets': 9278865668,
                'dl_noise_floor': None,
                'dl_rf_bytes': 9071673155712,
                'dl_rf_packets': 9277543844,
                'en_if_speed': 1000000000,
                'mem': 23.24066162109375,
                'serial_number': '8AA508F13C7E',
                'ssid': 'NU5-W60G',
                'system_mac_address': 'cc:2d:e0:b9:49:e9',
                'ul_en_bytes': 11854409577901,
                'ul_en_packets': 10805211831,
                'ul_noise_floor': None,
                'ul_rf_bytes': 11810932193840,
                'ul_rf_packets': 10802127102
        }
        exp_sta_stats = {
                'b8:69:f4:91:50:e5': {       'alt_macs': None,
                                             'dev_macs': {       '04:d6:aa:b1:15:e8',
                                                                 '74:4d:28:a0:61:38',
                                                                 '74:4d:28:a0:61:39'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': 'b8:69:f4:91:50:e5',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -144.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -64,
                                             'ul_snr': 80},
                'b8:69:f4:91:50:eb': {       'alt_macs': None,
                                             'dev_macs': {       '00:00:0c:9f:f0:2e',
                                                                 '00:00:0c:9f:f0:30',
                                                                 '00:12:01:cd:a7:c1',
                                                                 '00:12:01:cd:a7:c3',
                                                                 '00:15:5d:2e:3d:20',
                                                                 '00:15:5d:2e:40:0f',
                                                                 '00:15:5d:2e:40:17',
                                                                 '00:15:5d:2e:42:71',
                                                                 '00:15:5d:2e:43:79',
                                                                 '00:15:5d:2e:43:80',
                                                                 '00:15:5d:2e:43:82',
                                                                 '00:15:5d:2e:44:54',
                                                                 '00:15:5d:7d:3d:2d',
                                                                 '00:15:5d:7d:40:5a',
                                                                 '00:17:55:88:e2:00',
                                                                 '00:1a:64:10:54:60',
                                                                 '00:1d:d8:b7:1c:28',
                                                                 '00:1f:29:23:48:6a',
                                                                 '00:1f:29:23:48:6c',
                                                                 '00:25:b5:00:00:4d',
                                                                 '00:25:b5:00:00:4f',
                                                                 '00:25:b5:00:00:5f',
                                                                 '00:25:b5:00:00:6c',
                                                                 '00:25:b5:00:00:6f',
                                                                 '00:60:16:5e:a1:f0',
                                                                 '00:60:16:5e:a3:bd',
                                                                 '00:e0:e2:62:63:e0',
                                                                 '00:e0:e2:6e:0c:c0',
                                                                 '08:00:0f:2d:8a:b9',
                                                                 '08:00:1b:ff:b5:a4',
                                                                 '08:30:6b:8c:e5:00',
                                                                 '08:30:6b:8c:e5:10',
                                                                 '1c:7d:22:1b:6a:1a',
                                                                 '1c:7d:22:1b:6a:82',
                                                                 '1c:7d:22:2e:ea:7d',
                                                                 '1c:7d:22:2f:16:63',
                                                                 '1c:7d:22:2f:16:70',
                                                                 '50:9a:4c:a4:0b:72',
                                                                 '64:eb:8c:df:e4:33',
                                                                 '7c:95:f3:2e:86:83',
                                                                 'd8:9e:f3:16:04:5a',
                                                                 'd8:9e:f3:1b:9a:fc',
                                                                 'd8:9e:f3:1b:9c:dc',
                                                                 'dc:a5:f4:d3:20:c1',
                                                                 'dc:a5:f4:d3:20:d4',
                                                                 'ec:b1:d7:f9:32:31',
                                                                 'f0:9f:c2:33:96:9a',
                                                                 'f0:9f:c2:33:96:cb',
                                                                 'f0:9f:c2:33:9f:4b',
                                                                 'f0:9f:c2:33:9f:a7'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': 'b8:69:f4:91:50:eb',
                                             'name': '43-51 Tanunda Rd',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -135.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -55,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 1.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '11810932193840',
                                                              'in_ucast_pkts': '10802127102',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '00:00:0c:9f:f0:2e',
                                                                                                                        '00:00:0c:9f:f0:30',
                                                                                                                        '00:12:01:cd:a7:c1',
                                                                                                                        '00:12:01:cd:a7:c3',
                                                                                                                        '00:15:5d:2e:3d:20',
                                                                                                                        '00:15:5d:2e:40:0f',
                                                                                                                        '00:15:5d:2e:40:17',
                                                                                                                        '00:15:5d:2e:42:71',
                                                                                                                        '00:15:5d:2e:43:79',
                                                                                                                        '00:15:5d:2e:43:80',
                                                                                                                        '00:15:5d:2e:43:82',
                                                                                                                        '00:15:5d:2e:44:54',
                                                                                                                        '00:15:5d:7d:3d:2d',
                                                                                                                        '00:15:5d:7d:40:5a',
                                                                                                                        '00:17:55:88:e2:00',
                                                                                                                        '00:1a:64:10:54:60',
                                                                                                                        '00:1d:d8:b7:1c:28',
                                                                                                                        '00:1f:29:23:48:6a',
                                                                                                                        '00:1f:29:23:48:6c',
                                                                                                                        '00:25:b5:00:00:4d',
                                                                                                                        '00:25:b5:00:00:4f',
                                                                                                                        '00:25:b5:00:00:5f',
                                                                                                                        '00:25:b5:00:00:6c',
                                                                                                                        '00:25:b5:00:00:6f',
                                                                                                                        '00:60:16:5e:a1:f0',
                                                                                                                        '00:60:16:5e:a3:bd',
                                                                                                                        '00:e0:e2:62:63:e0',
                                                                                                                        '00:e0:e2:6e:0c:c0',
                                                                                                                        '08:00:0f:2d:8a:b9',
                                                                                                                        '08:00:1b:ff:b5:a4',
                                                                                                                        '08:30:6b:8c:e5:00',
                                                                                                                        '08:30:6b:8c:e5:10',
                                                                                                                        '1c:7d:22:1b:6a:1a',
                                                                                                                        '1c:7d:22:1b:6a:82',
                                                                                                                        '1c:7d:22:2e:ea:7d',
                                                                                                                        '1c:7d:22:2f:16:63',
                                                                                                                        '1c:7d:22:2f:16:70',
                                                                                                                        '50:9a:4c:a4:0b:72',
                                                                                                                        '64:eb:8c:df:e4:33',
                                                                                                                        '7c:95:f3:2e:86:83',
                                                                                                                        'd8:9e:f3:16:04:5a',
                                                                                                                        'd8:9e:f3:1b:9a:fc',
                                                                                                                        'd8:9e:f3:1b:9c:dc',
                                                                                                                        'dc:a5:f4:d3:20:c1',
                                                                                                                        'dc:a5:f4:d3:20:d4',
                                                                                                                        'ec:b1:d7:f9:32:31',
                                                                                                                        'f0:9f:c2:33:96:9a',
                                                                                                                        'f0:9f:c2:33:96:cb',
                                                                                                                        'f0:9f:c2:33:9f:4b',
                                                                                                                        'f0:9f:c2:33:9f:a7'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '11783298708390',
                                                                                       'in_ucast_pkts': '10688466270',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': 'b8:69:f4:91:50:eb',
                                                                                       'out_discards': '182',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '8879011617185',
                                                                                       'out_ucast_pkts': '9078484634'},
                                                                               {       'bridged_mac_addresses': [       '04:d6:aa:b1:15:e8',
                                                                                                                        '74:4d:28:a0:61:38',
                                                                                                                        '74:4d:28:a0:61:39'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '26846229435',
                                                                                       'in_ucast_pkts': '100874741',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': 'b8:69:f4:91:50:e5',
                                                                                       'out_discards': '1149',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '192258416999',
                                                                                       'out_ucast_pkts': '186866461'}],
                                                              'mac_address': '04:d6:aa:b1:15:e8',
                                                              'mtu': 1500,
                                                              'name': 'NU5-W60G',
                                                              'oper_up': True,
                                                              'out_discards': '3051',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '9071673155712',
                                                              'out_ucast_pkts': '9277543844',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 23,
                                                                                                                                            'mac_address': 'b8:69:f4:91:50:eb',
                                                                                                                                            'noise_floor': -135.0,
                                                                                                                                            'rssi': -55.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 138,
                                                                                                                                            'mac_address': 'b8:69:f4:91:50:e5',
                                                                                                                                            'noise_floor': -144.0,
                                                                                                                                            'rssi': -64.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -135.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU5-W60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '25041016',
                                                              'in_octets': '9109329746173',
                                                              'in_ucast_pkts': '9253824652',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:b9:49:e9',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '29997807',
                                                              'out_octets': '11854409577901',
                                                              'out_ucast_pkts': '10775214024',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 23.240662,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'BNaqsRXo',
                                'serial_number': '8AA508F13C7E',
                                'sw_version': '6.45beta62',
                                'system_mac_address': 'cc:2d:e0:b9:49:e9',
                                'uptime': '4305711'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '182',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '8879011617185',
                                                                       'in_ucast_pkts': '9078484634',
                                                                       'links': [       {       'in_discards': '182',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '8879011617185',
                                                                                                'in_ucast_pkts': '9078484634',
                                                                                                'mac_address': '04:d6:aa:b1:15:e8',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '11783298708390',
                                                                                                'out_ucast_pkts': '10688466270'}],
                                                                       'mac_address': 'b8:69:f4:91:50:eb',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '11783298708390',
                                                                       'out_ucast_pkts': '10688466270',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 23,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:15:e8',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU5-W60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '11783298708390',
                                                                       'in_ucast_pkts': '10688466270',
                                                                       'name': 'ether1',
                                                                       'out_octets': '8879011617185',
                                                                       'out_ucast_pkts': '9078484634',
                                                                       'poller_hash': 'Yjg2OWY0OTE1MGViZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': '43-51 Tanunda Rd',
                                         'poller_hash': 'uGn0kVDr',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.44.3'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1149',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '192258416999',
                                                                       'in_ucast_pkts': '186866461',
                                                                       'links': [       {       'in_discards': '1149',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '192258416999',
                                                                                                'in_ucast_pkts': '186866461',
                                                                                                'mac_address': '04:d6:aa:b1:15:e8',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '26846229435',
                                                                                                'out_ucast_pkts': '100874741'}],
                                                                       'mac_address': 'b8:69:f4:91:50:e5',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '26846229435',
                                                                       'out_ucast_pkts': '100874741',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 138,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:15:e8',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU5-W60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '26846229435',
                                                                       'in_ucast_pkts': '100874741',
                                                                       'name': 'ether1',
                                                                       'out_octets': '192258416999',
                                                                       'out_ucast_pkts': '186866461',
                                                                       'poller_hash': 'Yjg2OWY0OTE1MGU1ZXRoZXIx'}],
                                         'poller_hash': 'uGn0kVDl',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_46_6_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.46.6.01")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 0,
                'sw_version': '6.46.6',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 52013709,
                'dl_en_packets': 451331,
                'dl_noise_floor': None,
                'dl_rf_bytes': 0,
                'dl_rf_packets': 0,
                'en_if_speed': 1000000000,
                'mem': 24.36370849609375,
                'serial_number': 'BF950B3B0C8A',
                'ssid': 'NU1-S60G',
                'system_mac_address': 'c4:ad:34:7c:d3:b0',
                'ul_en_bytes': 50290225,
                'ul_en_packets': 198484,
                'ul_noise_floor': None,
                'ul_rf_bytes': 0,
                'ul_rf_packets': 0
        }
        exp_sta_stats = {
         
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '0',
                                                              'in_ucast_pkts': '0',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'c4:ad:34:7c:d3:b1',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '0',
                                                              'out_ucast_pkts': '0',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1'}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU1-S60G'}],
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '148756',
                                                              'in_octets': '52013709',
                                                              'in_ucast_pkts': '302575',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'c4:ad:34:7c:d3:b0',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '25696',
                                                              'out_octets': '50290225',
                                                              'out_ucast_pkts': '172788',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 24.363708,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'xK00fNOx',
                                'serial_number': 'BF950B3B0C8A',
                                'sw_version': '6.46.6',
                                'system_mac_address': 'c4:ad:34:7c:d3:b0',
                                'uptime': '256931'}
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_46_6_02(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.46.6.02")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 64800,
                'sta_count': 4,
                'sw_version': '6.46.6',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 3240343555623,
                'dl_en_packets': 2458075473,
                'dl_noise_floor': None,
                'dl_rf_bytes': 3235789732634,
                'dl_rf_packets': 2878386385,
                'en_if_speed': 1000000000,
                'mem': 25.7781982421875,
                'serial_number': '8AA5080300C7',
                'ssid': 'NU1-WNW60G',
                'system_mac_address': 'cc:2d:e0:b9:46:c5',
                'ul_en_bytes': 218133204677,
                'ul_en_packets': 1086868430,
                'ul_noise_floor': None,
                'ul_rf_bytes': 250891235004,
                'ul_rf_packets': 1513904116
        }
        exp_sta_stats = {
                '04:d6:aa:a4:cb:af': {       'alt_macs': None,
                                             'dev_macs': {       '04:d6:aa:af:cf:a5',
                                                                 '08:55:31:66:35:34'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a4:cb:af',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -131.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -66,
                                             'ul_snr': 65},
                '04:d6:aa:a8:d4:a1': {       'alt_macs': None,
                                             'dev_macs': {'48:8f:5a:0a:99:22'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d4:a1',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -130.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -65,
                                             'ul_snr': 65},
                '24:18:1d:99:65:18': {       'alt_macs': None,
                                             'dev_macs': {'c4:ad:34:7d:4a:1f'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:65:18',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -142.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -62,
                                             'ul_snr': 80},
                '24:18:1d:99:66:da': {       'alt_macs': None,
                                             'dev_macs': {'64:d1:54:a1:ce:15'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:66:da',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -141.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -61,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '250891235004',
                                                              'in_ucast_pkts': '1513904116',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '04:d6:aa:af:cf:a5',
                                                                                                                        '08:55:31:66:35:34'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '35875834713',
                                                                                       'in_ucast_pkts': '104614618',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a4:cb:af',
                                                                                       'out_discards': '1491',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '326774714713',
                                                                                       'out_ucast_pkts': '245177507'},
                                                                               {       'bridged_mac_addresses': [       '48:8f:5a:0a:99:22'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '89803626111',
                                                                                       'in_ucast_pkts': '618609841',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d4:a1',
                                                                                       'out_discards': '4527',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1224504415699',
                                                                                       'out_ucast_pkts': '1106438648'},
                                                                               {       'bridged_mac_addresses': [       'c4:ad:34:7d:4a:1f'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '37432160272',
                                                                                       'in_ucast_pkts': '338241398',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:65:18',
                                                                                       'out_discards': '1019',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '518739939857',
                                                                                       'out_ucast_pkts': '535511705'},
                                                                               {       'bridged_mac_addresses': [       '64:d1:54:a1:ce:15'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '87779613908',
                                                                                       'in_ucast_pkts': '452438259',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:66:da',
                                                                                       'out_discards': '823',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1165770662365',
                                                                                       'out_ucast_pkts': '991258525'}],
                                                              'mac_address': '04:d6:aa:af:cf:a5',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '7860',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '3235789732634',
                                                              'out_ucast_pkts': '2878386385',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 64800,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 391,
                                                                                                                                            'mac_address': '04:d6:aa:a4:cb:af',
                                                                                                                                            'noise_floor': -131.0,
                                                                                                                                            'rssi': -66.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 395,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d4:a1',
                                                                                                                                            'noise_floor': -130.0,
                                                                                                                                            'rssi': -65.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 310,
                                                                                                                                            'mac_address': '24:18:1d:99:65:18',
                                                                                                                                            'noise_floor': -142.0,
                                                                                                                                            'rssi': -62.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 161,
                                                                                                                                            'mac_address': '24:18:1d:99:66:da',
                                                                                                                                            'noise_floor': -141.0,
                                                                                                                                            'rssi': -61.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -130.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU1-WNW60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '14886253',
                                                              'in_octets': '3240343555623',
                                                              'in_ucast_pkts': '2443189220',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:b9:46:c5',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '29474353',
                                                              'out_octets': '218133204677',
                                                              'out_ucast_pkts': '1057394077',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 25.778198,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'BNaqr8+l',
                                'serial_number': '8AA5080300C7',
                                'sw_version': '6.46.6',
                                'system_mac_address': 'cc:2d:e0:b9:46:c5',
                                'uptime': '20540735'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1491',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '326774714713',
                                                                       'in_ucast_pkts': '245177507',
                                                                       'links': [       {       'in_discards': '1491',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '326774714713',
                                                                                                'in_ucast_pkts': '245177507',
                                                                                                'mac_address': '04:d6:aa:af:cf:a5',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '35875834713',
                                                                                                'out_ucast_pkts': '104614618'}],
                                                                       'mac_address': '04:d6:aa:a4:cb:af',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '35875834713',
                                                                       'out_ucast_pkts': '104614618',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 391,
                                                                                                                                                     'mac_address': '04:d6:aa:af:cf:a5',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-WNW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '35875834713',
                                                                       'in_ucast_pkts': '104614618',
                                                                       'name': 'ether1',
                                                                       'out_octets': '326774714713',
                                                                       'out_ucast_pkts': '245177507',
                                                                       'poller_hash': 'MDRkNmFhYTRjYmFmZXRoZXIx'}],
                                         'poller_hash': 'BNaqpMuv',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '4527',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1224504415699',
                                                                       'in_ucast_pkts': '1106438648',
                                                                       'links': [       {       'in_discards': '4527',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1224504415699',
                                                                                                'in_ucast_pkts': '1106438648',
                                                                                                'mac_address': '04:d6:aa:af:cf:a5',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '89803626111',
                                                                                                'out_ucast_pkts': '618609841'}],
                                                                       'mac_address': '04:d6:aa:a8:d4:a1',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '89803626111',
                                                                       'out_ucast_pkts': '618609841',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 395,
                                                                                                                                                     'mac_address': '04:d6:aa:af:cf:a5',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-WNW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '89803626111',
                                                                       'in_ucast_pkts': '618609841',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1224504415699',
                                                                       'out_ucast_pkts': '1106438648',
                                                                       'poller_hash': 'MDRkNmFhYThkNGExZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNSh',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1019',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '518739939857',
                                                                       'in_ucast_pkts': '535511705',
                                                                       'links': [       {       'in_discards': '1019',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '518739939857',
                                                                                                'in_ucast_pkts': '535511705',
                                                                                                'mac_address': '04:d6:aa:af:cf:a5',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '37432160272',
                                                                                                'out_ucast_pkts': '338241398'}],
                                                                       'mac_address': '24:18:1d:99:65:18',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '37432160272',
                                                                       'out_ucast_pkts': '338241398',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 310,
                                                                                                                                                     'mac_address': '04:d6:aa:af:cf:a5',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-WNW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '37432160272',
                                                                       'in_ucast_pkts': '338241398',
                                                                       'name': 'ether1',
                                                                       'out_octets': '518739939857',
                                                                       'out_ucast_pkts': '535511705',
                                                                       'poller_hash': 'MjQxODFkOTk2NTE4ZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWUY',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '823',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1165770662365',
                                                                       'in_ucast_pkts': '991258525',
                                                                       'links': [       {       'in_discards': '823',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1165770662365',
                                                                                                'in_ucast_pkts': '991258525',
                                                                                                'mac_address': '04:d6:aa:af:cf:a5',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '87779613908',
                                                                                                'out_ucast_pkts': '452438259'}],
                                                                       'mac_address': '24:18:1d:99:66:da',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '87779613908',
                                                                       'out_ucast_pkts': '452438259',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 64800,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 161,
                                                                                                                                                     'mac_address': '04:d6:aa:af:cf:a5',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-WNW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '87779613908',
                                                                       'in_ucast_pkts': '452438259',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1165770662365',
                                                                       'out_ucast_pkts': '991258525',
                                                                       'poller_hash': 'MjQxODFkOTk2NmRhZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWba',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_46_6_03(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.46.6.03")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 3,
                'sw_version': '6.46.6',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 1226181213088,
                'dl_en_packets': 1052473247,
                'dl_noise_floor': None,
                'dl_rf_bytes': 1238059353660,
                'dl_rf_packets': 1654115173,
                'en_if_speed': 1000000000,
                'mem': 20.84808349609375,
                'serial_number': 'BF950B1E62BB',
                'ssid': 'TN4-SE60G',
                'system_mac_address': 'c4:ad:34:7c:d3:b6',
                'ul_en_bytes': 89510919008,
                'ul_en_packets': 458824852,
                'ul_noise_floor': None,
                'ul_rf_bytes': 106231096510,
                'ul_rf_packets': 1040490555
        }
        exp_sta_stats = {
                '04:d6:aa:a4:cb:9a': {       'alt_macs': None,
                                             'dev_macs': {       'b8:69:f4:38:c9:77',
                                                                 'c4:ad:34:7c:d3:b7',
                                                                 'cc:2d:e0:32:06:84'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a4:cb:9a',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -141.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -61,
                                             'ul_snr': 80},
                '24:18:1d:57:ac:9e': {       'alt_macs': None,
                                             'dev_macs': {       'b8:69:f4:3f:b6:a5',
                                                                 'cc:2d:e0:fc:de:ea'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:57:ac:9e',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -128.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -63,
                                             'ul_snr': 65},
                '24:18:1d:99:67:f6': {       'alt_macs': None,
                                             'dev_macs': {       '74:4d:28:bd:47:7a',
                                                                 'b8:69:f4:3f:9c:35'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:67:f6',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -141.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -61,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '106231096510',
                                                              'in_ucast_pkts': '1040490555',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '74:4d:28:bd:47:7a',
                                                                                                                        'b8:69:f4:3f:9c:35'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '40364141650',
                                                                                       'in_ucast_pkts': '382856870',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:67:f6',
                                                                                       'out_discards': '4509',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '675899506218',
                                                                                       'out_ucast_pkts': '746867823'},
                                                                               {       'bridged_mac_addresses': [       'b8:69:f4:3f:b6:a5',
                                                                                                                        'cc:2d:e0:fc:de:ea'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '42007275216',
                                                                                       'in_ucast_pkts': '351251330',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:57:ac:9e',
                                                                                       'out_discards': '4630',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '413686330356',
                                                                                       'out_ucast_pkts': '558402665'},
                                                                               {       'bridged_mac_addresses': [       'b8:69:f4:38:c9:77',
                                                                                                                        'c4:ad:34:7c:d3:b7',
                                                                                                                        'cc:2d:e0:32:06:84'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '23859679644',
                                                                                       'in_ucast_pkts': '306382355',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a4:cb:9a',
                                                                                       'out_discards': '889',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '148473517086',
                                                                                       'out_ucast_pkts': '348844685'}],
                                                              'mac_address': 'c4:ad:34:7c:d3:b7',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '10028',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '1238059353660',
                                                              'out_ucast_pkts': '1654115173',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 349,
                                                                                                                                            'mac_address': '24:18:1d:99:67:f6',
                                                                                                                                            'noise_floor': -141.0,
                                                                                                                                            'rssi': -61.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 339,
                                                                                                                                            'mac_address': '24:18:1d:57:ac:9e',
                                                                                                                                            'noise_floor': -128.0,
                                                                                                                                            'rssi': -63.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 349,
                                                                                                                                            'mac_address': '04:d6:aa:a4:cb:9a',
                                                                                                                                            'noise_floor': -141.0,
                                                                                                                                            'rssi': -61.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -128.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'TN4-SE60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '22843055',
                                                              'in_octets': '1226181213088',
                                                              'in_ucast_pkts': '1029630192',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'c4:ad:34:7c:d3:b6',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '41600451',
                                                              'out_octets': '89510919008',
                                                              'out_ucast_pkts': '417224401',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.848083,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'xK00fNO3',
                                'serial_number': 'BF950B1E62BB',
                                'sw_version': '6.46.6',
                                'system_mac_address': 'c4:ad:34:7c:d3:b6',
                                'uptime': '25537248'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '4509',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '675899506218',
                                                                       'in_ucast_pkts': '746867823',
                                                                       'links': [       {       'in_discards': '4509',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '675899506218',
                                                                                                'in_ucast_pkts': '746867823',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:b7',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '40364141650',
                                                                                                'out_ucast_pkts': '382856870'}],
                                                                       'mac_address': '24:18:1d:99:67:f6',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '40364141650',
                                                                       'out_ucast_pkts': '382856870',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 349,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:b7',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN4-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '40364141650',
                                                                       'in_ucast_pkts': '382856870',
                                                                       'name': 'ether1',
                                                                       'out_octets': '675899506218',
                                                                       'out_ucast_pkts': '746867823',
                                                                       'poller_hash': 'MjQxODFkOTk2N2Y2ZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWf2',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '4630',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '413686330356',
                                                                       'in_ucast_pkts': '558402665',
                                                                       'links': [       {       'in_discards': '4630',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '413686330356',
                                                                                                'in_ucast_pkts': '558402665',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:b7',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '42007275216',
                                                                                                'out_ucast_pkts': '351251330'}],
                                                                       'mac_address': '24:18:1d:57:ac:9e',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '42007275216',
                                                                       'out_ucast_pkts': '351251330',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 339,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:b7',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN4-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '42007275216',
                                                                       'in_ucast_pkts': '351251330',
                                                                       'name': 'ether1',
                                                                       'out_octets': '413686330356',
                                                                       'out_ucast_pkts': '558402665',
                                                                       'poller_hash': 'MjQxODFkNTdhYzllZXRoZXIx'}],
                                         'poller_hash': 'JBgdV6ye',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '889',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '148473517086',
                                                                       'in_ucast_pkts': '348844685',
                                                                       'links': [       {       'in_discards': '889',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '148473517086',
                                                                                                'in_ucast_pkts': '348844685',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:b7',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '23859679644',
                                                                                                'out_ucast_pkts': '306382355'}],
                                                                       'mac_address': '04:d6:aa:a4:cb:9a',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '23859679644',
                                                                       'out_ucast_pkts': '306382355',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 349,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:b7',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN4-SE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '23859679644',
                                                                       'in_ucast_pkts': '306382355',
                                                                       'name': 'ether1',
                                                                       'out_octets': '148473517086',
                                                                       'out_ucast_pkts': '348844685',
                                                                       'poller_hash': 'MDRkNmFhYTRjYjlhZXRoZXIx'}],
                                         'poller_hash': 'BNaqpMua',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_46_6_04(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.46.6.04")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 1,
                'sw_version': '6.46.6',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 25824212418,
                'dl_en_packets': 104235103,
                'dl_noise_floor': None,
                'dl_rf_bytes': 22558371477,
                'dl_rf_packets': 122462826,
                'en_if_speed': 1000000000,
                'mem': 20.44219970703125,
                'serial_number': 'BF950BD43AE2',
                'ssid': 'TN4-SW60G',
                'system_mac_address': 'c4:ad:34:7c:d3:3a',
                'ul_en_bytes': 6599040131,
                'ul_en_packets': 62504900,
                'ul_noise_floor': None,
                'ul_rf_bytes': 5161200086,
                'ul_rf_packets': 116988528
        }
        exp_sta_stats = {
                '04:d6:aa:a4:cb:ad': {       'alt_macs': None,
                                             'dev_macs': {       '48:8f:5a:20:33:a3',
                                                                 'c4:ad:34:7c:d3:3b'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a4:cb:ad',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -151.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -56,
                                             'ul_snr': 95}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '5161200086',
                                                              'in_ucast_pkts': '116988528',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '48:8f:5a:20:33:a3',
                                                                                                                        'c4:ad:34:7c:d3:3b'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '5161200086',
                                                                                       'in_ucast_pkts': '116988528',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a4:cb:ad',
                                                                                       'out_discards': '453',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '22558371477',
                                                                                       'out_ucast_pkts': '122462826'}],
                                                              'mac_address': 'c4:ad:34:7c:d3:3b',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '453',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '22558371477',
                                                              'out_ucast_pkts': '122462826',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 146,
                                                                                                                                            'mac_address': '04:d6:aa:a4:cb:ad',
                                                                                                                                            'noise_floor': -151.0,
                                                                                                                                            'rssi': -56.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -151.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'TN4-SW60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '22842620',
                                                              'in_octets': '25824212418',
                                                              'in_ucast_pkts': '81392483',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'c4:ad:34:7c:d3:3a',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '7145615',
                                                              'out_octets': '6599040131',
                                                              'out_ucast_pkts': '55359285',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.4422,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'xK00fNM7',
                                'serial_number': 'BF950BD43AE2',
                                'sw_version': '6.46.6',
                                'system_mac_address': 'c4:ad:34:7c:d3:3a',
                                'uptime': '25536627'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '453',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '22558371477',
                                                                       'in_ucast_pkts': '122462826',
                                                                       'links': [       {       'in_discards': '453',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '22558371477',
                                                                                                'in_ucast_pkts': '122462826',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:3b',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '5161200086',
                                                                                                'out_ucast_pkts': '116988528'}],
                                                                       'mac_address': '04:d6:aa:a4:cb:ad',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '5161200086',
                                                                       'out_ucast_pkts': '116988528',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 146,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:3b',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN4-SW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '5161200086',
                                                                       'in_ucast_pkts': '116988528',
                                                                       'name': 'ether1',
                                                                       'out_octets': '22558371477',
                                                                       'out_ucast_pkts': '122462826',
                                                                       'poller_hash': 'MDRkNmFhYTRjYmFkZXRoZXIx'}],
                                         'poller_hash': 'BNaqpMut',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_46_6_05(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.46.6.05")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 3,
                'sw_version': '6.46.6',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 5581731349520,
                'dl_en_packets': 4133611284,
                'dl_noise_floor': None,
                'dl_rf_bytes': 5565765843185,
                'dl_rf_packets': 4504668956,
                'en_if_speed': 1000000000,
                'mem': 20.77178955078125,
                'serial_number': 'BF950B9C0976',
                'ssid': 'TN5-NE60G',
                'system_mac_address': 'c4:ad:34:7c:d3:4a',
                'ul_en_bytes': 266449501568,
                'ul_en_packets': 1698561827,
                'ul_noise_floor': None,
                'ul_rf_bytes': 271717330212,
                'ul_rf_packets': 2071831826
        }
        exp_sta_stats = {
                '24:18:1d:5a:13:9b': {       'alt_macs': None,
                                             'dev_macs': {       '64:d1:54:77:e8:28',
                                                                 'b8:69:f4:3f:b9:cb',
                                                                 'c4:ad:34:7c:d3:4b'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:5a:13:9b',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -118.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -68,
                                             'ul_snr': 50},
                '24:18:1d:99:67:91': {       'alt_macs': None,
                                             'dev_macs': {'48:8f:5a:09:fb:de'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:67:91',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -138.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -58,
                                             'ul_snr': 80},
                '48:8f:5a:51:dd:2b': {       'alt_macs': None,
                                             'dev_macs': {'08:55:31:36:bf:63'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:51:dd:2b',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -132.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -52,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '271717330212',
                                                              'in_ucast_pkts': '2071831826',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '48:8f:5a:09:fb:de'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '176105032229',
                                                                                       'in_ucast_pkts': '1520963962',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:67:91',
                                                                                       'out_discards': '3154',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '5153644350645',
                                                                                       'out_ucast_pkts': '3803237211'},
                                                                               {       'bridged_mac_addresses': [       '64:d1:54:77:e8:28',
                                                                                                                        'b8:69:f4:3f:b9:cb',
                                                                                                                        'c4:ad:34:7c:d3:4b'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '41054803195',
                                                                                       'in_ucast_pkts': '315382286',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:5a:13:9b',
                                                                                       'out_discards': '1110',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '236714840092',
                                                                                       'out_ucast_pkts': '411495292'},
                                                                               {       'bridged_mac_addresses': [       '08:55:31:36:bf:63'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '54557494788',
                                                                                       'in_ucast_pkts': '235485578',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:51:dd:2b',
                                                                                       'out_discards': '87',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '175406652448',
                                                                                       'out_ucast_pkts': '289936453'}],
                                                              'mac_address': 'c4:ad:34:7c:d3:4b',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '4351',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '5565765843185',
                                                              'out_ucast_pkts': '4504668956',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 117,
                                                                                                                                            'mac_address': '24:18:1d:99:67:91',
                                                                                                                                            'noise_floor': -138.0,
                                                                                                                                            'rssi': -58.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 156,
                                                                                                                                            'mac_address': '24:18:1d:5a:13:9b',
                                                                                                                                            'noise_floor': -118.0,
                                                                                                                                            'rssi': -68.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 57,
                                                                                                                                            'mac_address': '48:8f:5a:51:dd:2b',
                                                                                                                                            'noise_floor': -132.0,
                                                                                                                                            'rssi': -52.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -118.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'TN5-NE60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '22709779',
                                                              'in_octets': '5581731349520',
                                                              'in_ucast_pkts': '4110901505',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'c4:ad:34:7c:d3:4a',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '29681189',
                                                              'out_octets': '266449501568',
                                                              'out_ucast_pkts': '1668880638',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.77179,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'xK00fNNL',
                                'serial_number': 'BF950B9C0976',
                                'sw_version': '6.46.6',
                                'system_mac_address': 'c4:ad:34:7c:d3:4a',
                                'uptime': '24864445'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '3154',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '5153644350645',
                                                                       'in_ucast_pkts': '3803237211',
                                                                       'links': [       {       'in_discards': '3154',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '5153644350645',
                                                                                                'in_ucast_pkts': '3803237211',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:4b',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '176105032229',
                                                                                                'out_ucast_pkts': '1520963962'}],
                                                                       'mac_address': '24:18:1d:99:67:91',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '176105032229',
                                                                       'out_ucast_pkts': '1520963962',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 117,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:4b',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN5-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '176105032229',
                                                                       'in_ucast_pkts': '1520963962',
                                                                       'name': 'ether1',
                                                                       'out_octets': '5153644350645',
                                                                       'out_ucast_pkts': '3803237211',
                                                                       'poller_hash': 'MjQxODFkOTk2NzkxZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWeR',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1110',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '236714840092',
                                                                       'in_ucast_pkts': '411495292',
                                                                       'links': [       {       'in_discards': '1110',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '236714840092',
                                                                                                'in_ucast_pkts': '411495292',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:4b',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '41054803195',
                                                                                                'out_ucast_pkts': '315382286'}],
                                                                       'mac_address': '24:18:1d:5a:13:9b',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '41054803195',
                                                                       'out_ucast_pkts': '315382286',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 156,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:4b',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN5-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '41054803195',
                                                                       'in_ucast_pkts': '315382286',
                                                                       'name': 'ether1',
                                                                       'out_octets': '236714840092',
                                                                       'out_ucast_pkts': '411495292',
                                                                       'poller_hash': 'MjQxODFkNWExMzliZXRoZXIx'}],
                                         'poller_hash': 'JBgdWhOb',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '87',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '175406652448',
                                                                       'in_ucast_pkts': '289936453',
                                                                       'links': [       {       'in_discards': '87',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '175406652448',
                                                                                                'in_ucast_pkts': '289936453',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:4b',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '54557494788',
                                                                                                'out_ucast_pkts': '235485578'}],
                                                                       'mac_address': '48:8f:5a:51:dd:2b',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '54557494788',
                                                                       'out_ucast_pkts': '235485578',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 57,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:4b',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN5-NE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '54557494788',
                                                                       'in_ucast_pkts': '235485578',
                                                                       'name': 'ether1',
                                                                       'out_octets': '175406652448',
                                                                       'out_ucast_pkts': '289936453',
                                                                       'poller_hash': 'NDg4ZjVhNTFkZDJiZXRoZXIx'}],
                                         'poller_hash': 'SI9aUd0r',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_46_6_06(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.46.6.06")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 0,
                'sw_version': '6.46.6',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 5387087422,
                'dl_en_packets': 71998955,
                'dl_noise_floor': None,
                'dl_rf_bytes': 0,
                'dl_rf_packets': 0,
                'en_if_speed': 1000000000,
                'mem': 21.1639404296875,
                'serial_number': 'BF950B44040D',
                'ssid': 'TN5-SSE60G',
                'system_mac_address': 'c4:ad:34:7c:8d:24',
                'ul_en_bytes': 3908371178,
                'ul_en_packets': 27730510,
                'ul_noise_floor': None,
                'ul_rf_bytes': 0,
                'ul_rf_packets': 0
        }
        exp_sta_stats = {
         
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '0',
                                                              'in_ucast_pkts': '0',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'c4:ad:34:7c:8d:25',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '0',
                                                              'out_ucast_pkts': '0',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1'}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'TN5-SSE60G'}],
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '22703324',
                                                              'in_octets': '5387087422',
                                                              'in_ucast_pkts': '49295631',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'c4:ad:34:7c:8d:24',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '1243175',
                                                              'out_octets': '3908371178',
                                                              'out_ucast_pkts': '26487335',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.16394,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'xK00fI0l',
                                'serial_number': 'BF950B44040D',
                                'sw_version': '6.46.6',
                                'system_mac_address': 'c4:ad:34:7c:8d:24',
                                'uptime': '24856209'}
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_46_6_07(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.46.6.07")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 7,
                'sw_version': '6.46.6',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 1689678548863,
                'dl_en_packets': 1623427943,
                'dl_noise_floor': None,
                'dl_rf_bytes': 1695874260334,
                'dl_rf_packets': 2367754637,
                'en_if_speed': 1000000000,
                'mem': 22.2442626953125,
                'serial_number': '81ED088EA04F',
                'ssid': 'TN5-W60G',
                'system_mac_address': 'cc:2d:e0:be:6d:18',
                'ul_en_bytes': 312937962948,
                'ul_en_packets': 1237054148,
                'ul_noise_floor': None,
                'ul_rf_bytes': 333415465185,
                'ul_rf_packets': 1952433301
        }
        exp_sta_stats = {
                '04:d6:aa:a8:d1:98': {       'alt_macs': None,
                                             'dev_macs': {       '04:d6:aa:b1:18:b6',
                                                                 'cc:2d:e0:f7:4f:06'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d1:98',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -139.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -59,
                                             'ul_snr': 80},
                '04:d6:aa:a8:d4:b7': {       'alt_macs': None,
                                             'dev_macs': {'80:2a:a8:e1:a0:d5'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d4:b7',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -117.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -67,
                                             'ul_snr': 50},
                '24:18:1d:99:65:f4': {       'alt_macs': None,
                                             'dev_macs': {'b8:69:f4:4a:60:ab'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:65:f4',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -140.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -60,
                                             'ul_snr': 80},
                '24:18:1d:99:67:de': {       'alt_macs': None,
                                             'dev_macs': {'cc:2d:e0:a3:f9:76'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:67:de',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -139.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -59,
                                             'ul_snr': 80},
                '24:18:1d:99:68:9a': {       'alt_macs': None,
                                             'dev_macs': {'48:8f:5a:09:fc:3c'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:68:9a',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -145.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -65,
                                             'ul_snr': 80},
                '48:8f:5a:51:dd:3f': {       'alt_macs': {'48:8f:5a:51:dd:3e'},
                                             'dev_macs': {'cc:2d:e0:22:78:0d'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:51:dd:3f',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -139.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -59,
                                             'ul_snr': 80},
                '48:8f:5a:52:1c:56': {       'alt_macs': None,
                                             'dev_macs': {'08:55:31:66:26:55'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:52:1c:56',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -139.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -59,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '333415465185',
                                                              'in_ucast_pkts': '1952433301',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '80:2a:a8:e1:a0:d5'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '12615603038',
                                                                                       'in_ucast_pkts': '175828928',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d4:b7',
                                                                                       'out_discards': '299',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '107702060248',
                                                                                       'out_ucast_pkts': '203377411'},
                                                                               {       'bridged_mac_addresses': [       '08:55:31:66:26:55'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '2630441675',
                                                                                       'in_ucast_pkts': '30099066',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:52:1c:56',
                                                                                       'out_discards': '111',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '2128075392',
                                                                                       'out_ucast_pkts': '28940944'},
                                                                               {       'bridged_mac_addresses': [       '48:8f:5a:09:fc:3c'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '63874372170',
                                                                                       'in_ucast_pkts': '655021735',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:68:9a',
                                                                                       'out_discards': '3473',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '930483934766',
                                                                                       'out_ucast_pkts': '903987949'},
                                                                               {       'bridged_mac_addresses': [       'cc:2d:e0:22:78:0d'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '148395537452',
                                                                                       'in_ucast_pkts': '380040229',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:51:dd:3f',
                                                                                       'out_discards': '222',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '118349480956',
                                                                                       'out_ucast_pkts': '338909579'},
                                                                               {       'bridged_mac_addresses': [       'b8:69:f4:4a:60:ab'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '12123959614',
                                                                                       'in_ucast_pkts': '169340671',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:65:f4',
                                                                                       'out_discards': '78',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '72241869128',
                                                                                       'out_ucast_pkts': '189341479'},
                                                                               {       'bridged_mac_addresses': [       'cc:2d:e0:a3:f9:76'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '75703690108',
                                                                                       'in_ucast_pkts': '362678083',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:67:de',
                                                                                       'out_discards': '81',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '336006267755',
                                                                                       'out_ucast_pkts': '477414538'},
                                                                               {       'bridged_mac_addresses': [       '04:d6:aa:b1:18:b6',
                                                                                                                        'cc:2d:e0:f7:4f:06'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '18071861128',
                                                                                       'in_ucast_pkts': '179424589',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d1:98',
                                                                                       'out_discards': '176',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '128962572089',
                                                                                       'out_ucast_pkts': '225782737'}],
                                                              'mac_address': '04:d6:aa:b1:18:b6',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '4440',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '1695874260334',
                                                              'out_ucast_pkts': '2367754637',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 244,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d4:b7',
                                                                                                                                            'noise_floor': -117.0,
                                                                                                                                            'rssi': -67.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 121,
                                                                                                                                            'mac_address': '48:8f:5a:52:1c:56',
                                                                                                                                            'noise_floor': -139.0,
                                                                                                                                            'rssi': -59.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 294,
                                                                                                                                            'mac_address': '24:18:1d:99:68:9a',
                                                                                                                                            'noise_floor': -145.0,
                                                                                                                                            'rssi': -65.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 209,
                                                                                                                                            'mac_address': '48:8f:5a:51:dd:3f',
                                                                                                                                            'noise_floor': -139.0,
                                                                                                                                            'rssi': -59.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 152,
                                                                                                                                            'mac_address': '24:18:1d:99:65:f4',
                                                                                                                                            'noise_floor': -140.0,
                                                                                                                                            'rssi': -60.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 147,
                                                                                                                                            'mac_address': '24:18:1d:99:67:de',
                                                                                                                                            'noise_floor': -139.0,
                                                                                                                                            'rssi': -59.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 129,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d1:98',
                                                                                                                                            'noise_floor': -139.0,
                                                                                                                                            'rssi': -59.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -117.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'TN5-W60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '22706009',
                                                              'in_octets': '1689678548863',
                                                              'in_ucast_pkts': '1600721934',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:be:6d:18',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '52920574',
                                                              'out_octets': '312937962948',
                                                              'out_ucast_pkts': '1184133574',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 22.244263,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'BNaqsRi2',
                                'serial_number': '81ED088EA04F',
                                'sw_version': '6.46.6',
                                'system_mac_address': 'cc:2d:e0:be:6d:18',
                                'uptime': '24858696'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '299',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '107702060248',
                                                                       'in_ucast_pkts': '203377411',
                                                                       'links': [       {       'in_discards': '299',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '107702060248',
                                                                                                'in_ucast_pkts': '203377411',
                                                                                                'mac_address': '04:d6:aa:b1:18:b6',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '12615603038',
                                                                                                'out_ucast_pkts': '175828928'}],
                                                                       'mac_address': '04:d6:aa:a8:d4:b7',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '12615603038',
                                                                       'out_ucast_pkts': '175828928',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 244,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:18:b6',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN5-W60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '12615603038',
                                                                       'in_ucast_pkts': '175828928',
                                                                       'name': 'ether1',
                                                                       'out_octets': '107702060248',
                                                                       'out_ucast_pkts': '203377411',
                                                                       'poller_hash': 'MDRkNmFhYThkNGI3ZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNS3',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '111',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '2128075392',
                                                                       'in_ucast_pkts': '28940944',
                                                                       'links': [       {       'in_discards': '111',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '2128075392',
                                                                                                'in_ucast_pkts': '28940944',
                                                                                                'mac_address': '04:d6:aa:b1:18:b6',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '2630441675',
                                                                                                'out_ucast_pkts': '30099066'}],
                                                                       'mac_address': '48:8f:5a:52:1c:56',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '2630441675',
                                                                       'out_ucast_pkts': '30099066',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 121,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:18:b6',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN5-W60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '2630441675',
                                                                       'in_ucast_pkts': '30099066',
                                                                       'name': 'ether1',
                                                                       'out_octets': '2128075392',
                                                                       'out_ucast_pkts': '28940944',
                                                                       'poller_hash': 'NDg4ZjVhNTIxYzU2ZXRoZXIx'}],
                                         'poller_hash': 'SI9aUhxW',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '3473',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '930483934766',
                                                                       'in_ucast_pkts': '903987949',
                                                                       'links': [       {       'in_discards': '3473',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '930483934766',
                                                                                                'in_ucast_pkts': '903987949',
                                                                                                'mac_address': '04:d6:aa:b1:18:b6',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '63874372170',
                                                                                                'out_ucast_pkts': '655021735'}],
                                                                       'mac_address': '24:18:1d:99:68:9a',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '63874372170',
                                                                       'out_ucast_pkts': '655021735',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 294,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:18:b6',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN5-W60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '63874372170',
                                                                       'in_ucast_pkts': '655021735',
                                                                       'name': 'ether1',
                                                                       'out_octets': '930483934766',
                                                                       'out_ucast_pkts': '903987949',
                                                                       'poller_hash': 'MjQxODFkOTk2ODlhZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWia',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '222',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '118349480956',
                                                                       'in_ucast_pkts': '338909579',
                                                                       'links': [       {       'in_discards': '222',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '118349480956',
                                                                                                'in_ucast_pkts': '338909579',
                                                                                                'mac_address': '04:d6:aa:b1:18:b6',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '148395537452',
                                                                                                'out_ucast_pkts': '380040229'}],
                                                                       'mac_address': '48:8f:5a:51:dd:3f',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '148395537452',
                                                                       'out_ucast_pkts': '380040229',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 209,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:18:b6',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN5-W60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '148395537452',
                                                                       'in_ucast_pkts': '380040229',
                                                                       'mac_address': '48:8f:5a:51:dd:3e',
                                                                       'name': 'ether1',
                                                                       'out_octets': '118349480956',
                                                                       'out_ucast_pkts': '338909579',
                                                                       'poller_hash': 'NDg4ZjVhNTFkZDNmZXRoZXIx'}],
                                         'poller_hash': 'SI9aUd0/',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': '48:8f:5a:51:dd:3e'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '78',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '72241869128',
                                                                       'in_ucast_pkts': '189341479',
                                                                       'links': [       {       'in_discards': '78',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '72241869128',
                                                                                                'in_ucast_pkts': '189341479',
                                                                                                'mac_address': '04:d6:aa:b1:18:b6',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '12123959614',
                                                                                                'out_ucast_pkts': '169340671'}],
                                                                       'mac_address': '24:18:1d:99:65:f4',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '12123959614',
                                                                       'out_ucast_pkts': '169340671',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 152,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:18:b6',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN5-W60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '12123959614',
                                                                       'in_ucast_pkts': '169340671',
                                                                       'name': 'ether1',
                                                                       'out_octets': '72241869128',
                                                                       'out_ucast_pkts': '189341479',
                                                                       'poller_hash': 'MjQxODFkOTk2NWY0ZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWX0',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '81',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '336006267755',
                                                                       'in_ucast_pkts': '477414538',
                                                                       'links': [       {       'in_discards': '81',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '336006267755',
                                                                                                'in_ucast_pkts': '477414538',
                                                                                                'mac_address': '04:d6:aa:b1:18:b6',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '75703690108',
                                                                                                'out_ucast_pkts': '362678083'}],
                                                                       'mac_address': '24:18:1d:99:67:de',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '75703690108',
                                                                       'out_ucast_pkts': '362678083',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 147,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:18:b6',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN5-W60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '75703690108',
                                                                       'in_ucast_pkts': '362678083',
                                                                       'name': 'ether1',
                                                                       'out_octets': '336006267755',
                                                                       'out_ucast_pkts': '477414538',
                                                                       'poller_hash': 'MjQxODFkOTk2N2RlZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWfe',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '176',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '128962572089',
                                                                       'in_ucast_pkts': '225782737',
                                                                       'links': [       {       'in_discards': '176',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '128962572089',
                                                                                                'in_ucast_pkts': '225782737',
                                                                                                'mac_address': '04:d6:aa:b1:18:b6',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '18071861128',
                                                                                                'out_ucast_pkts': '179424589'}],
                                                                       'mac_address': '04:d6:aa:a8:d1:98',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '18071861128',
                                                                       'out_ucast_pkts': '179424589',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 129,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:18:b6',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN5-W60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '18071861128',
                                                                       'in_ucast_pkts': '179424589',
                                                                       'name': 'ether1',
                                                                       'out_octets': '128962572089',
                                                                       'out_ucast_pkts': '225782737',
                                                                       'poller_hash': 'MDRkNmFhYThkMTk4ZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNGY',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_46_8_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.46.8.01")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 7,
                'sw_version': '6.46.8',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 1554078945263,
                'dl_en_packets': 1180448634,
                'dl_noise_floor': None,
                'dl_rf_bytes': 1549812652070,
                'dl_rf_packets': 1328355660,
                'en_if_speed': 1000000000,
                'mem': 21.17919921875,
                'serial_number': 'D6940C92296F',
                'ssid': 'NU6-60ESE',
                'system_mac_address': '48:8f:5a:bf:4f:c6',
                'ul_en_bytes': 98353771396,
                'ul_en_packets': 462380574,
                'ul_noise_floor': None,
                'ul_rf_bytes': 102604529440,
                'ul_rf_packets': 595134243
        }
        exp_sta_stats = {
                '48:8f:5a:51:dd:4f': {       'alt_macs': {'48:8f:5a:51:dd:4e'},
                                             'dev_macs': {'b8:69:f4:25:58:37'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:51:dd:4f',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -145.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -55,
                                             'ul_snr': 90},
                '48:8f:5a:51:e3:82': {       'alt_macs': None,
                                             'dev_macs': {'08:55:31:65:79:a5'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:51:e3:82',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -140.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -60,
                                             'ul_snr': 80},
                '48:8f:5a:52:1c:9c': {       'alt_macs': {'48:8f:5a:52:1c:9b'},
                                             'dev_macs': {'b8:69:f4:2c:5f:a4'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:52:1c:9c',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -150.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -55,
                                             'ul_snr': 95},
                '48:8f:5a:52:1d:08': {       'alt_macs': {'48:8f:5a:52:1d:07'},
                                             'dev_macs': {       '48:8f:5a:bf:4f:c7',
                                                                 '64:d1:54:87:96:ce'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:52:1d:08',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -137.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -57,
                                             'ul_snr': 80},
                '48:8f:5a:80:67:31': {       'alt_macs': {'48:8f:5a:80:67:30'},
                                             'dev_macs': {'c4:ad:34:55:23:fc'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:80:67:31',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -151.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -56,
                                             'ul_snr': 95},
                '48:8f:5a:80:67:b8': {       'alt_macs': None,
                                             'dev_macs': {'c4:ad:34:5d:51:8e'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:80:67:b8',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -149.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -54,
                                             'ul_snr': 95},
                '48:8f:5a:80:68:f5': {       'alt_macs': None,
                                             'dev_macs': {'cc:2d:e0:32:06:fb'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:80:68:f5',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -143.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -63,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '102604529440',
                                                              'in_ucast_pkts': '595134243',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       'cc:2d:e0:32:06:fb'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '39308850635',
                                                                                       'in_ucast_pkts': '126870451',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:80:68:f5',
                                                                                       'out_discards': '587',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '328822833400',
                                                                                       'out_ucast_pkts': '263480683'},
                                                                               {       'bridged_mac_addresses': [       'b8:69:f4:2c:5f:a4'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '6718956587',
                                                                                       'in_ucast_pkts': '45788848',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:52:1c:9c',
                                                                                       'out_discards': '67',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '133679825429',
                                                                                       'out_ucast_pkts': '104195649'},
                                                                               {       'bridged_mac_addresses': [       'b8:69:f4:25:58:37'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '5402789865',
                                                                                       'in_ucast_pkts': '39242517',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:51:dd:4f',
                                                                                       'out_discards': '59',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '140421690738',
                                                                                       'out_ucast_pkts': '112728486'},
                                                                               {       'bridged_mac_addresses': [       'c4:ad:34:5d:51:8e'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '628516193',
                                                                                       'in_ucast_pkts': '2023452',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:80:67:b8',
                                                                                       'out_discards': '27',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '10303215058',
                                                                                       'out_ucast_pkts': '7608310'},
                                                                               {       'bridged_mac_addresses': [       '48:8f:5a:bf:4f:c7',
                                                                                                                        '64:d1:54:87:96:ce'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '29341752313',
                                                                                       'in_ucast_pkts': '185778284',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:52:1d:08',
                                                                                       'out_discards': '273',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '558765774185',
                                                                                       'out_ucast_pkts': '471238022'},
                                                                               {       'bridged_mac_addresses': [       'c4:ad:34:55:23:fc'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '8818468778',
                                                                                       'in_ucast_pkts': '93705992',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:80:67:31',
                                                                                       'out_discards': '137',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '59070489150',
                                                                                       'out_ucast_pkts': '111896680'},
                                                                               {       'bridged_mac_addresses': [       '08:55:31:65:79:a5'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '5471090104',
                                                                                       'in_ucast_pkts': '44614695',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:51:e3:82',
                                                                                       'out_discards': '213',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '135295194804',
                                                                                       'out_ucast_pkts': '111777352'}],
                                                              'mac_address': '48:8f:5a:bf:4f:c7',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '1453',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '1549812652070',
                                                              'out_ucast_pkts': '1328355660',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 202,
                                                                                                                                            'mac_address': '48:8f:5a:80:68:f5',
                                                                                                                                            'noise_floor': -143.0,
                                                                                                                                            'rssi': -63.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 120,
                                                                                                                                            'mac_address': '48:8f:5a:52:1c:9c',
                                                                                                                                            'noise_floor': -150.0,
                                                                                                                                            'rssi': -55.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 202,
                                                                                                                                            'mac_address': '48:8f:5a:51:dd:4f',
                                                                                                                                            'noise_floor': -145.0,
                                                                                                                                            'rssi': -55.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 90.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 29,
                                                                                                                                            'mac_address': '48:8f:5a:80:67:b8',
                                                                                                                                            'noise_floor': -149.0,
                                                                                                                                            'rssi': -54.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 109,
                                                                                                                                            'mac_address': '48:8f:5a:52:1d:08',
                                                                                                                                            'noise_floor': -137.0,
                                                                                                                                            'rssi': -57.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 154,
                                                                                                                                            'mac_address': '48:8f:5a:80:67:31',
                                                                                                                                            'noise_floor': -151.0,
                                                                                                                                            'rssi': -56.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 210,
                                                                                                                                            'mac_address': '48:8f:5a:51:e3:82',
                                                                                                                                            'noise_floor': -140.0,
                                                                                                                                            'rssi': -60.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -137.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU6-60ESE'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '3960344',
                                                              'in_octets': '1554078945263',
                                                              'in_ucast_pkts': '1176488290',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '48:8f:5a:bf:4f:c6',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '13838515',
                                                              'out_octets': '98353771396',
                                                              'out_ucast_pkts': '448542059',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.1792,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'SI9av0/H',
                                'serial_number': 'D6940C92296F',
                                'sw_version': '6.46.8',
                                'system_mac_address': '48:8f:5a:bf:4f:c6',
                                'uptime': '6370180'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '587',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '328822833400',
                                                                       'in_ucast_pkts': '263480683',
                                                                       'links': [       {       'in_discards': '587',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '328822833400',
                                                                                                'in_ucast_pkts': '263480683',
                                                                                                'mac_address': '48:8f:5a:bf:4f:c7',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '39308850635',
                                                                                                'out_ucast_pkts': '126870451'}],
                                                                       'mac_address': '48:8f:5a:80:68:f5',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '39308850635',
                                                                       'out_ucast_pkts': '126870451',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 202,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4f:c7',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60ESE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '39308850635',
                                                                       'in_ucast_pkts': '126870451',
                                                                       'name': 'ether1',
                                                                       'out_octets': '328822833400',
                                                                       'out_ucast_pkts': '263480683',
                                                                       'poller_hash': 'NDg4ZjVhODA2OGY1ZXRoZXIx'}],
                                         'poller_hash': 'SI9agGj1',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '67',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '133679825429',
                                                                       'in_ucast_pkts': '104195649',
                                                                       'links': [       {       'in_discards': '67',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '133679825429',
                                                                                                'in_ucast_pkts': '104195649',
                                                                                                'mac_address': '48:8f:5a:bf:4f:c7',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '6718956587',
                                                                                                'out_ucast_pkts': '45788848'}],
                                                                       'mac_address': '48:8f:5a:52:1c:9c',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '6718956587',
                                                                       'out_ucast_pkts': '45788848',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 120,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4f:c7',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60ESE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '6718956587',
                                                                       'in_ucast_pkts': '45788848',
                                                                       'mac_address': '48:8f:5a:52:1c:9b',
                                                                       'name': 'ether1',
                                                                       'out_octets': '133679825429',
                                                                       'out_ucast_pkts': '104195649',
                                                                       'poller_hash': 'NDg4ZjVhNTIxYzljZXRoZXIx'}],
                                         'poller_hash': 'SI9aUhyc',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': '48:8f:5a:52:1c:9b'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '59',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '140421690738',
                                                                       'in_ucast_pkts': '112728486',
                                                                       'links': [       {       'in_discards': '59',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '140421690738',
                                                                                                'in_ucast_pkts': '112728486',
                                                                                                'mac_address': '48:8f:5a:bf:4f:c7',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '5402789865',
                                                                                                'out_ucast_pkts': '39242517'}],
                                                                       'mac_address': '48:8f:5a:51:dd:4f',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '5402789865',
                                                                       'out_ucast_pkts': '39242517',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 202,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4f:c7',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60ESE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '5402789865',
                                                                       'in_ucast_pkts': '39242517',
                                                                       'mac_address': '48:8f:5a:51:dd:4e',
                                                                       'name': 'ether1',
                                                                       'out_octets': '140421690738',
                                                                       'out_ucast_pkts': '112728486',
                                                                       'poller_hash': 'NDg4ZjVhNTFkZDRmZXRoZXIx'}],
                                         'poller_hash': 'SI9aUd1P',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': '48:8f:5a:51:dd:4e'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '27',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '10303215058',
                                                                       'in_ucast_pkts': '7608310',
                                                                       'links': [       {       'in_discards': '27',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '10303215058',
                                                                                                'in_ucast_pkts': '7608310',
                                                                                                'mac_address': '48:8f:5a:bf:4f:c7',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '628516193',
                                                                                                'out_ucast_pkts': '2023452'}],
                                                                       'mac_address': '48:8f:5a:80:67:b8',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '628516193',
                                                                       'out_ucast_pkts': '2023452',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 29,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4f:c7',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60ESE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '628516193',
                                                                       'in_ucast_pkts': '2023452',
                                                                       'name': 'ether1',
                                                                       'out_octets': '10303215058',
                                                                       'out_ucast_pkts': '7608310',
                                                                       'poller_hash': 'NDg4ZjVhODA2N2I4ZXRoZXIx'}],
                                         'poller_hash': 'SI9agGe4',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '273',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '558765774185',
                                                                       'in_ucast_pkts': '471238022',
                                                                       'links': [       {       'in_discards': '273',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '558765774185',
                                                                                                'in_ucast_pkts': '471238022',
                                                                                                'mac_address': '48:8f:5a:bf:4f:c7',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '29341752313',
                                                                                                'out_ucast_pkts': '185778284'}],
                                                                       'mac_address': '48:8f:5a:52:1d:08',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '29341752313',
                                                                       'out_ucast_pkts': '185778284',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 109,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4f:c7',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60ESE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '29341752313',
                                                                       'in_ucast_pkts': '185778284',
                                                                       'mac_address': '48:8f:5a:52:1d:07',
                                                                       'name': 'ether1',
                                                                       'out_octets': '558765774185',
                                                                       'out_ucast_pkts': '471238022',
                                                                       'poller_hash': 'NDg4ZjVhNTIxZDA4ZXRoZXIx'}],
                                         'poller_hash': 'SI9aUh0I',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': '48:8f:5a:52:1d:07'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '137',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '59070489150',
                                                                       'in_ucast_pkts': '111896680',
                                                                       'links': [       {       'in_discards': '137',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '59070489150',
                                                                                                'in_ucast_pkts': '111896680',
                                                                                                'mac_address': '48:8f:5a:bf:4f:c7',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '8818468778',
                                                                                                'out_ucast_pkts': '93705992'}],
                                                                       'mac_address': '48:8f:5a:80:67:31',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '8818468778',
                                                                       'out_ucast_pkts': '93705992',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 154,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4f:c7',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60ESE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '8818468778',
                                                                       'in_ucast_pkts': '93705992',
                                                                       'mac_address': '48:8f:5a:80:67:30',
                                                                       'name': 'ether1',
                                                                       'out_octets': '59070489150',
                                                                       'out_ucast_pkts': '111896680',
                                                                       'poller_hash': 'NDg4ZjVhODA2NzMxZXRoZXIx'}],
                                         'poller_hash': 'SI9agGcx',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': '48:8f:5a:80:67:30'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '213',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '135295194804',
                                                                       'in_ucast_pkts': '111777352',
                                                                       'links': [       {       'in_discards': '213',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '135295194804',
                                                                                                'in_ucast_pkts': '111777352',
                                                                                                'mac_address': '48:8f:5a:bf:4f:c7',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '5471090104',
                                                                                                'out_ucast_pkts': '44614695'}],
                                                                       'mac_address': '48:8f:5a:51:e3:82',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '5471090104',
                                                                       'out_ucast_pkts': '44614695',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 210,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4f:c7',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60ESE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '5471090104',
                                                                       'in_ucast_pkts': '44614695',
                                                                       'name': 'ether1',
                                                                       'out_octets': '135295194804',
                                                                       'out_ucast_pkts': '111777352',
                                                                       'poller_hash': 'NDg4ZjVhNTFlMzgyZXRoZXIx'}],
                                         'poller_hash': 'SI9aUeOC',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_46_8_02(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.46.8.02")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 8,
                'sw_version': '6.46.8',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 2333939688807,
                'dl_en_packets': 1680334268,
                'dl_noise_floor': None,
                'dl_rf_bytes': 2335381090640,
                'dl_rf_packets': 1917436738,
                'en_if_speed': 1000000000,
                'mem': 19.8638916015625,
                'serial_number': 'D6940C1D1622',
                'ssid': 'NU6-60NE',
                'system_mac_address': '48:8f:5a:bf:4a:a2',
                'ul_en_bytes': 102575750758,
                'ul_en_packets': 638921362,
                'ul_noise_floor': None,
                'ul_rf_bytes': 108963905115,
                'ul_rf_packets': 852777929
        }
        exp_sta_stats = {
                '48:8f:5a:51:cc:7d': {       'alt_macs': {'48:8f:5a:51:cc:7c'},
                                             'dev_macs': {       '48:8f:5a:bf:4a:a3',
                                                                 'cc:2d:e0:66:75:54'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:51:cc:7d',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -149.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -54,
                                             'ul_snr': 95},
                '48:8f:5a:51:d0:6b': {       'alt_macs': None,
                                             'dev_macs': {'74:4d:28:17:6d:77'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:51:d0:6b',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -148.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -53,
                                             'ul_snr': 95},
                '48:8f:5a:51:fb:aa': {       'alt_macs': None,
                                             'dev_macs': {'74:4d:28:52:61:c3'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:51:fb:aa',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -151.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -56,
                                             'ul_snr': 95},
                '48:8f:5a:51:fc:ab': {       'alt_macs': {'48:8f:5a:51:fc:aa'},
                                             'dev_macs': {'48:8f:5a:93:ac:c6'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:51:fc:ab',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -148.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -53,
                                             'ul_snr': 95},
                '48:8f:5a:52:1b:ea': {       'alt_macs': None,
                                             'dev_macs': {'74:4d:28:c4:14:93'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:52:1b:ea',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -138.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -58,
                                             'ul_snr': 80},
                '48:8f:5a:52:1d:04': {       'alt_macs': None,
                                             'dev_macs': {'74:4d:28:52:67:b7'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:52:1d:04',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -148.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -53,
                                             'ul_snr': 95},
                '48:8f:5a:80:67:b6': {       'alt_macs': None,
                                             'dev_macs': {'74:4d:28:17:6d:0e'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:80:67:b6',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -146.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -51,
                                             'ul_snr': 95},
                '48:8f:5a:80:68:f1': {       'alt_macs': None,
                                             'dev_macs': {'08:55:31:66:2a:3e'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:80:68:f1',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -151.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -56,
                                             'ul_snr': 95}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '108963905115',
                                                              'in_ucast_pkts': '852777929',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '74:4d:28:52:67:b7'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '11532450218',
                                                                                       'in_ucast_pkts': '127312942',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:52:1d:04',
                                                                                       'out_discards': '85',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '370388493177',
                                                                                       'out_ucast_pkts': '278746579'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:c4:14:93'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '33605048689',
                                                                                       'in_ucast_pkts': '215651127',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:52:1b:ea',
                                                                                       'out_discards': '72',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '766395444708',
                                                                                       'out_ucast_pkts': '565502183'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:52:61:c3'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '10046078403',
                                                                                       'in_ucast_pkts': '93897060',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:51:fb:aa',
                                                                                       'out_discards': '171',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '220416472179',
                                                                                       'out_ucast_pkts': '179504833'},
                                                                               {       'bridged_mac_addresses': [       '08:55:31:66:2a:3e'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '587899422',
                                                                                       'in_ucast_pkts': '2241203',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:80:68:f1',
                                                                                       'out_discards': '157',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '596237054',
                                                                                       'out_ucast_pkts': '2015744'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:17:6d:0e'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '562295625',
                                                                                       'in_ucast_pkts': '1131477',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:80:67:b6',
                                                                                       'out_discards': '31',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '140788269',
                                                                                       'out_ucast_pkts': '648439'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:17:6d:77'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '31035680796',
                                                                                       'in_ucast_pkts': '179911894',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:51:d0:6b',
                                                                                       'out_discards': '131',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '327869086352',
                                                                                       'out_ucast_pkts': '309149607'},
                                                                               {       'bridged_mac_addresses': [       '48:8f:5a:bf:4a:a3',
                                                                                                                        'cc:2d:e0:66:75:54'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '10383981584',
                                                                                       'in_ucast_pkts': '100306996',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:51:cc:7d',
                                                                                       'out_discards': '120',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '176123257048',
                                                                                       'out_ucast_pkts': '196034063'},
                                                                               {       'bridged_mac_addresses': [       '48:8f:5a:93:ac:c6'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '11210470378',
                                                                                       'in_ucast_pkts': '132325230',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:51:fc:ab',
                                                                                       'out_discards': '235',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '473451311853',
                                                                                       'out_ucast_pkts': '385835290'}],
                                                              'mac_address': '48:8f:5a:bf:4a:a3',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '1002',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '2335381090640',
                                                              'out_ucast_pkts': '1917436738',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 136,
                                                                                                                                            'mac_address': '48:8f:5a:52:1d:04',
                                                                                                                                            'noise_floor': -148.0,
                                                                                                                                            'rssi': -53.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 206,
                                                                                                                                            'mac_address': '48:8f:5a:52:1b:ea',
                                                                                                                                            'noise_floor': -138.0,
                                                                                                                                            'rssi': -58.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 152,
                                                                                                                                            'mac_address': '48:8f:5a:51:fb:aa',
                                                                                                                                            'noise_floor': -151.0,
                                                                                                                                            'rssi': -56.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 166,
                                                                                                                                            'mac_address': '48:8f:5a:80:68:f1',
                                                                                                                                            'noise_floor': -151.0,
                                                                                                                                            'rssi': -56.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 88,
                                                                                                                                            'mac_address': '48:8f:5a:80:67:b6',
                                                                                                                                            'noise_floor': -146.0,
                                                                                                                                            'rssi': -51.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 50,
                                                                                                                                            'mac_address': '48:8f:5a:51:d0:6b',
                                                                                                                                            'noise_floor': -148.0,
                                                                                                                                            'rssi': -53.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 64,
                                                                                                                                            'mac_address': '48:8f:5a:51:cc:7d',
                                                                                                                                            'noise_floor': -149.0,
                                                                                                                                            'rssi': -54.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 102,
                                                                                                                                            'mac_address': '48:8f:5a:51:fc:ab',
                                                                                                                                            'noise_floor': -148.0,
                                                                                                                                            'rssi': -53.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -138.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU6-60NE'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '3960272',
                                                              'in_octets': '2333939688807',
                                                              'in_ucast_pkts': '1676373996',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '48:8f:5a:bf:4a:a2',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '18232984',
                                                              'out_octets': '102575750758',
                                                              'out_ucast_pkts': '620688378',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 19.863892,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'SI9av0qj',
                                'serial_number': 'D6940C1D1622',
                                'sw_version': '6.46.8',
                                'system_mac_address': '48:8f:5a:bf:4a:a2',
                                'uptime': '6369769'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '85',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '370388493177',
                                                                       'in_ucast_pkts': '278746579',
                                                                       'links': [       {       'in_discards': '85',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '370388493177',
                                                                                                'in_ucast_pkts': '278746579',
                                                                                                'mac_address': '48:8f:5a:bf:4a:a3',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '11532450218',
                                                                                                'out_ucast_pkts': '127312942'}],
                                                                       'mac_address': '48:8f:5a:52:1d:04',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '11532450218',
                                                                       'out_ucast_pkts': '127312942',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 136,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4a:a3',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60NE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '11532450218',
                                                                       'in_ucast_pkts': '127312942',
                                                                       'name': 'ether1',
                                                                       'out_octets': '370388493177',
                                                                       'out_ucast_pkts': '278746579',
                                                                       'poller_hash': 'NDg4ZjVhNTIxZDA0ZXRoZXIx'}],
                                         'poller_hash': 'SI9aUh0E',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '72',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '766395444708',
                                                                       'in_ucast_pkts': '565502183',
                                                                       'links': [       {       'in_discards': '72',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '766395444708',
                                                                                                'in_ucast_pkts': '565502183',
                                                                                                'mac_address': '48:8f:5a:bf:4a:a3',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '33605048689',
                                                                                                'out_ucast_pkts': '215651127'}],
                                                                       'mac_address': '48:8f:5a:52:1b:ea',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '33605048689',
                                                                       'out_ucast_pkts': '215651127',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 206,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4a:a3',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60NE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '33605048689',
                                                                       'in_ucast_pkts': '215651127',
                                                                       'name': 'ether1',
                                                                       'out_octets': '766395444708',
                                                                       'out_ucast_pkts': '565502183',
                                                                       'poller_hash': 'NDg4ZjVhNTIxYmVhZXRoZXIx'}],
                                         'poller_hash': 'SI9aUhvq',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '171',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '220416472179',
                                                                       'in_ucast_pkts': '179504833',
                                                                       'links': [       {       'in_discards': '171',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '220416472179',
                                                                                                'in_ucast_pkts': '179504833',
                                                                                                'mac_address': '48:8f:5a:bf:4a:a3',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '10046078403',
                                                                                                'out_ucast_pkts': '93897060'}],
                                                                       'mac_address': '48:8f:5a:51:fb:aa',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '10046078403',
                                                                       'out_ucast_pkts': '93897060',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 152,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4a:a3',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60NE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '10046078403',
                                                                       'in_ucast_pkts': '93897060',
                                                                       'name': 'ether1',
                                                                       'out_octets': '220416472179',
                                                                       'out_ucast_pkts': '179504833',
                                                                       'poller_hash': 'NDg4ZjVhNTFmYmFhZXRoZXIx'}],
                                         'poller_hash': 'SI9aUfuq',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '157',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '596237054',
                                                                       'in_ucast_pkts': '2015744',
                                                                       'links': [       {       'in_discards': '157',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '596237054',
                                                                                                'in_ucast_pkts': '2015744',
                                                                                                'mac_address': '48:8f:5a:bf:4a:a3',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '587899422',
                                                                                                'out_ucast_pkts': '2241203'}],
                                                                       'mac_address': '48:8f:5a:80:68:f1',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '587899422',
                                                                       'out_ucast_pkts': '2241203',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 166,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4a:a3',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60NE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '587899422',
                                                                       'in_ucast_pkts': '2241203',
                                                                       'name': 'ether1',
                                                                       'out_octets': '596237054',
                                                                       'out_ucast_pkts': '2015744',
                                                                       'poller_hash': 'NDg4ZjVhODA2OGYxZXRoZXIx'}],
                                         'poller_hash': 'SI9agGjx',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '31',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '140788269',
                                                                       'in_ucast_pkts': '648439',
                                                                       'links': [       {       'in_discards': '31',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '140788269',
                                                                                                'in_ucast_pkts': '648439',
                                                                                                'mac_address': '48:8f:5a:bf:4a:a3',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '562295625',
                                                                                                'out_ucast_pkts': '1131477'}],
                                                                       'mac_address': '48:8f:5a:80:67:b6',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '562295625',
                                                                       'out_ucast_pkts': '1131477',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 88,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4a:a3',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60NE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '562295625',
                                                                       'in_ucast_pkts': '1131477',
                                                                       'name': 'ether1',
                                                                       'out_octets': '140788269',
                                                                       'out_ucast_pkts': '648439',
                                                                       'poller_hash': 'NDg4ZjVhODA2N2I2ZXRoZXIx'}],
                                         'poller_hash': 'SI9agGe2',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '131',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '327869086352',
                                                                       'in_ucast_pkts': '309149607',
                                                                       'links': [       {       'in_discards': '131',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '327869086352',
                                                                                                'in_ucast_pkts': '309149607',
                                                                                                'mac_address': '48:8f:5a:bf:4a:a3',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '31035680796',
                                                                                                'out_ucast_pkts': '179911894'}],
                                                                       'mac_address': '48:8f:5a:51:d0:6b',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '31035680796',
                                                                       'out_ucast_pkts': '179911894',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 50,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4a:a3',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60NE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '31035680796',
                                                                       'in_ucast_pkts': '179911894',
                                                                       'name': 'ether1',
                                                                       'out_octets': '327869086352',
                                                                       'out_ucast_pkts': '309149607',
                                                                       'poller_hash': 'NDg4ZjVhNTFkMDZiZXRoZXIx'}],
                                         'poller_hash': 'SI9aUdBr',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '120',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '176123257048',
                                                                       'in_ucast_pkts': '196034063',
                                                                       'links': [       {       'in_discards': '120',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '176123257048',
                                                                                                'in_ucast_pkts': '196034063',
                                                                                                'mac_address': '48:8f:5a:bf:4a:a3',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '10383981584',
                                                                                                'out_ucast_pkts': '100306996'}],
                                                                       'mac_address': '48:8f:5a:51:cc:7d',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '10383981584',
                                                                       'out_ucast_pkts': '100306996',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 64,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4a:a3',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60NE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '10383981584',
                                                                       'in_ucast_pkts': '100306996',
                                                                       'mac_address': '48:8f:5a:51:cc:7c',
                                                                       'name': 'ether1',
                                                                       'out_octets': '176123257048',
                                                                       'out_ucast_pkts': '196034063',
                                                                       'poller_hash': 'NDg4ZjVhNTFjYzdkZXRoZXIx'}],
                                         'poller_hash': 'SI9aUcx9',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': '48:8f:5a:51:cc:7c'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '235',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '473451311853',
                                                                       'in_ucast_pkts': '385835290',
                                                                       'links': [       {       'in_discards': '235',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '473451311853',
                                                                                                'in_ucast_pkts': '385835290',
                                                                                                'mac_address': '48:8f:5a:bf:4a:a3',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '11210470378',
                                                                                                'out_ucast_pkts': '132325230'}],
                                                                       'mac_address': '48:8f:5a:51:fc:ab',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '11210470378',
                                                                       'out_ucast_pkts': '132325230',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 102,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4a:a3',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60NE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '11210470378',
                                                                       'in_ucast_pkts': '132325230',
                                                                       'mac_address': '48:8f:5a:51:fc:aa',
                                                                       'name': 'ether1',
                                                                       'out_octets': '473451311853',
                                                                       'out_ucast_pkts': '385835290',
                                                                       'poller_hash': 'NDg4ZjVhNTFmY2FiZXRoZXIx'}],
                                         'poller_hash': 'SI9aUfyr',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': '48:8f:5a:51:fc:aa'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_46_8_03(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.46.8.03")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 2,
                'sw_version': '6.46.8',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 392102838704,
                'dl_en_packets': 302168376,
                'dl_noise_floor': None,
                'dl_rf_bytes': 391988583854,
                'dl_rf_packets': 348142392,
                'en_if_speed': 1000000000,
                'mem': 19.45343017578125,
                'serial_number': 'D6940C318484',
                'ssid': 'NU6-60S',
                'system_mac_address': '48:8f:5a:bf:4f:be',
                'ul_en_bytes': 21901438295,
                'ul_en_packets': 108151290,
                'ul_noise_floor': None,
                'ul_rf_bytes': 23118243588,
                'ul_rf_packets': 149148668
        }
        exp_sta_stats = {
                '48:8f:5a:51:eb:ae': {       'alt_macs': {'48:8f:5a:51:eb:ad'},
                                             'dev_macs': {       '48:8f:5a:bf:4f:bf',
                                                                 '74:4d:28:c4:25:a4'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:51:eb:ae',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -142.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -62,
                                             'ul_snr': 80},
                '48:8f:5a:51:ef:da': {       'alt_macs': {'48:8f:5a:51:ef:d9'},
                                             'dev_macs': {'64:d1:54:6d:2e:14'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:51:ef:da',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -147.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -52,
                                             'ul_snr': 95}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '23118243588',
                                                              'in_ucast_pkts': '149148668',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '64:d1:54:6d:2e:14'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '20625578612',
                                                                                       'in_ucast_pkts': '126840367',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:51:ef:da',
                                                                                       'out_discards': '1943',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '357931876390',
                                                                                       'out_ucast_pkts': '314558990'},
                                                                               {       'bridged_mac_addresses': [       '48:8f:5a:bf:4f:bf',
                                                                                                                        '74:4d:28:c4:25:a4'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '2279061250',
                                                                                       'in_ucast_pkts': '22091619',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:51:eb:ae',
                                                                                       'out_discards': '208',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '34021530464',
                                                                                       'out_ucast_pkts': '33548225'}],
                                                              'mac_address': '48:8f:5a:bf:4f:bf',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '2273',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '391988583854',
                                                              'out_ucast_pkts': '348142392',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 41,
                                                                                                                                            'mac_address': '48:8f:5a:51:ef:da',
                                                                                                                                            'noise_floor': -147.0,
                                                                                                                                            'rssi': -52.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 296,
                                                                                                                                            'mac_address': '48:8f:5a:51:eb:ae',
                                                                                                                                            'noise_floor': -142.0,
                                                                                                                                            'rssi': -62.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -142.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU6-60S'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '4446135',
                                                              'in_octets': '392102838704',
                                                              'in_ucast_pkts': '297722241',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '48:8f:5a:bf:4f:be',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '8452125',
                                                              'out_octets': '21901438295',
                                                              'out_ucast_pkts': '99699165',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 19.45343,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'SI9av0+/',
                                'serial_number': 'D6940C318484',
                                'sw_version': '6.46.8',
                                'system_mac_address': '48:8f:5a:bf:4f:be',
                                'uptime': '8713640'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1943',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '357931876390',
                                                                       'in_ucast_pkts': '314558990',
                                                                       'links': [       {       'in_discards': '1943',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '357931876390',
                                                                                                'in_ucast_pkts': '314558990',
                                                                                                'mac_address': '48:8f:5a:bf:4f:bf',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '20625578612',
                                                                                                'out_ucast_pkts': '126840367'}],
                                                                       'mac_address': '48:8f:5a:51:ef:da',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '20625578612',
                                                                       'out_ucast_pkts': '126840367',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 41,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4f:bf',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60S'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '20625578612',
                                                                       'in_ucast_pkts': '126840367',
                                                                       'mac_address': '48:8f:5a:51:ef:d9',
                                                                       'name': 'ether1',
                                                                       'out_octets': '357931876390',
                                                                       'out_ucast_pkts': '314558990',
                                                                       'poller_hash': 'NDg4ZjVhNTFlZmRhZXRoZXIx'}],
                                         'poller_hash': 'SI9aUe/a',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': '48:8f:5a:51:ef:d9'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '208',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '34021530464',
                                                                       'in_ucast_pkts': '33548225',
                                                                       'links': [       {       'in_discards': '208',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '34021530464',
                                                                                                'in_ucast_pkts': '33548225',
                                                                                                'mac_address': '48:8f:5a:bf:4f:bf',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '2279061250',
                                                                                                'out_ucast_pkts': '22091619'}],
                                                                       'mac_address': '48:8f:5a:51:eb:ae',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '2279061250',
                                                                       'out_ucast_pkts': '22091619',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 296,
                                                                                                                                                     'mac_address': '48:8f:5a:bf:4f:bf',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU6-60S'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '2279061250',
                                                                       'in_ucast_pkts': '22091619',
                                                                       'mac_address': '48:8f:5a:51:eb:ad',
                                                                       'name': 'ether1',
                                                                       'out_octets': '34021530464',
                                                                       'out_ucast_pkts': '33548225',
                                                                       'poller_hash': 'NDg4ZjVhNTFlYmFlZXRoZXIx'}],
                                         'poller_hash': 'SI9aUeuu',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': '48:8f:5a:51:eb:ad'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_47_9_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.47.9.01")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 4,
                'sw_version': '6.47.9',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 128721786629,
                'dl_en_packets': 116611089,
                'dl_noise_floor': None,
                'dl_rf_bytes': 128476604341,
                'dl_rf_packets': 122450058,
                'en_if_speed': 1000000000,
                'mem': 20.82366943359375,
                'serial_number': '8AA508507E63',
                'ssid': 'NU1-ENE60G',
                'system_mac_address': 'cc:2d:e0:b9:49:e1',
                'ul_en_bytes': 39144316432,
                'ul_en_packets': 89692620,
                'ul_noise_floor': None,
                'ul_rf_bytes': 38975305317,
                'ul_rf_packets': 94962793
        }
        exp_sta_stats = {
                '04:d6:aa:a8:d4:a0': {       'alt_macs': None,
                                             'dev_macs': {       '04:d6:aa:b1:15:e7',
                                                                 '98:de:d0:dc:93:83',
                                                                 'b8:69:f4:33:21:af'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.102.2.233',
                                             'mac_address': '04:d6:aa:a8:d4:a0',
                                             'name': '1/1 First St',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -150.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -55,
                                             'ul_snr': 95},
                '24:18:1d:99:66:94': {       'alt_macs': None,
                                             'dev_macs': {       '74:4d:28:17:44:a8',
                                                                 'b8:69:f4:3f:9b:7e'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.102.2.216',
                                             'mac_address': '24:18:1d:99:66:94',
                                             'name': '24A Murray St',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -141.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -61,
                                             'ul_snr': 80},
                '24:18:1d:99:68:91': {       'alt_macs': None,
                                             'dev_macs': {       '0c:8d:db:df:68:25',
                                                                 'b8:69:f4:3f:9c:11'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.102.3.188',
                                             'mac_address': '24:18:1d:99:68:91',
                                             'name': '2/1 First St',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -152.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -57,
                                             'ul_snr': 95},
                '48:8f:5a:52:1b:fe': {       'alt_macs': {'48:8f:5a:52:1b:fd'},
                                             'dev_macs': {'08:55:31:36:bc:49'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.102.2.224',
                                             'mac_address': '48:8f:5a:52:1b:fe',
                                             'name': '2/33 Murray st',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -138.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -58,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '38975305317',
                                                              'in_ucast_pkts': '94962793',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '08:55:31:36:bc:49'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '17397409742',
                                                                                       'in_ucast_pkts': '23599963',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:52:1b:fe',
                                                                                       'out_discards': '30',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '24289810997',
                                                                                       'out_ucast_pkts': '26228973'},
                                                                               {       'bridged_mac_addresses': [       '04:d6:aa:b1:15:e7',
                                                                                                                        '98:de:d0:dc:93:83',
                                                                                                                        'b8:69:f4:33:21:af'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '1337745331',
                                                                                       'in_ucast_pkts': '7012916',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d4:a0',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '6855118861',
                                                                                       'out_ucast_pkts': '9212055'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:17:44:a8',
                                                                                                                        'b8:69:f4:3f:9b:7e'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '4310925428',
                                                                                       'in_ucast_pkts': '8409687',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:66:94',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '5423076867',
                                                                                       'out_ucast_pkts': '9872875'},
                                                                               {       'bridged_mac_addresses': [       '0c:8d:db:df:68:25',
                                                                                                                        'b8:69:f4:3f:9c:11'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '15929224816',
                                                                                       'in_ucast_pkts': '55940227',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:68:91',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '91908597616',
                                                                                       'out_ucast_pkts': '77136155'}],
                                                              'mac_address': '04:d6:aa:b1:15:e7',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '30',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '128476604341',
                                                              'out_ucast_pkts': '122450058',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 180,
                                                                                                                                            'mac_address': '48:8f:5a:52:1b:fe',
                                                                                                                                            'noise_floor': -138.0,
                                                                                                                                            'rssi': -58.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 157,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d4:a0',
                                                                                                                                            'noise_floor': -150.0,
                                                                                                                                            'rssi': -55.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 253,
                                                                                                                                            'mac_address': '24:18:1d:99:66:94',
                                                                                                                                            'noise_floor': -141.0,
                                                                                                                                            'rssi': -61.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 157,
                                                                                                                                            'mac_address': '24:18:1d:99:68:91',
                                                                                                                                            'noise_floor': -152.0,
                                                                                                                                            'rssi': -57.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -138.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU1-ENE60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '148943',
                                                              'in_octets': '128721786629',
                                                              'in_ucast_pkts': '116462146',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:b9:49:e1',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '592075',
                                                              'out_octets': '39144316432',
                                                              'out_ucast_pkts': '89100545',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.82367,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'BNaqsRXn',
                                'serial_number': '8AA508507E63',
                                'sw_version': '6.47.9',
                                'system_mac_address': 'cc:2d:e0:b9:49:e1',
                                'uptime': '257404'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '30',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '24289810997',
                                                                       'in_ucast_pkts': '26228973',
                                                                       'links': [       {       'in_discards': '30',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '24289810997',
                                                                                                'in_ucast_pkts': '26228973',
                                                                                                'mac_address': '04:d6:aa:b1:15:e7',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '17397409742',
                                                                                                'out_ucast_pkts': '23599963'}],
                                                                       'mac_address': '48:8f:5a:52:1b:fe',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '17397409742',
                                                                       'out_ucast_pkts': '23599963',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 180,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:15:e7',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-ENE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '17397409742',
                                                                       'in_ucast_pkts': '23599963',
                                                                       'mac_address': '48:8f:5a:52:1b:fd',
                                                                       'name': 'ether1',
                                                                       'out_octets': '24289810997',
                                                                       'out_ucast_pkts': '26228973',
                                                                       'poller_hash': 'NDg4ZjVhNTIxYmZlZXRoZXIx'}],
                                         'management_ip': '10.102.2.224',
                                         'manufacturer': 'Mikrotik',
                                         'name': '2/33 Murray st',
                                         'poller_hash': 'SI9aUhv+',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.46.6',
                                         'system_mac_address': '48:8f:5a:52:1b:fd'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '6855118861',
                                                                       'in_ucast_pkts': '9212055',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '6855118861',
                                                                                                'in_ucast_pkts': '9212055',
                                                                                                'mac_address': '04:d6:aa:b1:15:e7',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '1337745331',
                                                                                                'out_ucast_pkts': '7012916'}],
                                                                       'mac_address': '04:d6:aa:a8:d4:a0',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '1337745331',
                                                                       'out_ucast_pkts': '7012916',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 157,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:15:e7',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-ENE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '1337745331',
                                                                       'in_ucast_pkts': '7012916',
                                                                       'name': 'ether1',
                                                                       'out_octets': '6855118861',
                                                                       'out_ucast_pkts': '9212055',
                                                                       'poller_hash': 'MDRkNmFhYThkNGEwZXRoZXIx'}],
                                         'management_ip': '10.102.2.233',
                                         'manufacturer': 'Mikrotik',
                                         'name': '1/1 First St',
                                         'poller_hash': 'BNaqqNSg',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.47.9'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '5423076867',
                                                                       'in_ucast_pkts': '9872875',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '5423076867',
                                                                                                'in_ucast_pkts': '9872875',
                                                                                                'mac_address': '04:d6:aa:b1:15:e7',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '4310925428',
                                                                                                'out_ucast_pkts': '8409687'}],
                                                                       'mac_address': '24:18:1d:99:66:94',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '4310925428',
                                                                       'out_ucast_pkts': '8409687',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 253,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:15:e7',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-ENE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '4310925428',
                                                                       'in_ucast_pkts': '8409687',
                                                                       'name': 'ether1',
                                                                       'out_octets': '5423076867',
                                                                       'out_ucast_pkts': '9872875',
                                                                       'poller_hash': 'MjQxODFkOTk2Njk0ZXRoZXIx'}],
                                         'management_ip': '10.102.2.216',
                                         'manufacturer': 'Mikrotik',
                                         'name': '24A Murray St',
                                         'poller_hash': 'JBgdmWaU',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.47.9'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '91908597616',
                                                                       'in_ucast_pkts': '77136155',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '91908597616',
                                                                                                'in_ucast_pkts': '77136155',
                                                                                                'mac_address': '04:d6:aa:b1:15:e7',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '15929224816',
                                                                                                'out_ucast_pkts': '55940227'}],
                                                                       'mac_address': '24:18:1d:99:68:91',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '15929224816',
                                                                       'out_ucast_pkts': '55940227',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 157,
                                                                                                                                                     'mac_address': '04:d6:aa:b1:15:e7',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-ENE60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '15929224816',
                                                                       'in_ucast_pkts': '55940227',
                                                                       'name': 'ether1',
                                                                       'out_octets': '91908597616',
                                                                       'out_ucast_pkts': '77136155',
                                                                       'poller_hash': 'MjQxODFkOTk2ODkxZXRoZXIx'}],
                                         'management_ip': '10.102.3.188',
                                         'manufacturer': 'Mikrotik',
                                         'name': '2/1 First St',
                                         'poller_hash': 'JBgdmWiR',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.47.9'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_47_9_02(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.47.9.02")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 4,
                'sw_version': '6.47.9',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 160264501212,
                'dl_en_packets': 229930330,
                'dl_noise_floor': None,
                'dl_rf_bytes': 160072016485,
                'dl_rf_packets': 251541068,
                'en_if_speed': 1000000000,
                'mem': 20.7611083984375,
                'serial_number': 'BF950B418226',
                'ssid': 'NU1-SW60G',
                'system_mac_address': 'c4:ad:34:7c:d3:22',
                'ul_en_bytes': 181696467965,
                'ul_en_packets': 214291489,
                'ul_noise_floor': None,
                'ul_rf_bytes': 181127421282,
                'ul_rf_packets': 234817372
        }
        exp_sta_stats = {
                '24:18:1d:99:65:82': {       'alt_macs': None,
                                             'dev_macs': {'74:4d:28:52:89:e8'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.102.2.110',
                                             'mac_address': '24:18:1d:99:65:82',
                                             'name': '15 Corella St',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -131.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -66,
                                             'ul_snr': 65},
                '24:18:1d:9a:93:1e': {       'alt_macs': None,
                                             'dev_macs': {       'c4:ad:34:7c:d3:23',
                                                                 'cc:2d:e0:22:62:7a'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.102.2.255',
                                             'mac_address': '24:18:1d:9a:93:1e',
                                             'name': '2 Warnecke St',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -128.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -63,
                                             'ul_snr': 65},
                '48:8f:5a:51:c4:d0': {       'alt_macs': {'48:8f:5a:51:c4:cf'},
                                             'dev_macs': {'00:1d:aa:5c:66:32'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.102.2.246',
                                             'mac_address': '48:8f:5a:51:c4:d0',
                                             'name': '24 Gawler St',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -144.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -64,
                                             'ul_snr': 80},
                '48:8f:5a:51:d0:93': {       'alt_macs': {'48:8f:5a:51:d0:92'},
                                             'dev_macs': {'48:8f:5a:0a:98:cc'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:51:d0:93',
                                             'name': '6 Corella St',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -141.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -61,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '482132',
                                                              'in_octets': '160264501212',
                                                              'in_ucast_pkts': '229448198',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'c4:ad:34:7c:d3:22',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '1915324',
                                                              'out_octets': '181696467965',
                                                              'out_ucast_pkts': '212376165',
                                                              'speed': '1000000000',
                                                              'type': 6},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '181127421282',
                                                              'in_ucast_pkts': '234817372',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '00:1d:aa:5c:66:32'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '172122858579',
                                                                                       'in_ucast_pkts': '169532440',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:51:c4:d0',
                                                                                       'out_discards': '11',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '35365038329',
                                                                                       'out_ucast_pkts': '134690921'},
                                                                               {       'bridged_mac_addresses': [       '48:8f:5a:0a:98:cc'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '7033741587',
                                                                                       'in_ucast_pkts': '39053470',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:51:d0:93',
                                                                                       'out_discards': '157',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '104400090654',
                                                                                       'out_ucast_pkts': '85532631'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:52:89:e8'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '1218533695',
                                                                                       'in_ucast_pkts': '12836968',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:65:82',
                                                                                       'out_discards': '2',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '10874263003',
                                                                                       'out_ucast_pkts': '16323464'},
                                                                               {       'bridged_mac_addresses': [       'c4:ad:34:7c:d3:23',
                                                                                                                        'cc:2d:e0:22:62:7a'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '752287421',
                                                                                       'in_ucast_pkts': '13394494',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:9a:93:1e',
                                                                                       'out_discards': '1',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '9432624499',
                                                                                       'out_ucast_pkts': '14994052'}],
                                                              'mac_address': 'c4:ad:34:7c:d3:23',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '171',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '160072016485',
                                                              'out_ucast_pkts': '251541068',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 148,
                                                                                                                                            'mac_address': '48:8f:5a:51:c4:d0',
                                                                                                                                            'noise_floor': -144.0,
                                                                                                                                            'rssi': -64.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 320,
                                                                                                                                            'mac_address': '48:8f:5a:51:d0:93',
                                                                                                                                            'noise_floor': -141.0,
                                                                                                                                            'rssi': -61.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 415,
                                                                                                                                            'mac_address': '24:18:1d:99:65:82',
                                                                                                                                            'noise_floor': -131.0,
                                                                                                                                            'rssi': -66.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 200,
                                                                                                                                            'mac_address': '24:18:1d:9a:93:1e',
                                                                                                                                            'noise_floor': -128.0,
                                                                                                                                            'rssi': -63.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -128.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU1-SW60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.761108,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'xK00fNMj',
                                'serial_number': 'BF950B418226',
                                'sw_version': '6.47.9',
                                'system_mac_address': 'c4:ad:34:7c:d3:22',
                                'uptime': '828962'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '11',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '35365038329',
                                                                       'in_ucast_pkts': '134690921',
                                                                       'links': [       {       'in_discards': '11',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '35365038329',
                                                                                                'in_ucast_pkts': '134690921',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:23',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '172122858579',
                                                                                                'out_ucast_pkts': '169532440'}],
                                                                       'mac_address': '48:8f:5a:51:c4:d0',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '172122858579',
                                                                       'out_ucast_pkts': '169532440',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 148,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:23',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-SW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '172122858579',
                                                                       'in_ucast_pkts': '169532440',
                                                                       'mac_address': '48:8f:5a:51:c4:cf',
                                                                       'name': 'ether1',
                                                                       'out_octets': '35365038329',
                                                                       'out_ucast_pkts': '134690921',
                                                                       'poller_hash': 'NDg4ZjVhNTFjNGQwZXRoZXIx'}],
                                         'management_ip': '10.102.2.246',
                                         'manufacturer': 'Mikrotik',
                                         'name': '24 Gawler St',
                                         'poller_hash': 'SI9aUcTQ',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.46.6',
                                         'system_mac_address': '48:8f:5a:51:c4:cf'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '157',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '104400090654',
                                                                       'in_ucast_pkts': '85532631',
                                                                       'links': [       {       'in_discards': '157',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '104400090654',
                                                                                                'in_ucast_pkts': '85532631',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:23',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '7033741587',
                                                                                                'out_ucast_pkts': '39053470'}],
                                                                       'mac_address': '48:8f:5a:51:d0:93',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '7033741587',
                                                                       'out_ucast_pkts': '39053470',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 320,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:23',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-SW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '7033741587',
                                                                       'in_ucast_pkts': '39053470',
                                                                       'mac_address': '48:8f:5a:51:d0:92',
                                                                       'name': 'ether1',
                                                                       'out_octets': '104400090654',
                                                                       'out_ucast_pkts': '85532631',
                                                                       'poller_hash': 'NDg4ZjVhNTFkMDkzZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': '6 Corella St',
                                         'poller_hash': 'SI9aUdCT',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.47.9',
                                         'system_mac_address': '48:8f:5a:51:d0:92'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '2',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '10874263003',
                                                                       'in_ucast_pkts': '16323464',
                                                                       'links': [       {       'in_discards': '2',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '10874263003',
                                                                                                'in_ucast_pkts': '16323464',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:23',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '1218533695',
                                                                                                'out_ucast_pkts': '12836968'}],
                                                                       'mac_address': '24:18:1d:99:65:82',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '1218533695',
                                                                       'out_ucast_pkts': '12836968',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 415,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:23',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-SW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '1218533695',
                                                                       'in_ucast_pkts': '12836968',
                                                                       'name': 'ether1',
                                                                       'out_octets': '10874263003',
                                                                       'out_ucast_pkts': '16323464',
                                                                       'poller_hash': 'MjQxODFkOTk2NTgyZXRoZXIx'}],
                                         'management_ip': '10.102.2.110',
                                         'manufacturer': 'Mikrotik',
                                         'name': '15 Corella St',
                                         'poller_hash': 'JBgdmWWC',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.45.8'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '9432624499',
                                                                       'in_ucast_pkts': '14994052',
                                                                       'links': [       {       'in_discards': '1',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '9432624499',
                                                                                                'in_ucast_pkts': '14994052',
                                                                                                'mac_address': 'c4:ad:34:7c:d3:23',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '752287421',
                                                                                                'out_ucast_pkts': '13394494'}],
                                                                       'mac_address': '24:18:1d:9a:93:1e',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '752287421',
                                                                       'out_ucast_pkts': '13394494',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 200,
                                                                                                                                                     'mac_address': 'c4:ad:34:7c:d3:23',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU1-SW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '752287421',
                                                                       'in_ucast_pkts': '13394494',
                                                                       'name': 'ether1',
                                                                       'out_octets': '9432624499',
                                                                       'out_ucast_pkts': '14994052',
                                                                       'poller_hash': 'MjQxODFkOWE5MzFlZXRoZXIx'}],
                                         'management_ip': '10.102.2.255',
                                         'manufacturer': 'Mikrotik',
                                         'name': '2 Warnecke St',
                                         'poller_hash': 'JBgdmpMe',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.45.8'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_47_9_03(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.47.9.03")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 0,
                'sw_version': '6.47.9',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 19048897,
                'dl_en_packets': 409968,
                'dl_noise_floor': None,
                'dl_rf_bytes': 0,
                'dl_rf_packets': 0,
                'en_if_speed': 1000000000,
                'mem': 18.83087158203125,
                'serial_number': 'D6940CBAA36D',
                'ssid': 'NU7-NE60G',
                'system_mac_address': '48:8f:5a:bf:50:b4',
                'ul_en_bytes': 10314427,
                'ul_en_packets': 43973,
                'ul_noise_floor': None,
                'ul_rf_bytes': 0,
                'ul_rf_packets': 0
        }
        exp_sta_stats = {
         
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '0',
                                                              'in_ucast_pkts': '0',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '48:8f:5a:bf:50:b5',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '0',
                                                              'out_ucast_pkts': '0',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1'}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU7-NE60G'}],
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '189929',
                                                              'in_octets': '19048897',
                                                              'in_ucast_pkts': '220039',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '48:8f:5a:bf:50:b4',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '7196',
                                                              'out_octets': '10314427',
                                                              'out_ucast_pkts': '36777',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 18.830872,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'SI9av1C1',
                                'serial_number': 'D6940CBAA36D',
                                'sw_version': '6.47.9',
                                'system_mac_address': '48:8f:5a:bf:50:b4',
                                'uptime': '139124'}
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_47_9_04(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.47.9.04")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 0,
                'sw_version': '6.47.9',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 18149202,
                'dl_en_packets': 400543,
                'dl_noise_floor': None,
                'dl_rf_bytes': 0,
                'dl_rf_packets': 0,
                'en_if_speed': 1000000000,
                'mem': 18.91937255859375,
                'serial_number': 'D6940C8B77F3',
                'ssid': 'NU7-S60G',
                'system_mac_address': '48:8f:5a:bf:4f:24',
                'ul_en_bytes': 10565500,
                'ul_en_packets': 38684,
                'ul_noise_floor': None,
                'ul_rf_bytes': 0,
                'ul_rf_packets': 0
        }
        exp_sta_stats = {
         
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '0',
                                                              'in_ucast_pkts': '0',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '48:8f:5a:bf:4f:25',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '0',
                                                              'out_ucast_pkts': '0',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1'}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU7-S60G'}],
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '187852',
                                                              'in_octets': '18149202',
                                                              'in_ucast_pkts': '212691',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '48:8f:5a:bf:4f:24',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '7204',
                                                              'out_octets': '10565500',
                                                              'out_ucast_pkts': '31480',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 18.919373,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'SI9av08l',
                                'serial_number': 'D6940C8B77F3',
                                'sw_version': '6.47.9',
                                'system_mac_address': '48:8f:5a:bf:4f:24',
                                'uptime': '137640'}
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_6_47_9_05(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.6.47.9.05")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 64800,
                'sta_count': 0,
                'sw_version': '6.47.9',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 17738315,
                'dl_en_packets': 386624,
                'dl_noise_floor': None,
                'dl_rf_bytes': 0,
                'dl_rf_packets': 0,
                'en_if_speed': 1000000000,
                'mem': 18.22662353515625,
                'serial_number': 'D6950CCD12D4',
                'ssid': 'NU7-WNW60G',
                'system_mac_address': '48:8f:5a:83:c3:08',
                'ul_en_bytes': 10590972,
                'ul_en_packets': 39111,
                'ul_noise_floor': None,
                'ul_rf_bytes': 0,
                'ul_rf_packets': 0
        }
        exp_sta_stats = {
         
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '0',
                                                              'in_ucast_pkts': '0',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '48:8f:5a:83:c3:09',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '0',
                                                              'out_ucast_pkts': '0',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 64800,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1'}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU7-WNW60G'}],
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '180604',
                                                              'in_octets': '17738315',
                                                              'in_ucast_pkts': '206020',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '48:8f:5a:83:c3:08',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '7253',
                                                              'out_octets': '10590972',
                                                              'out_ucast_pkts': '31858',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 18.226624,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'SI9ag8MJ',
                                'serial_number': 'D6950CCD12D4',
                                'sw_version': '6.47.9',
                                'system_mac_address': '48:8f:5a:83:c3:08',
                                'uptime': '138503'}
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_A_None_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-A.None.01")
        exp_info = {
                'model': 'RBwAPG-60ad-A',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 2,
                'sw_version': '6.44.5',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 106100252191,
                'dl_en_packets': 92362056,
                'dl_noise_floor': None,
                'dl_rf_bytes': 106142196223,
                'dl_rf_packets': 97402217,
                'en_if_speed': 1000000000,
                'mem': 21.6552734375,
                'serial_number': '8AA50864F3F4',
                'ssid': '324',
                'system_mac_address': 'cc:2d:e0:b9:42:f3',
                'ul_en_bytes': 7465787076,
                'ul_en_packets': 48304604,
                'ul_noise_floor': None,
                'ul_rf_bytes': 7440447014,
                'ul_rf_packets': 53040225
        }
        exp_sta_stats = {
                '24:18:1d:26:d1:ca': {       'alt_macs': None,
                                             'dev_macs': {       '24:18:1d:26:d6:86',
                                                                 '58:c1:7a:9e:46:87',
                                                                 '80:5e:c0:2e:9b:28',
                                                                 '94:57:a5:9a:f8:29',
                                                                 'cc:2d:e0:bc:40:af',
                                                                 'd4:ca:6d:35:4e:10'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.10.8.13',
                                             'mac_address': '24:18:1d:26:d1:ca',
                                             'name': 'South Bldg client',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -144.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -64,
                                             'ul_snr': 80},
                '24:18:1d:27:c8:67': {       'alt_macs': None,
                                             'dev_macs': {       '34:42:62:ab:5d:8e',
                                                                 '3c:5c:c4:d5:16:6f',
                                                                 '58:c1:7a:9d:80:8f',
                                                                 '58:c1:7a:9d:f6:63',
                                                                 '58:c1:7a:9d:f7:38',
                                                                 '58:c1:7a:9e:47:35',
                                                                 '5c:1d:d9:8c:6f:cc',
                                                                 '90:a2:5b:13:91:f0',
                                                                 'a4:08:ea:74:66:72',
                                                                 'a4:d9:31:ad:4d:17',
                                                                 'cc:2d:e0:bc:60:35',
                                                                 'd0:c5:f3:d8:5a:7a',
                                                                 'd0:d2:b0:01:a5:01',
                                                                 'd4:53:83:df:8d:f4',
                                                                 'd4:ca:6d:87:95:48',
                                                                 'f8:2d:7c:83:ca:3c'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.10.8.10',
                                             'mac_address': '24:18:1d:27:c8:67',
                                             'name': 'ManCamp 60ghz client',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -140.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -60,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '7440447014',
                                                              'in_ucast_pkts': '53040225',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '24:18:1d:26:d6:86',
                                                                                                                        '58:c1:7a:9e:46:87',
                                                                                                                        '80:5e:c0:2e:9b:28',
                                                                                                                        '94:57:a5:9a:f8:29',
                                                                                                                        'cc:2d:e0:bc:40:af',
                                                                                                                        'd4:ca:6d:35:4e:10'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '1878014192',
                                                                                       'in_ucast_pkts': '13139311',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:26:d1:ca',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '13635451074',
                                                                                       'out_ucast_pkts': '19181253'},
                                                                               {       'bridged_mac_addresses': [       '34:42:62:ab:5d:8e',
                                                                                                                        '3c:5c:c4:d5:16:6f',
                                                                                                                        '58:c1:7a:9d:80:8f',
                                                                                                                        '58:c1:7a:9d:f6:63',
                                                                                                                        '58:c1:7a:9d:f7:38',
                                                                                                                        '58:c1:7a:9e:47:35',
                                                                                                                        '5c:1d:d9:8c:6f:cc',
                                                                                                                        '90:a2:5b:13:91:f0',
                                                                                                                        'a4:08:ea:74:66:72',
                                                                                                                        'a4:d9:31:ad:4d:17',
                                                                                                                        'cc:2d:e0:bc:60:35',
                                                                                                                        'd0:c5:f3:d8:5a:7a',
                                                                                                                        'd0:d2:b0:01:a5:01',
                                                                                                                        'd4:53:83:df:8d:f4',
                                                                                                                        'd4:ca:6d:87:95:48',
                                                                                                                        'f8:2d:7c:83:ca:3c'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '5562432822',
                                                                                       'in_ucast_pkts': '39900914',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:27:c8:67',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '92506745149',
                                                                                       'out_ucast_pkts': '78220964'}],
                                                              'mac_address': '24:18:1d:26:d6:86',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '106142196223',
                                                              'out_ucast_pkts': '97402217',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 87,
                                                                                                                                            'mac_address': '24:18:1d:26:d1:ca',
                                                                                                                                            'noise_floor': -144.0,
                                                                                                                                            'rssi': -64.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 44,
                                                                                                                                            'mac_address': '24:18:1d:27:c8:67',
                                                                                                                                            'noise_floor': -140.0,
                                                                                                                                            'rssi': -60.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -140.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': '324'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '106100252191',
                                                              'in_ucast_pkts': '92362056',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:b9:42:f3',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '7465787076',
                                                              'out_ucast_pkts': '48304604',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.655273,
                                'model': 'RBwAPG-60ad-A',
                                'poller_hash': 'JBgdJtaG',
                                'serial_number': '8AA50864F3F4',
                                'sw_version': '6.44.5',
                                'system_mac_address': 'cc:2d:e0:b9:42:f3',
                                'uptime': '492154'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '13635451074',
                                                                       'in_ucast_pkts': '19181253',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '13635451074',
                                                                                                'in_ucast_pkts': '19181253',
                                                                                                'mac_address': '24:18:1d:26:d6:86',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '1878014192',
                                                                                                'out_ucast_pkts': '13139311'}],
                                                                       'mac_address': '24:18:1d:26:d1:ca',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '1878014192',
                                                                       'out_ucast_pkts': '13139311',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 87,
                                                                                                                                                     'mac_address': '24:18:1d:26:d6:86',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': '324'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '1878014192',
                                                                       'in_ucast_pkts': '13139311',
                                                                       'name': 'ether1',
                                                                       'out_octets': '13635451074',
                                                                       'out_ucast_pkts': '19181253',
                                                                       'poller_hash': 'MjQxODFkMjZkMWNhZXRoZXIx'}],
                                         'management_ip': '10.10.8.13',
                                         'manufacturer': 'Mikrotik',
                                         'name': 'South Bldg client',
                                         'poller_hash': 'JBgdJtHK',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.44.5'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '92506745149',
                                                                       'in_ucast_pkts': '78220964',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '92506745149',
                                                                                                'in_ucast_pkts': '78220964',
                                                                                                'mac_address': '24:18:1d:26:d6:86',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '5562432822',
                                                                                                'out_ucast_pkts': '39900914'}],
                                                                       'mac_address': '24:18:1d:27:c8:67',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '5562432822',
                                                                       'out_ucast_pkts': '39900914',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 60480,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 44,
                                                                                                                                                     'mac_address': '24:18:1d:26:d6:86',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': '324'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '5562432822',
                                                                       'in_ucast_pkts': '39900914',
                                                                       'name': 'ether1',
                                                                       'out_octets': '92506745149',
                                                                       'out_ucast_pkts': '78220964',
                                                                       'poller_hash': 'MjQxODFkMjdjODY3ZXRoZXIx'}],
                                         'management_ip': '10.10.8.10',
                                         'manufacturer': 'Mikrotik',
                                         'name': 'ManCamp 60ghz client',
                                         'poller_hash': 'JBgdJ8hn',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.44.5'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_None_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad.None.01")
        exp_info = {
                'model': 'RBwAPG-60ad',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 1,
                'sw_version': '6.44.1',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 2716822449,
                'dl_en_packets': 30510839,
                'dl_noise_floor': None,
                'dl_rf_bytes': 8377009814,
                'dl_rf_packets': 227042692,
                'en_if_speed': 1000000000,
                'mem': 19.64874267578125,
                'serial_number': '8B940816964E',
                'ssid': 'MikroTik-623391',
                'system_mac_address': 'cc:2d:e0:62:33:91',
                'ul_en_bytes': 10300367642,
                'ul_en_packets': 73336432,
                'ul_noise_floor': None,
                'ul_rf_bytes': 13481933094,
                'ul_rf_packets': 251133756
        }
        exp_sta_stats = {
                '30:07:4d:56:6b:00': {       'alt_macs': None,
                                             'dev_macs': {       '00:0f:73:03:11:82',
                                                                 '00:0f:73:03:11:8a',
                                                                 '00:20:4a:06:a4:f8',
                                                                 '00:57:d2:d6:0a:c7',
                                                                 '04:d6:aa:66:39:eb',
                                                                 '08:00:37:b9:18:a6',
                                                                 '10:62:e5:05:2d:39',
                                                                 '38:ed:18:bc:aa:c3',
                                                                 '40:a8:f0:5f:26:76',
                                                                 '48:0f:cf:29:8d:d9',
                                                                 '84:a9:3e:50:c0:cd',
                                                                 '8c:dc:d4:4b:52:88',
                                                                 '90:1b:0e:b8:df:2d',
                                                                 '90:1b:0e:b8:df:76',
                                                                 '90:1b:0e:b8:df:ad',
                                                                 '94:57:a5:bb:56:c9',
                                                                 'a0:48:1c:78:82:aa',
                                                                 'ac:cc:8e:49:0d:c1',
                                                                 'ac:e2:d3:13:25:ab',
                                                                 'ac:e2:d3:17:04:a2',
                                                                 'b0:0c:d1:5c:f0:34',
                                                                 'b4:b6:86:2e:d6:8c',
                                                                 'b4:b6:86:30:cd:c8',
                                                                 'c4:34:6b:50:6c:38',
                                                                 'c4:34:6b:53:9b:81',
                                                                 'cc:2d:e0:62:32:e5',
                                                                 'f4:30:b9:28:9f:a2',
                                                                 'f4:30:b9:71:e1:6c',
                                                                 'f8:bc:12:55:a1:5c'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '30:07:4d:56:6b:00',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -150.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -55,
                                             'ul_snr': 95}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '13481933094',
                                                              'in_ucast_pkts': '251133756',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '00:0f:73:03:11:82',
                                                                                                                        '00:0f:73:03:11:8a',
                                                                                                                        '00:20:4a:06:a4:f8',
                                                                                                                        '00:57:d2:d6:0a:c7',
                                                                                                                        '04:d6:aa:66:39:eb',
                                                                                                                        '08:00:37:b9:18:a6',
                                                                                                                        '10:62:e5:05:2d:39',
                                                                                                                        '38:ed:18:bc:aa:c3',
                                                                                                                        '40:a8:f0:5f:26:76',
                                                                                                                        '48:0f:cf:29:8d:d9',
                                                                                                                        '84:a9:3e:50:c0:cd',
                                                                                                                        '8c:dc:d4:4b:52:88',
                                                                                                                        '90:1b:0e:b8:df:2d',
                                                                                                                        '90:1b:0e:b8:df:76',
                                                                                                                        '90:1b:0e:b8:df:ad',
                                                                                                                        '94:57:a5:bb:56:c9',
                                                                                                                        'a0:48:1c:78:82:aa',
                                                                                                                        'ac:cc:8e:49:0d:c1',
                                                                                                                        'ac:e2:d3:13:25:ab',
                                                                                                                        'ac:e2:d3:17:04:a2',
                                                                                                                        'b0:0c:d1:5c:f0:34',
                                                                                                                        'b4:b6:86:2e:d6:8c',
                                                                                                                        'b4:b6:86:30:cd:c8',
                                                                                                                        'c4:34:6b:50:6c:38',
                                                                                                                        'c4:34:6b:53:9b:81',
                                                                                                                        'cc:2d:e0:62:32:e5',
                                                                                                                        'f4:30:b9:28:9f:a2',
                                                                                                                        'f4:30:b9:71:e1:6c',
                                                                                                                        'f8:bc:12:55:a1:5c'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '13481933094',
                                                                                       'in_ucast_pkts': '251133756',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '30:07:4d:56:6b:00',
                                                                                       'out_discards': '180',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '8377009814',
                                                                                       'out_ucast_pkts': '227042692'}],
                                                              'mac_address': '04:d6:aa:66:39:eb',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '180',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '8377009814',
                                                              'out_ucast_pkts': '227042692',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 78,
                                                                                                                                            'mac_address': '30:07:4d:56:6b:00',
                                                                                                                                            'noise_floor': -150.0,
                                                                                                                                            'rssi': -55.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -150.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'MikroTik-623391'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '2716822449',
                                                              'in_ucast_pkts': '30510839',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'cc:2d:e0:62:33:91',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '10300367642',
                                                              'out_ucast_pkts': '73336432',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 19.648743,
                                'model': 'RBwAPG-60ad',
                                'poller_hash': 'BNaqZjnr',
                                'serial_number': '8B940816964E',
                                'sw_version': '6.44.1',
                                'system_mac_address': 'cc:2d:e0:62:33:91',
                                'uptime': '21612504'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '180',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '8377009814',
                                                                       'in_ucast_pkts': '227042692',
                                                                       'links': [       {       'in_discards': '180',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '8377009814',
                                                                                                'in_ucast_pkts': '227042692',
                                                                                                'mac_address': '04:d6:aa:66:39:eb',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '13481933094',
                                                                                                'out_ucast_pkts': '251133756'}],
                                                                       'mac_address': '30:07:4d:56:6b:00',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '13481933094',
                                                                       'out_ucast_pkts': '251133756',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 78,
                                                                                                                                                     'mac_address': '04:d6:aa:66:39:eb',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'MikroTik-623391'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '13481933094',
                                                                       'in_ucast_pkts': '251133756',
                                                                       'name': 'ether1',
                                                                       'out_octets': '8377009814',
                                                                       'out_ucast_pkts': '227042692',
                                                                       'poller_hash': 'MzAwNzRkNTY2YjAwZXRoZXIx'}],
                                         'poller_hash': 'MAdNVmsA',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_6_43_6_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.6.43.6.01")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': None,
                'sta_count': 0,
                'sw_version': '6.43.6',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 97959840,
                'dl_en_packets': 1364064,
                'dl_noise_floor': None,
                'dl_rf_bytes': 0,
                'dl_rf_packets': 0,
                'en_if_speed': 1000000000,
                'mem': 13.736979166666666,
                'serial_number': 'AC900A2E0584',
                'ssid': 'PSC-009',
                'system_mac_address': '74:4d:28:0c:bc:b0',
                'ul_en_bytes': 11562256,
                'ul_en_packets': 101674,
                'ul_noise_floor': None,
                'ul_rf_bytes': 0,
                'ul_rf_packets': 0
        }
        exp_sta_stats = {
         
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '0',
                                                              'in_ucast_pkts': '0',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '74:4d:28:0c:bc:b1',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '0',
                                                              'out_ucast_pkts': '0',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1'}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'PSC-009'}],
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '97959840',
                                                              'in_ucast_pkts': '1364064',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '74:4d:28:0c:bc:b0',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '11562256',
                                                              'out_ucast_pkts': '101674',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 13.7369795,
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'dE0oDLyx',
                                'serial_number': 'AC900A2E0584',
                                'sw_version': '6.43.6',
                                'system_mac_address': '74:4d:28:0c:bc:b0',
                                'uptime': '404265'}
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_6_44_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.6.44.01")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 3,
                'sw_version': None,
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 12241105957,
                'dl_en_packets': 25159878,
                'dl_noise_floor': None,
                'dl_rf_bytes': 13515606287,
                'dl_rf_packets': 44973067,
                'en_if_speed': 1000000000,
                'mem': 19.99053955078125,
                'serial_number': None,
                'ssid': 'Oliver.60N',
                'system_mac_address': '74:4d:28:0c:b7:63',
                'ul_en_bytes': 1805505267,
                'ul_en_packets': 10340996,
                'ul_noise_floor': None,
                'ul_rf_bytes': 1744054532,
                'ul_rf_packets': 14078551
        }
        exp_sta_stats = {
                '04:d6:aa:a7:8a:52': {       'alt_macs': None,
                                             'dev_macs': {       'b8:69:f4:16:18:59',
                                                                 'e4:8d:8c:31:b8:d0'},
                                             'dl_link_rate': None,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a7:8a:52',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': None,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': None,
                                             'ul_snr': 50},
                '04:d6:aa:a7:8a:72': {       'alt_macs': None,
                                             'dev_macs': {       '74:4d:28:0c:b7:64',
                                                                 'b8:69:f4:54:45:2e',
                                                                 'b8:69:f4:ac:e1:af'},
                                             'dl_link_rate': None,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a7:8a:72',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': None,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': None,
                                             'ul_snr': 80},
                'b8:69:f4:93:4b:55': {       'alt_macs': {'b8:69:f4:93:4b:54'},
                                             'dev_macs': {'74:4d:28:98:40:14'},
                                             'dl_link_rate': None,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': 'b8:69:f4:93:4b:55',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': None,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': None,
                                             'ul_snr': 75}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '1744054532',
                                                              'in_ucast_pkts': '14078551',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       'b8:69:f4:16:18:59',
                                                                                                                        'e4:8d:8c:31:b8:d0'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '820589623',
                                                                                       'in_ucast_pkts': '5817062',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a7:8a:52',
                                                                                       'out_discards': '1',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '6907825600',
                                                                                       'out_ucast_pkts': '16992110'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:0c:b7:64',
                                                                                                                        'b8:69:f4:54:45:2e',
                                                                                                                        'b8:69:f4:ac:e1:af'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '566225844',
                                                                                       'in_ucast_pkts': '4483905',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a7:8a:72',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '4018469078',
                                                                                       'out_ucast_pkts': '14658680'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:98:40:14'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '357239065',
                                                                                       'in_ucast_pkts': '3777584',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': 'b8:69:f4:93:4b:55',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '2589311609',
                                                                                       'out_ucast_pkts': '13322277'}],
                                                              'mac_address': '74:4d:28:0c:b7:64',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '1',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '13515606287',
                                                              'out_ucast_pkts': '44973067',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'mac_address': '04:d6:aa:a7:8a:52',
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0},
                                                                                                                                    {       'mac_address': '04:d6:aa:a7:8a:72',
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0},
                                                                                                                                    {       'mac_address': 'b8:69:f4:93:4b:55',
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 75.0}]}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'Oliver.60N'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '12241105957',
                                                              'in_ucast_pkts': '25159878',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '74:4d:28:0c:b7:63',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '1805505267',
                                                              'out_ucast_pkts': '10340996',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 19.99054,
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'dE0oDLdk',
                                'system_mac_address': '74:4d:28:0c:b7:63',
                                'uptime': '260222'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '6907825600',
                                                                       'in_ucast_pkts': '16992110',
                                                                       'links': [       {       'in_discards': '1',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '6907825600',
                                                                                                'in_ucast_pkts': '16992110',
                                                                                                'mac_address': '74:4d:28:0c:b7:64',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '820589623',
                                                                                                'out_ucast_pkts': '5817062'}],
                                                                       'mac_address': '04:d6:aa:a7:8a:52',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '820589623',
                                                                       'out_ucast_pkts': '5817062',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': '74:4d:28:0c:b7:64'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Oliver.60N'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '820589623',
                                                                       'in_ucast_pkts': '5817062',
                                                                       'name': 'ether1',
                                                                       'out_octets': '6907825600',
                                                                       'out_ucast_pkts': '16992110',
                                                                       'poller_hash': 'MDRkNmFhYTc4YTUyZXRoZXIx'}],
                                         'poller_hash': 'BNaqp4pS',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '4018469078',
                                                                       'in_ucast_pkts': '14658680',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '4018469078',
                                                                                                'in_ucast_pkts': '14658680',
                                                                                                'mac_address': '74:4d:28:0c:b7:64',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '566225844',
                                                                                                'out_ucast_pkts': '4483905'}],
                                                                       'mac_address': '04:d6:aa:a7:8a:72',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '566225844',
                                                                       'out_ucast_pkts': '4483905',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': '74:4d:28:0c:b7:64'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Oliver.60N'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '566225844',
                                                                       'in_ucast_pkts': '4483905',
                                                                       'name': 'ether1',
                                                                       'out_octets': '4018469078',
                                                                       'out_ucast_pkts': '14658680',
                                                                       'poller_hash': 'MDRkNmFhYTc4YTcyZXRoZXIx'}],
                                         'poller_hash': 'BNaqp4py',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '2589311609',
                                                                       'in_ucast_pkts': '13322277',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '2589311609',
                                                                                                'in_ucast_pkts': '13322277',
                                                                                                'mac_address': '74:4d:28:0c:b7:64',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '357239065',
                                                                                                'out_ucast_pkts': '3777584'}],
                                                                       'mac_address': 'b8:69:f4:93:4b:55',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '357239065',
                                                                       'out_ucast_pkts': '3777584',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': '74:4d:28:0c:b7:64'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Oliver.60N'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '357239065',
                                                                       'in_ucast_pkts': '3777584',
                                                                       'mac_address': 'b8:69:f4:93:4b:54',
                                                                       'name': 'ether1',
                                                                       'out_octets': '2589311609',
                                                                       'out_ucast_pkts': '13322277',
                                                                       'poller_hash': 'Yjg2OWY0OTM0YjU1ZXRoZXIx'}],
                                         'poller_hash': 'uGn0k0tV',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': 'b8:69:f4:93:4b:54'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_6_44_1_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.6.44.1.01")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 5,
                'sw_version': None,
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 8145256127722,
                'dl_en_packets': 5924151616,
                'dl_noise_floor': None,
                'dl_rf_bytes': 8030736781401,
                'dl_rf_packets': 6187457713,
                'en_if_speed': 1000000000,
                'mem': 20.94268798828125,
                'serial_number': None,
                'ssid': 'Tx9.60NE',
                'system_mac_address': 'b8:69:f4:d5:3f:36',
                'ul_en_bytes': 278432783900,
                'ul_en_packets': 1989677241,
                'ul_noise_floor': None,
                'ul_rf_bytes': 269171789215,
                'ul_rf_packets': 2096498467
        }
        exp_sta_stats = {
                '30:07:4d:7e:30:58': {       'alt_macs': None,
                                             'dev_macs': {       '74:4d:28:5d:94:45',
                                                                 'b8:69:f4:d5:3f:37',
                                                                 'cc:2d:e0:3e:3a:8b'},
                                             'dl_link_rate': None,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '30:07:4d:7e:30:58',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': None,
                                             'ul_noise_floor': None,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': None,
                                             'ul_snr': None},
                '6c:c7:ec:37:b6:66': {       'alt_macs': None,
                                             'dev_macs': {       '74:4d:28:e0:3f:60',
                                                                 'e4:8d:8c:06:8a:c2'},
                                             'dl_link_rate': None,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '6c:c7:ec:37:b6:66',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': None,
                                             'ul_noise_floor': None,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': None,
                                             'ul_snr': None},
                '74:4d:28:2f:32:9c': {       'alt_macs': {'74:4d:28:2f:32:9b'},
                                             'dev_macs': {'40:5d:82:dd:6c:b8'},
                                             'dl_link_rate': None,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '74:4d:28:2f:32:9c',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': None,
                                             'ul_noise_floor': None,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': None,
                                             'ul_snr': None},
                'b8:69:f4:92:7e:9d': {       'alt_macs': {'b8:69:f4:92:7e:9c'},
                                             'dev_macs': {'74:4d:28:ed:a4:45'},
                                             'dl_link_rate': None,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': 'b8:69:f4:92:7e:9d',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': None,
                                             'ul_noise_floor': None,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': None,
                                             'ul_snr': None},
                'b8:69:f4:93:4c:c6': {       'alt_macs': {'b8:69:f4:93:4c:c5'},
                                             'dev_macs': {'84:b8:02:50:10:e2'},
                                             'dl_link_rate': None,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': 'b8:69:f4:93:4c:c6',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': None,
                                             'ul_noise_floor': None,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': None,
                                             'ul_snr': None}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '269171789215',
                                                              'in_ucast_pkts': '2096498467',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '74:4d:28:e0:3f:60',
                                                                                                                        'e4:8d:8c:06:8a:c2'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '43465369905',
                                                                                       'in_ucast_pkts': '208515908',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '6c:c7:ec:37:b6:66',
                                                                                       'out_discards': '5264',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '378359808629',
                                                                                       'out_ucast_pkts': '349452689'},
                                                                               {       'bridged_mac_addresses': [       '40:5d:82:dd:6c:b8'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '31030600657',
                                                                                       'in_ucast_pkts': '361075563',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '74:4d:28:2f:32:9c',
                                                                                       'out_discards': '1074',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1111274500380',
                                                                                       'out_ucast_pkts': '959684044'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:5d:94:45',
                                                                                                                        'b8:69:f4:d5:3f:37',
                                                                                                                        'cc:2d:e0:3e:3a:8b'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '40510144928',
                                                                                       'in_ucast_pkts': '208233060',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '30:07:4d:7e:30:58',
                                                                                       'out_discards': '1550',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '817787377895',
                                                                                       'out_ucast_pkts': '713407428'},
                                                                               {       'bridged_mac_addresses': [       '84:b8:02:50:10:e2'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '23238963673',
                                                                                       'in_ucast_pkts': '119528932',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': 'b8:69:f4:93:4c:c6',
                                                                                       'out_discards': '4345',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '148548039844',
                                                                                       'out_ucast_pkts': '222200258'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:ed:a4:45'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '118069974612',
                                                                                       'in_ucast_pkts': '1049279607',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': 'b8:69:f4:92:7e:9d',
                                                                                       'out_discards': '5032',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '4754307971571',
                                                                                       'out_ucast_pkts': '3305673148'}],
                                                              'mac_address': 'b8:69:f4:d5:3f:37',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '18335',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '8030736781401',
                                                              'out_ucast_pkts': '6187457713',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'mac_address': '6c:c7:ec:37:b6:66'},
                                                                                                                                    {       'mac_address': '74:4d:28:2f:32:9c'},
                                                                                                                                    {       'mac_address': '30:07:4d:7e:30:58'},
                                                                                                                                    {       'mac_address': 'b8:69:f4:93:4c:c6'},
                                                                                                                                    {       'mac_address': 'b8:69:f4:92:7e:9d'}]}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'Tx9.60NE'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '8145256127722',
                                                              'in_ucast_pkts': '5924151616',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'b8:69:f4:d5:3f:36',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '278432783900',
                                                              'out_ucast_pkts': '1989677241',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.942688,
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'uGn01T83',
                                'system_mac_address': 'b8:69:f4:d5:3f:36',
                                'uptime': '10702560'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '5264',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '378359808629',
                                                                       'in_ucast_pkts': '349452689',
                                                                       'links': [       {       'in_discards': '5264',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '378359808629',
                                                                                                'in_ucast_pkts': '349452689',
                                                                                                'mac_address': 'b8:69:f4:d5:3f:37',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '43465369905',
                                                                                                'out_ucast_pkts': '208515908'}],
                                                                       'mac_address': '6c:c7:ec:37:b6:66',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '43465369905',
                                                                       'out_ucast_pkts': '208515908',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': 'b8:69:f4:d5:3f:37'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Tx9.60NE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '43465369905',
                                                                       'in_ucast_pkts': '208515908',
                                                                       'name': 'ether1',
                                                                       'out_octets': '378359808629',
                                                                       'out_ucast_pkts': '349452689',
                                                                       'poller_hash': 'NmNjN2VjMzdiNjY2ZXRoZXIx'}],
                                         'poller_hash': 'bMfsN7Zm',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1074',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1111274500380',
                                                                       'in_ucast_pkts': '959684044',
                                                                       'links': [       {       'in_discards': '1074',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1111274500380',
                                                                                                'in_ucast_pkts': '959684044',
                                                                                                'mac_address': 'b8:69:f4:d5:3f:37',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '31030600657',
                                                                                                'out_ucast_pkts': '361075563'}],
                                                                       'mac_address': '74:4d:28:2f:32:9c',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '31030600657',
                                                                       'out_ucast_pkts': '361075563',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': 'b8:69:f4:d5:3f:37'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Tx9.60NE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '31030600657',
                                                                       'in_ucast_pkts': '361075563',
                                                                       'mac_address': '74:4d:28:2f:32:9b',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1111274500380',
                                                                       'out_ucast_pkts': '959684044',
                                                                       'poller_hash': 'NzQ0ZDI4MmYzMjljZXRoZXIx'}],
                                         'poller_hash': 'dE0oLzKc',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': '74:4d:28:2f:32:9b'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1550',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '817787377895',
                                                                       'in_ucast_pkts': '713407428',
                                                                       'links': [       {       'in_discards': '1550',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '817787377895',
                                                                                                'in_ucast_pkts': '713407428',
                                                                                                'mac_address': 'b8:69:f4:d5:3f:37',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '40510144928',
                                                                                                'out_ucast_pkts': '208233060'}],
                                                                       'mac_address': '30:07:4d:7e:30:58',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '40510144928',
                                                                       'out_ucast_pkts': '208233060',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': 'b8:69:f4:d5:3f:37'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Tx9.60NE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '40510144928',
                                                                       'in_ucast_pkts': '208233060',
                                                                       'name': 'ether1',
                                                                       'out_octets': '817787377895',
                                                                       'out_ucast_pkts': '713407428',
                                                                       'poller_hash': 'MzAwNzRkN2UzMDU4ZXRoZXIx'}],
                                         'poller_hash': 'MAdNfjBY',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '4345',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '148548039844',
                                                                       'in_ucast_pkts': '222200258',
                                                                       'links': [       {       'in_discards': '4345',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '148548039844',
                                                                                                'in_ucast_pkts': '222200258',
                                                                                                'mac_address': 'b8:69:f4:d5:3f:37',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '23238963673',
                                                                                                'out_ucast_pkts': '119528932'}],
                                                                       'mac_address': 'b8:69:f4:93:4c:c6',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '23238963673',
                                                                       'out_ucast_pkts': '119528932',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': 'b8:69:f4:d5:3f:37'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Tx9.60NE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '23238963673',
                                                                       'in_ucast_pkts': '119528932',
                                                                       'mac_address': 'b8:69:f4:93:4c:c5',
                                                                       'name': 'ether1',
                                                                       'out_octets': '148548039844',
                                                                       'out_ucast_pkts': '222200258',
                                                                       'poller_hash': 'Yjg2OWY0OTM0Y2M2ZXRoZXIx'}],
                                         'poller_hash': 'uGn0k0zG',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': 'b8:69:f4:93:4c:c5'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '5032',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '4754307971571',
                                                                       'in_ucast_pkts': '3305673148',
                                                                       'links': [       {       'in_discards': '5032',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '4754307971571',
                                                                                                'in_ucast_pkts': '3305673148',
                                                                                                'mac_address': 'b8:69:f4:d5:3f:37',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '118069974612',
                                                                                                'out_ucast_pkts': '1049279607'}],
                                                                       'mac_address': 'b8:69:f4:92:7e:9d',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '118069974612',
                                                                       'out_ucast_pkts': '1049279607',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': 'b8:69:f4:d5:3f:37'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Tx9.60NE'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '118069974612',
                                                                       'in_ucast_pkts': '1049279607',
                                                                       'mac_address': 'b8:69:f4:92:7e:9c',
                                                                       'name': 'ether1',
                                                                       'out_octets': '4754307971571',
                                                                       'out_ucast_pkts': '3305673148',
                                                                       'poller_hash': 'Yjg2OWY0OTI3ZTlkZXRoZXIx'}],
                                         'poller_hash': 'uGn0kn6d',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'system_mac_address': 'b8:69:f4:92:7e:9c'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_6_44_3_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.6.44.3.01")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': None,
                'sta_count': 0,
                'sw_version': '6.44.3',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 28217982495,
                'dl_en_packets': 321824976,
                'dl_noise_floor': None,
                'dl_rf_bytes': 1345729,
                'dl_rf_packets': 8043,
                'en_if_speed': 100000000,
                'mem': 18.56536865234375,
                'serial_number': 'A2B109D26238',
                'ssid': 'PRWN-TIRETREE-S60',
                'system_mac_address': 'b8:69:f4:d5:42:58',
                'ul_en_bytes': 1233467187,
                'ul_en_packets': 8220568,
                'ul_noise_floor': None,
                'ul_rf_bytes': 7022323,
                'ul_rf_packets': 7324
        }
        exp_sta_stats = {
         
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '7022323',
                                                              'in_ucast_pkts': '7324',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'b8:69:f4:d5:42:59',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '408',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '1345729',
                                                              'out_ucast_pkts': '8043',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1'}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'PRWN-TIRETREE-S60'}],
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '28217982495',
                                                              'in_ucast_pkts': '321824976',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'b8:69:f4:d5:42:58',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '1233467187',
                                                              'out_ucast_pkts': '8220568',
                                                              'speed': '100000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 18.565369,
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'uGn01UJZ',
                                'serial_number': 'A2B109D26238',
                                'sw_version': '6.44.3',
                                'system_mac_address': 'b8:69:f4:d5:42:58',
                                'uptime': '5981904'}
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_6_45_2_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.6.45.2.01")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 0,
                'sw_version': None,
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 809088953040,
                'dl_en_packets': 1235651627,
                'dl_noise_floor': None,
                'dl_rf_bytes': 828957138390,
                'dl_rf_packets': 1468083743,
                'en_if_speed': 1000000000,
                'mem': 21.4508056640625,
                'serial_number': None,
                'ssid': 'PRWN-KD5DYP-S60',
                'system_mac_address': '74:4d:28:0c:ba:be',
                'ul_en_bytes': 1350756091099,
                'ul_en_packets': 1284838307,
                'ul_noise_floor': None,
                'ul_rf_bytes': 1333756878310,
                'ul_rf_packets': 1287786203
        }
        exp_sta_stats = {
         
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '1333756878310',
                                                              'in_ucast_pkts': '1287786203',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '74:4d:28:0c:ba:bf',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '47786',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '828957138390',
                                                              'out_ucast_pkts': '1468083743',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1'}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'PRWN-KD5DYP-S60'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '82043369',
                                                              'in_octets': '809088953040',
                                                              'in_ucast_pkts': '1153608258',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '74:4d:28:0c:ba:be',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '1729709',
                                                              'out_octets': '1350756091099',
                                                              'out_ucast_pkts': '1283108598',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.450806,
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'dE0oDLq/',
                                'system_mac_address': '74:4d:28:0c:ba:be',
                                'uptime': '1227360'}
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_6_45_8_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.6.45.8.01")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 2,
                'sw_version': '6.45.8',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 8891604492295,
                'dl_en_packets': 10020327102,
                'dl_noise_floor': None,
                'dl_rf_bytes': 8858611560557,
                'dl_rf_packets': 10335763532,
                'en_if_speed': 1000000000,
                'mem': 21.6583251953125,
                'serial_number': 'A2B209BFECDC',
                'ssid': 'KP1-N60G',
                'system_mac_address': 'b8:69:f4:d5:3d:3e',
                'ul_en_bytes': 4578633291274,
                'ul_en_packets': 7875856925,
                'ul_noise_floor': None,
                'ul_rf_bytes': 4555548052338,
                'ul_rf_packets': 8091083840
        }
        exp_sta_stats = {
                '08:c5:e1:da:67:73': {       'alt_macs': None,
                                             'dev_macs': {       '00:15:65:a9:a1:90',
                                                                 '00:15:65:cb:a8:79',
                                                                 '0c:dd:24:23:18:ab',
                                                                 '28:16:a8:6f:0c:1a',
                                                                 '30:07:4d:6c:ff:9b',
                                                                 '38:20:56:dd:27:7e',
                                                                 '44:d9:e7:a4:ed:34',
                                                                 '44:d9:e7:bc:2f:f1',
                                                                 '44:d9:e7:f2:c0:8e',
                                                                 '70:73:cb:d9:0f:11',
                                                                 '74:83:c2:96:92:c6',
                                                                 '80:5e:c0:cd:c6:52',
                                                                 '80:5e:c0:cd:ce:74',
                                                                 'be:c5:84:96:3b:7f',
                                                                 'c4:ad:34:8f:c4:80',
                                                                 'cc:2d:e0:23:d3:c4',
                                                                 'e0:63:da:79:38:0d',
                                                                 'e0:63:da:79:39:de',
                                                                 'e0:63:da:79:3a:7a',
                                                                 'e4:8d:8c:35:75:34',
                                                                 'e4:8d:8c:35:75:3b',
                                                                 'e4:8d:8c:35:75:3c',
                                                                 'f0:9f:c2:20:f4:46',
                                                                 'f0:9f:c2:7c:fe:41',
                                                                 'f0:9f:c2:f9:f1:33',
                                                                 'f4:b5:49:f0:b7:06',
                                                                 'f8:0f:f9:85:50:26',
                                                                 'fc:ec:da:16:f0:5d'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '08:c5:e1:da:67:73',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -148.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -53,
                                             'ul_snr': 95},
                '24:18:1d:99:65:f7': {       'alt_macs': None,
                                             'dev_macs': {       '64:d1:54:87:b5:b4',
                                                                 'b8:69:f4:d5:3d:3f'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:65:f7',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -119.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -69,
                                             'ul_snr': 50}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '4555548052338',
                                                              'in_ucast_pkts': '8091083840',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '00:15:65:a9:a1:90',
                                                                                                                        '00:15:65:cb:a8:79',
                                                                                                                        '0c:dd:24:23:18:ab',
                                                                                                                        '28:16:a8:6f:0c:1a',
                                                                                                                        '30:07:4d:6c:ff:9b',
                                                                                                                        '38:20:56:dd:27:7e',
                                                                                                                        '44:d9:e7:a4:ed:34',
                                                                                                                        '44:d9:e7:bc:2f:f1',
                                                                                                                        '44:d9:e7:f2:c0:8e',
                                                                                                                        '70:73:cb:d9:0f:11',
                                                                                                                        '74:83:c2:96:92:c6',
                                                                                                                        '80:5e:c0:cd:c6:52',
                                                                                                                        '80:5e:c0:cd:ce:74',
                                                                                                                        'be:c5:84:96:3b:7f',
                                                                                                                        'c4:ad:34:8f:c4:80',
                                                                                                                        'cc:2d:e0:23:d3:c4',
                                                                                                                        'e0:63:da:79:38:0d',
                                                                                                                        'e0:63:da:79:39:de',
                                                                                                                        'e0:63:da:79:3a:7a',
                                                                                                                        'e4:8d:8c:35:75:34',
                                                                                                                        'e4:8d:8c:35:75:3b',
                                                                                                                        'e4:8d:8c:35:75:3c',
                                                                                                                        'f0:9f:c2:20:f4:46',
                                                                                                                        'f0:9f:c2:7c:fe:41',
                                                                                                                        'f0:9f:c2:f9:f1:33',
                                                                                                                        'f4:b5:49:f0:b7:06',
                                                                                                                        'f8:0f:f9:85:50:26',
                                                                                                                        'fc:ec:da:16:f0:5d'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '4352126738412',
                                                                                       'in_ucast_pkts': '7095194413',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '08:c5:e1:da:67:73',
                                                                                       'out_discards': '943',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '6086714708317',
                                                                                       'out_ucast_pkts': '7988237923'},
                                                                               {       'bridged_mac_addresses': [       '64:d1:54:87:b5:b4',
                                                                                                                        'b8:69:f4:d5:3d:3f'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '203421313926',
                                                                                       'in_ucast_pkts': '995889427',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:65:f7',
                                                                                       'out_discards': '1155',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '2771896852240',
                                                                                       'out_ucast_pkts': '2347525609'}],
                                                              'mac_address': 'b8:69:f4:d5:3d:3f',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '2098',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '8858611560557',
                                                              'out_ucast_pkts': '10335763532',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 33,
                                                                                                                                            'mac_address': '08:c5:e1:da:67:73',
                                                                                                                                            'noise_floor': -148.0,
                                                                                                                                            'rssi': -53.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 95.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 295,
                                                                                                                                            'mac_address': '24:18:1d:99:65:f7',
                                                                                                                                            'noise_floor': -119.0,
                                                                                                                                            'rssi': -69.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -119.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'KP1-N60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '22550454',
                                                              'in_octets': '8891604492295',
                                                              'in_ucast_pkts': '9997776648',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'b8:69:f4:d5:3d:3e',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '112881719',
                                                              'out_octets': '4578633291274',
                                                              'out_ucast_pkts': '7762975206',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.658325,
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'uGn01T0/',
                                'serial_number': 'A2B209BFECDC',
                                'sw_version': '6.45.8',
                                'system_mac_address': 'b8:69:f4:d5:3d:3e',
                                'uptime': '33420599'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '943',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '6086714708317',
                                                                       'in_ucast_pkts': '7988237923',
                                                                       'links': [       {       'in_discards': '943',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '6086714708317',
                                                                                                'in_ucast_pkts': '7988237923',
                                                                                                'mac_address': 'b8:69:f4:d5:3d:3f',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '4352126738412',
                                                                                                'out_ucast_pkts': '7095194413'}],
                                                                       'mac_address': '08:c5:e1:da:67:73',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '4352126738412',
                                                                       'out_ucast_pkts': '7095194413',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 33,
                                                                                                                                                     'mac_address': 'b8:69:f4:d5:3d:3f',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'KP1-N60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '4352126738412',
                                                                       'in_ucast_pkts': '7095194413',
                                                                       'name': 'ether1',
                                                                       'out_octets': '6086714708317',
                                                                       'out_ucast_pkts': '7988237923',
                                                                       'poller_hash': 'MDhjNWUxZGE2NzczZXRoZXIx'}],
                                         'poller_hash': 'CMXh2mdz',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1155',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '2771896852240',
                                                                       'in_ucast_pkts': '2347525609',
                                                                       'links': [       {       'in_discards': '1155',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '2771896852240',
                                                                                                'in_ucast_pkts': '2347525609',
                                                                                                'mac_address': 'b8:69:f4:d5:3d:3f',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '203421313926',
                                                                                                'out_ucast_pkts': '995889427'}],
                                                                       'mac_address': '24:18:1d:99:65:f7',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '203421313926',
                                                                       'out_ucast_pkts': '995889427',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 295,
                                                                                                                                                     'mac_address': 'b8:69:f4:d5:3d:3f',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'KP1-N60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '203421313926',
                                                                       'in_ucast_pkts': '995889427',
                                                                       'name': 'ether1',
                                                                       'out_octets': '2771896852240',
                                                                       'out_ucast_pkts': '2347525609',
                                                                       'poller_hash': 'MjQxODFkOTk2NWY3ZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWX3',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_6_45_8_02(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.6.45.8.02")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 1,
                'sw_version': '6.45.8',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 8366775042811,
                'dl_en_packets': 6477293947,
                'dl_noise_floor': None,
                'dl_rf_bytes': 8301163066176,
                'dl_rf_packets': 6472841404,
                'en_if_speed': 1000000000,
                'mem': 20.892333984375,
                'serial_number': 'A2B209B702B6',
                'ssid': 'KP1-SSW60G',
                'system_mac_address': 'b8:69:f4:d5:39:f2',
                'ul_en_bytes': 570969720175,
                'ul_en_packets': 3201692428,
                'ul_noise_floor': None,
                'ul_rf_bytes': 559498926897,
                'ul_rf_packets': 3369481608
        }
        exp_sta_stats = {
                '24:18:1d:99:68:6a': {       'alt_macs': None,
                                             'dev_macs': {       '74:4d:28:52:64:94',
                                                                 'b8:69:f4:d5:39:f3'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:68:6a',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -120.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -70,
                                             'ul_snr': 50}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '559498926897',
                                                              'in_ucast_pkts': '3369481608',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '74:4d:28:52:64:94',
                                                                                                                        'b8:69:f4:d5:39:f3'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '559498926897',
                                                                                       'in_ucast_pkts': '3369481608',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:68:6a',
                                                                                       'out_discards': '822',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '8301163066176',
                                                                                       'out_ucast_pkts': '6472841404'}],
                                                              'mac_address': 'b8:69:f4:d5:39:f3',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '822',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '8301163066176',
                                                              'out_ucast_pkts': '6472841404',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 424,
                                                                                                                                            'mac_address': '24:18:1d:99:68:6a',
                                                                                                                                            'noise_floor': -120.0,
                                                                                                                                            'rssi': -70.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -120.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'KP1-SSW60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '132647869',
                                                              'in_octets': '8366775042811',
                                                              'in_ucast_pkts': '6344646078',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'b8:69:f4:d5:39:f2',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '4051055',
                                                              'out_octets': '570969720175',
                                                              'out_ucast_pkts': '3197641373',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.892334,
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'uGn01Tnz',
                                'serial_number': 'A2B209B702B6',
                                'sw_version': '6.45.8',
                                'system_mac_address': 'b8:69:f4:d5:39:f2',
                                'uptime': '33930896'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '822',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '8301163066176',
                                                                       'in_ucast_pkts': '6472841404',
                                                                       'links': [       {       'in_discards': '822',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '8301163066176',
                                                                                                'in_ucast_pkts': '6472841404',
                                                                                                'mac_address': 'b8:69:f4:d5:39:f3',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '559498926897',
                                                                                                'out_ucast_pkts': '3369481608'}],
                                                                       'mac_address': '24:18:1d:99:68:6a',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '559498926897',
                                                                       'out_ucast_pkts': '3369481608',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 424,
                                                                                                                                                     'mac_address': 'b8:69:f4:d5:39:f3',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'KP1-SSW60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '559498926897',
                                                                       'in_ucast_pkts': '3369481608',
                                                                       'name': 'ether1',
                                                                       'out_octets': '8301163066176',
                                                                       'out_ucast_pkts': '6472841404',
                                                                       'poller_hash': 'MjQxODFkOTk2ODZhZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWhq',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_6_45_8_03(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.6.45.8.03")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 0,
                'sw_version': '6.45.8',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 1131284844,
                'dl_en_packets': 12401687,
                'dl_noise_floor': None,
                'dl_rf_bytes': 0,
                'dl_rf_packets': 0,
                'en_if_speed': 1000000000,
                'mem': 20.02410888671875,
                'serial_number': 'A2B2096C07B8',
                'ssid': 'NU4-N120',
                'system_mac_address': 'b8:69:f4:d5:3d:66',
                'ul_en_bytes': 841754052,
                'ul_en_packets': 5249682,
                'ul_noise_floor': None,
                'ul_rf_bytes': 0,
                'ul_rf_packets': 0
        }
        exp_sta_stats = {
         
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '0',
                                                              'in_ucast_pkts': '0',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'b8:69:f4:d5:3d:67',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '0',
                                                              'out_ucast_pkts': '0',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1'}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU4-N120'}],
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '3696650',
                                                              'in_octets': '1131284844',
                                                              'in_ucast_pkts': '8705037',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'b8:69:f4:d5:3d:66',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '318541',
                                                              'out_octets': '841754052',
                                                              'out_ucast_pkts': '4931141',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.024109,
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'uGn01T1n',
                                'serial_number': 'A2B2096C07B8',
                                'sw_version': '6.45.8',
                                'system_mac_address': 'b8:69:f4:d5:3d:66',
                                'uptime': '6370861'}
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_6_45_8_04(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.6.45.8.04")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 1,
                'sw_version': '6.45.8',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 3728776994186,
                'dl_en_packets': 3701961213,
                'dl_noise_floor': None,
                'dl_rf_bytes': 3694903019519,
                'dl_rf_packets': 3726449469,
                'en_if_speed': 1000000000,
                'mem': 22.021484375,
                'serial_number': 'A2B209FC6090',
                'ssid': 'NU4-S120',
                'system_mac_address': 'b8:69:f4:d5:3d:5e',
                'ul_en_bytes': 724568491951,
                'ul_en_packets': 2322918461,
                'ul_noise_floor': None,
                'ul_rf_bytes': 714612659576,
                'ul_rf_packets': 2375907297
        }
        exp_sta_stats = {
                '6c:c7:ec:92:f9:9d': {       'alt_macs': None,
                                             'dev_macs': {       '74:ac:b9:d9:74:01',
                                                                 'b8:69:f4:d5:3d:5f'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '6c:c7:ec:92:f9:9d',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -129.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -64,
                                             'ul_snr': 65}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '714612659576',
                                                              'in_ucast_pkts': '2375907297',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '74:ac:b9:d9:74:01',
                                                                                                                        'b8:69:f4:d5:3d:5f'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '714612659576',
                                                                                       'in_ucast_pkts': '2375907297',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '6c:c7:ec:92:f9:9d',
                                                                                       'out_discards': '675',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '3694903019519',
                                                                                       'out_ucast_pkts': '3726449469'}],
                                                              'mac_address': 'b8:69:f4:d5:3d:5f',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '675',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '3694903019519',
                                                              'out_ucast_pkts': '3726449469',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 304,
                                                                                                                                            'mac_address': '6c:c7:ec:92:f9:9d',
                                                                                                                                            'noise_floor': -129.0,
                                                                                                                                            'rssi': -64.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -129.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'NU4-S120'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '32992884',
                                                              'in_octets': '3728776994186',
                                                              'in_ucast_pkts': '3668968329',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'b8:69:f4:d5:3d:5e',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '16428783',
                                                              'out_octets': '724568491951',
                                                              'out_ucast_pkts': '2306489678',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 22.021484,
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'uGn01T1f',
                                'serial_number': 'A2B209FC6090',
                                'sw_version': '6.45.8',
                                'system_mac_address': 'b8:69:f4:d5:3d:5e',
                                'uptime': '32382698'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '675',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '3694903019519',
                                                                       'in_ucast_pkts': '3726449469',
                                                                       'links': [       {       'in_discards': '675',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '3694903019519',
                                                                                                'in_ucast_pkts': '3726449469',
                                                                                                'mac_address': 'b8:69:f4:d5:3d:5f',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '714612659576',
                                                                                                'out_ucast_pkts': '2375907297'}],
                                                                       'mac_address': '6c:c7:ec:92:f9:9d',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '714612659576',
                                                                       'out_ucast_pkts': '2375907297',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 304,
                                                                                                                                                     'mac_address': 'b8:69:f4:d5:3d:5f',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'NU4-S120'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '714612659576',
                                                                       'in_ucast_pkts': '2375907297',
                                                                       'name': 'ether1',
                                                                       'out_octets': '3694903019519',
                                                                       'out_ucast_pkts': '3726449469',
                                                                       'poller_hash': 'NmNjN2VjOTJmOTlkZXRoZXIx'}],
                                         'poller_hash': 'bMfskvmd',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_6_45_9(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.6.45.9")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 2,
                'sw_version': '6.45.9',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 1103793263687,
                'dl_en_packets': 4506917857,
                'dl_noise_floor': None,
                'dl_rf_bytes': 1145463211990,
                'dl_rf_packets': 2992256305,
                'en_if_speed': 1000000000,
                'mem': 20.93505859375,
                'serial_number': 'AC900A7BCA0C',
                'ssid': 'Lonestar.60S',
                'system_mac_address': '74:4d:28:0c:b6:47',
                'ul_en_bytes': 130481954376,
                'ul_en_packets': 626925643,
                'ul_noise_floor': None,
                'ul_rf_bytes': 123218956598,
                'ul_rf_packets': 651331861
        }
        exp_sta_stats = {
                '24:18:1d:95:33:4c': {       'alt_macs': None,
                                             'dev_macs': {       '74:4d:28:0c:b6:48',
                                                                 'b8:69:f4:54:45:d2',
                                                                 'd4:ca:6d:1e:63:d6'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.1.0.124',
                                             'mac_address': '24:18:1d:95:33:4c',
                                             'name': 'Institches & Designs',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -136.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -66,
                                             'ul_snr': 70},
                '2c:c8:1b:02:21:c2': {       'alt_macs': None,
                                             'dev_macs': {'2c:c8:1b:be:91:0e'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.1.0.232',
                                             'mac_address': '2c:c8:1b:02:21:c2',
                                             'name': 'Merichen Friesen',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -148.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -68,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '123218956598',
                                                              'in_ucast_pkts': '651331861',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '74:4d:28:0c:b6:48',
                                                                                                                        'b8:69:f4:54:45:d2',
                                                                                                                        'd4:ca:6d:1e:63:d6'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '103173908705',
                                                                                       'in_ucast_pkts': '506029316',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:95:33:4c',
                                                                                       'out_discards': '449',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '888108254045',
                                                                                       'out_ucast_pkts': '2460666426'},
                                                                               {       'bridged_mac_addresses': [       '2c:c8:1b:be:91:0e'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '20045047893',
                                                                                       'in_ucast_pkts': '145302545',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '2c:c8:1b:02:21:c2',
                                                                                       'out_discards': '13118',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '257354957945',
                                                                                       'out_ucast_pkts': '531589879'}],
                                                              'mac_address': '74:4d:28:0c:b6:48',
                                                              'mtu': 1500,
                                                              'name': 'Lonestar 60 S',
                                                              'oper_up': True,
                                                              'out_discards': '13567',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '1145463211990',
                                                              'out_ucast_pkts': '2992256305',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 353,
                                                                                                                                            'mac_address': '24:18:1d:95:33:4c',
                                                                                                                                            'noise_floor': -136.0,
                                                                                                                                            'rssi': -66.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 70.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 231,
                                                                                                                                            'mac_address': '2c:c8:1b:02:21:c2',
                                                                                                                                            'noise_floor': -148.0,
                                                                                                                                            'rssi': -68.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -136.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'Lonestar.60S'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '1806997317',
                                                              'in_octets': '1103793263687',
                                                              'in_ucast_pkts': '2699920540',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '74:4d:28:0c:b6:47',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '8924182',
                                                              'out_octets': '130481954376',
                                                              'out_ucast_pkts': '618001461',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.935059,
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'dE0oDLZI',
                                'serial_number': 'AC900A7BCA0C',
                                'sw_version': '6.45.9',
                                'system_mac_address': '74:4d:28:0c:b6:47',
                                'uptime': '13102948'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '449',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '888108254045',
                                                                       'in_ucast_pkts': '2460666426',
                                                                       'links': [       {       'in_discards': '449',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '888108254045',
                                                                                                'in_ucast_pkts': '2460666426',
                                                                                                'mac_address': '74:4d:28:0c:b6:48',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '103173908705',
                                                                                                'out_ucast_pkts': '506029316'}],
                                                                       'mac_address': '24:18:1d:95:33:4c',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '103173908705',
                                                                       'out_ucast_pkts': '506029316',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 353,
                                                                                                                                                     'mac_address': '74:4d:28:0c:b6:48',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Lonestar.60S'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '103173908705',
                                                                       'in_ucast_pkts': '506029316',
                                                                       'name': 'ether1',
                                                                       'out_octets': '888108254045',
                                                                       'out_ucast_pkts': '2460666426',
                                                                       'poller_hash': 'MjQxODFkOTUzMzRjZXRoZXIx'}],
                                         'management_ip': '10.1.0.124',
                                         'manufacturer': 'Mikrotik',
                                         'name': 'Institches & Designs',
                                         'poller_hash': 'JBgdlTNM',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.45.9'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '13118',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '257354957945',
                                                                       'in_ucast_pkts': '531589879',
                                                                       'links': [       {       'in_discards': '13118',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '257354957945',
                                                                                                'in_ucast_pkts': '531589879',
                                                                                                'mac_address': '74:4d:28:0c:b6:48',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '20045047893',
                                                                                                'out_ucast_pkts': '145302545'}],
                                                                       'mac_address': '2c:c8:1b:02:21:c2',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '20045047893',
                                                                       'out_ucast_pkts': '145302545',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 231,
                                                                                                                                                     'mac_address': '74:4d:28:0c:b6:48',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Lonestar.60S'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '20045047893',
                                                                       'in_ucast_pkts': '145302545',
                                                                       'name': 'ether1',
                                                                       'out_octets': '257354957945',
                                                                       'out_ucast_pkts': '531589879',
                                                                       'poller_hash': 'MmNjODFiMDIyMWMyZXRoZXIx'}],
                                         'management_ip': '10.1.0.232',
                                         'manufacturer': 'Mikrotik',
                                         'name': 'Merichen Friesen',
                                         'poller_hash': 'LMgbAiHC',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.48.2'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_6_46_1_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.6.46.1.01")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 1,
                'sw_version': '6.46.1',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': None,
                'dl_en_bytes': 2326577125,
                'dl_en_packets': 2362389057,
                'dl_noise_floor': None,
                'dl_rf_bytes': 2291211925,
                'dl_rf_packets': 1641588365,
                'en_if_speed': 1000000000,
                'mem': None,
                'serial_number': None,
                'ssid': 'reconpop8-5',
                'system_mac_address': '74:4d:28:0c:e2:be',
                'ul_en_bytes': 1359801551,
                'ul_en_packets': 1023654646,
                'ul_noise_floor': None,
                'ul_rf_bytes': 880804619,
                'ul_rf_packets': 771389073
        }
        exp_sta_stats = {
                '24:18:1d:96:ad:a3': {       'alt_macs': None,
                                             'dev_macs': set(),
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.57.0.132',
                                             'mac_address': '24:18:1d:96:ad:a3',
                                             'name': '#4984 - John Ball',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -118.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -68,
                                             'ul_snr': 50}
        }
        exp_ne_msg = {
                'data': {       'interfaces': [       {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '2326577125',
                                                              'in_ucast_pkts': '2362389057',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '74:4d:28:0c:e2:be',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '1359801551',
                                                              'out_ucast_pkts': '1023654646',
                                                              'speed': '1000000000',
                                                              'type': 6},
                                                      {       'admin_up': True,
                                                              'id': '6',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '880804619',
                                                              'in_ucast_pkts': '771389073',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '880804619',
                                                                                       'in_ucast_pkts': '771389073',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:96:ad:a3',
                                                                                       'out_discards': '7110',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '2291211925',
                                                                                       'out_ucast_pkts': '1641588365'}],
                                                              'mac_address': '74:4d:28:0c:e2:bf',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-4',
                                                              'oper_up': True,
                                                              'out_discards': '7110',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '2291211925',
                                                              'out_ucast_pkts': '1641588365',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 448,
                                                                                                                                            'mac_address': '24:18:1d:96:ad:a3',
                                                                                                                                            'noise_floor': -118.0,
                                                                                                                                            'rssi': -68.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -118.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'reconpop8-5'}],
                                                              'speed': '2310000000',
                                                              'type': 71}],
                                'manufacturer': 'Mikrotik',
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'dE0oDOK/',
                                'sw_version': '6.46.1',
                                'system_mac_address': '74:4d:28:0c:e2:be',
                                'uptime': '12612349'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '7110',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '2291211925',
                                                                       'in_ucast_pkts': '1641588365',
                                                                       'links': [       {       'in_discards': '7110',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '2291211925',
                                                                                                'in_ucast_pkts': '1641588365',
                                                                                                'mac_address': '74:4d:28:0c:e2:bf',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '880804619',
                                                                                                'out_ucast_pkts': '771389073'}],
                                                                       'mac_address': '24:18:1d:96:ad:a3',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '880804619',
                                                                       'out_ucast_pkts': '771389073',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 448,
                                                                                                                                                     'mac_address': '74:4d:28:0c:e2:bf',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'reconpop8-5'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '880804619',
                                                                       'in_ucast_pkts': '771389073',
                                                                       'name': 'ether1',
                                                                       'out_octets': '2291211925',
                                                                       'out_ucast_pkts': '1641588365',
                                                                       'poller_hash': 'MjQxODFkOTZhZGEzZXRoZXIx'}],
                                         'management_ip': '10.57.0.132',
                                         'manufacturer': 'Mikrotik',
                                         'name': '#4984 - John Ball',
                                         'poller_hash': 'JBgdlq2j',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.46.1'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_6_46_4_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.6.46.4.01")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': 62640,
                'sta_count': 4,
                'sw_version': '6.46.4',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': None,
                'dl_en_bytes': 3022828149,
                'dl_en_packets': 11273638,
                'dl_noise_floor': None,
                'dl_rf_bytes': 11656016646,
                'dl_rf_packets': 11692752,
                'en_if_speed': 1000000000,
                'mem': None,
                'serial_number': None,
                'ssid': 'earlpop4-4',
                'system_mac_address': '74:4d:28:0c:ca:72',
                'ul_en_bytes': 2564581260,
                'ul_en_packets': 6871599,
                'ul_noise_floor': None,
                'ul_rf_bytes': 2590697089,
                'ul_rf_packets': 7210509
        }
        exp_sta_stats = {
                '24:18:1d:9e:61:b6': {       'alt_macs': None,
                                             'dev_macs': set(),
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.45.0.126',
                                             'mac_address': '24:18:1d:9e:61:b6',
                                             'name': '5018 - Trisha Del Rosario Reid',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -135.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -55,
                                             'ul_snr': 80},
                '6c:c7:ec:9c:87:96': {       'alt_macs': None,
                                             'dev_macs': set(),
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.45.0.132',
                                             'mac_address': '6c:c7:ec:9c:87:96',
                                             'name': '#1976 Zachery Baldwin',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -139.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -59,
                                             'ul_snr': 80},
                '6c:c7:ec:9c:cf:14': {       'alt_macs': None,
                                             'dev_macs': set(),
                                             'dl_link_rate': 1540000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.45.0.111',
                                             'mac_address': '6c:c7:ec:9c:cf:14',
                                             'name': '4900 Mardee Merrill',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 6,
                                             'ul_noise_floor': -127.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -67,
                                             'ul_snr': 60},
                'c4:ad:34:f2:fb:44': {       'alt_macs': None,
                                             'dev_macs': set(),
                                             'dl_link_rate': 1155000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': '10.45.0.135',
                                             'mac_address': 'c4:ad:34:f2:fb:44',
                                             'name': '#2141 Leslie-Ann Campbell',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 4,
                                             'ul_noise_floor': -107.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -67,
                                             'ul_snr': 40}
        }
        exp_ne_msg = {
                'data': {       'interfaces': [       {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '3022828149',
                                                              'in_ucast_pkts': '11273638',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '74:4d:28:0c:ca:72',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '2564581260',
                                                              'out_ucast_pkts': '6871599',
                                                              'speed': '1000000000',
                                                              'type': 6},
                                                      {       'admin_up': True,
                                                              'id': '6',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '2590697089',
                                                              'in_ucast_pkts': '7210509',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '1618381865',
                                                                                       'in_ucast_pkts': '3136493',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:9e:61:b6',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '3438279030',
                                                                                       'out_ucast_pkts': '4332020'},
                                                                               {       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '188479322',
                                                                                       'in_ucast_pkts': '963856',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '6c:c7:ec:9c:87:96',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '3043867434',
                                                                                       'out_ucast_pkts': '2486162'},
                                                                               {       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '682026525',
                                                                                       'in_ucast_pkts': '2246455',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': 'c4:ad:34:f2:fb:44',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '3091451293',
                                                                                       'out_ucast_pkts': '2966833'},
                                                                               {       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '101809377',
                                                                                       'in_ucast_pkts': '863705',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '6c:c7:ec:9c:cf:14',
                                                                                       'out_discards': '4',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '2082418889',
                                                                                       'out_ucast_pkts': '1907737'}],
                                                              'mac_address': '74:4d:28:0c:ca:73',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-3',
                                                              'oper_up': True,
                                                              'out_discards': '4',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '11656016646',
                                                              'out_ucast_pkts': '11692752',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 62640,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 131,
                                                                                                                                            'mac_address': '24:18:1d:9e:61:b6',
                                                                                                                                            'noise_floor': -135.0,
                                                                                                                                            'rssi': -55.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 256,
                                                                                                                                            'mac_address': '6c:c7:ec:9c:87:96',
                                                                                                                                            'noise_floor': -139.0,
                                                                                                                                            'rssi': -59.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 362,
                                                                                                                                            'mac_address': 'c4:ad:34:f2:fb:44',
                                                                                                                                            'noise_floor': -107.0,
                                                                                                                                            'rssi': -67.0,
                                                                                                                                            'rx_mcs': 4,
                                                                                                                                            'snr': 40.0,
                                                                                                                                            'tx_link_rate': '1155000000'},
                                                                                                                                    {       'distance': 356,
                                                                                                                                            'mac_address': '6c:c7:ec:9c:cf:14',
                                                                                                                                            'noise_floor': -127.0,
                                                                                                                                            'rssi': -67.0,
                                                                                                                                            'rx_mcs': 6,
                                                                                                                                            'snr': 60.0,
                                                                                                                                            'tx_link_rate': '1540000000'}],
                                                                                                                   'noise_floor': -107.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'earlpop4-4'}],
                                                              'speed': '1540000000',
                                                              'type': 71}],
                                'manufacturer': 'Mikrotik',
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'dE0oDMpz',
                                'sw_version': '6.46.4',
                                'system_mac_address': '74:4d:28:0c:ca:72',
                                'uptime': '16890'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '3438279030',
                                                                       'in_ucast_pkts': '4332020',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '3438279030',
                                                                                                'in_ucast_pkts': '4332020',
                                                                                                'mac_address': '74:4d:28:0c:ca:73',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '1618381865',
                                                                                                'out_ucast_pkts': '3136493'}],
                                                                       'mac_address': '24:18:1d:9e:61:b6',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '1618381865',
                                                                       'out_ucast_pkts': '3136493',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 131,
                                                                                                                                                     'mac_address': '74:4d:28:0c:ca:73',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'earlpop4-4'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '1618381865',
                                                                       'in_ucast_pkts': '3136493',
                                                                       'name': 'ether1',
                                                                       'out_octets': '3438279030',
                                                                       'out_ucast_pkts': '4332020',
                                                                       'poller_hash': 'MjQxODFkOWU2MWI2ZXRoZXIx'}],
                                         'management_ip': '10.45.0.126',
                                         'manufacturer': 'Mikrotik',
                                         'name': '5018 - Trisha Del Rosario Reid',
                                         'poller_hash': 'JBgdnmG2',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.46.4'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '3043867434',
                                                                       'in_ucast_pkts': '2486162',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '3043867434',
                                                                                                'in_ucast_pkts': '2486162',
                                                                                                'mac_address': '74:4d:28:0c:ca:73',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '188479322',
                                                                                                'out_ucast_pkts': '963856'}],
                                                                       'mac_address': '6c:c7:ec:9c:87:96',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '188479322',
                                                                       'out_ucast_pkts': '963856',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 256,
                                                                                                                                                     'mac_address': '74:4d:28:0c:ca:73',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'earlpop4-4'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '188479322',
                                                                       'in_ucast_pkts': '963856',
                                                                       'name': 'ether1',
                                                                       'out_octets': '3043867434',
                                                                       'out_ucast_pkts': '2486162',
                                                                       'poller_hash': 'NmNjN2VjOWM4Nzk2ZXRoZXIx'}],
                                         'management_ip': '10.45.0.132',
                                         'manufacturer': 'Mikrotik',
                                         'name': '#1976 Zachery Baldwin',
                                         'poller_hash': 'bMfsnIeW',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.46.4'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '3091451293',
                                                                       'in_ucast_pkts': '2966833',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '3091451293',
                                                                                                'in_ucast_pkts': '2966833',
                                                                                                'mac_address': '74:4d:28:0c:ca:73',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '682026525',
                                                                                                'out_ucast_pkts': '2246455'}],
                                                                       'mac_address': 'c4:ad:34:f2:fb:44',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '682026525',
                                                                       'out_ucast_pkts': '2246455',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 362,
                                                                                                                                                     'mac_address': '74:4d:28:0c:ca:73',
                                                                                                                                                     'rx_link_rate': '1155000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'earlpop4-4'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '682026525',
                                                                       'in_ucast_pkts': '2246455',
                                                                       'name': 'ether1',
                                                                       'out_octets': '3091451293',
                                                                       'out_ucast_pkts': '2966833',
                                                                       'poller_hash': 'YzRhZDM0ZjJmYjQ0ZXRoZXIx'}],
                                         'management_ip': '10.45.0.135',
                                         'manufacturer': 'Mikrotik',
                                         'name': '#2141 Leslie-Ann Campbell',
                                         'poller_hash': 'xK008vtE',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.46.6'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '4',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '2082418889',
                                                                       'in_ucast_pkts': '1907737',
                                                                       'links': [       {       'in_discards': '4',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '2082418889',
                                                                                                'in_ucast_pkts': '1907737',
                                                                                                'mac_address': '74:4d:28:0c:ca:73',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '101809377',
                                                                                                'out_ucast_pkts': '863705'}],
                                                                       'mac_address': '6c:c7:ec:9c:cf:14',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '101809377',
                                                                       'out_ucast_pkts': '863705',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 62640,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 356,
                                                                                                                                                     'mac_address': '74:4d:28:0c:ca:73',
                                                                                                                                                     'rx_link_rate': '1540000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'earlpop4-4'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '101809377',
                                                                       'in_ucast_pkts': '863705',
                                                                       'name': 'ether1',
                                                                       'out_octets': '2082418889',
                                                                       'out_ucast_pkts': '1907737',
                                                                       'poller_hash': 'NmNjN2VjOWNjZjE0ZXRoZXIx'}],
                                         'management_ip': '10.45.0.111',
                                         'manufacturer': 'Mikrotik',
                                         'name': '4900 Mardee Merrill',
                                         'poller_hash': 'bMfsnM8U',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.46.4'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_6_46_6_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.6.46.6.01")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 2,
                'sw_version': '6.46.6',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 3560977987887,
                'dl_en_packets': 2849419395,
                'dl_noise_floor': None,
                'dl_rf_bytes': 3545249605868,
                'dl_rf_packets': 3095102393,
                'en_if_speed': 1000000000,
                'mem': 21.551513671875,
                'serial_number': 'A2B20934D73F',
                'ssid': 'TN4-N60G',
                'system_mac_address': 'b8:69:f4:d5:3d:62',
                'ul_en_bytes': 501514557965,
                'ul_en_packets': 1121069714,
                'ul_noise_floor': None,
                'ul_rf_bytes': 504112626173,
                'ul_rf_packets': 1375960038
        }
        exp_sta_stats = {
                '04:d6:aa:a8:d4:a3': {       'alt_macs': None,
                                             'dev_macs': {'74:4d:28:0f:74:1c'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d4:a3',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -143.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -63,
                                             'ul_snr': 80},
                '24:18:1d:99:67:d2': {       'alt_macs': None,
                                             'dev_macs': {       '74:4d:28:18:fe:07',
                                                                 'b8:69:f4:3f:9b:7a',
                                                                 'b8:69:f4:d5:3d:63'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:67:d2',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -137.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -57,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '504112626173',
                                                              'in_ucast_pkts': '1375960038',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '74:4d:28:18:fe:07',
                                                                                                                        'b8:69:f4:3f:9b:7a',
                                                                                                                        'b8:69:f4:d5:3d:63'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '440894112100',
                                                                                       'in_ucast_pkts': '1027942390',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:67:d2',
                                                                                       'out_discards': '1040',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '2955245577844',
                                                                                       'out_ucast_pkts': '2508966230'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:0f:74:1c'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '63218514073',
                                                                                       'in_ucast_pkts': '348017648',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d4:a3',
                                                                                       'out_discards': '347',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '590004028024',
                                                                                       'out_ucast_pkts': '586136163'}],
                                                              'mac_address': 'b8:69:f4:d5:3d:63',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '1387',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '3545249605868',
                                                              'out_ucast_pkts': '3095102393',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 85,
                                                                                                                                            'mac_address': '24:18:1d:99:67:d2',
                                                                                                                                            'noise_floor': -137.0,
                                                                                                                                            'rssi': -57.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 392,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d4:a3',
                                                                                                                                            'noise_floor': -143.0,
                                                                                                                                            'rssi': -63.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -137.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'TN4-N60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '22843703',
                                                              'in_octets': '3560977987887',
                                                              'in_ucast_pkts': '2826575692',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'b8:69:f4:d5:3d:62',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '21687496',
                                                              'out_octets': '501514557965',
                                                              'out_ucast_pkts': '1099382218',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.551514,
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'uGn01T1j',
                                'serial_number': 'A2B20934D73F',
                                'sw_version': '6.46.6',
                                'system_mac_address': 'b8:69:f4:d5:3d:62',
                                'uptime': '25538087'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1040',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '2955245577844',
                                                                       'in_ucast_pkts': '2508966230',
                                                                       'links': [       {       'in_discards': '1040',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '2955245577844',
                                                                                                'in_ucast_pkts': '2508966230',
                                                                                                'mac_address': 'b8:69:f4:d5:3d:63',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '440894112100',
                                                                                                'out_ucast_pkts': '1027942390'}],
                                                                       'mac_address': '24:18:1d:99:67:d2',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '440894112100',
                                                                       'out_ucast_pkts': '1027942390',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 85,
                                                                                                                                                     'mac_address': 'b8:69:f4:d5:3d:63',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN4-N60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '440894112100',
                                                                       'in_ucast_pkts': '1027942390',
                                                                       'name': 'ether1',
                                                                       'out_octets': '2955245577844',
                                                                       'out_ucast_pkts': '2508966230',
                                                                       'poller_hash': 'MjQxODFkOTk2N2QyZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWfS',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '347',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '590004028024',
                                                                       'in_ucast_pkts': '586136163',
                                                                       'links': [       {       'in_discards': '347',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '590004028024',
                                                                                                'in_ucast_pkts': '586136163',
                                                                                                'mac_address': 'b8:69:f4:d5:3d:63',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '63218514073',
                                                                                                'out_ucast_pkts': '348017648'}],
                                                                       'mac_address': '04:d6:aa:a8:d4:a3',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '63218514073',
                                                                       'out_ucast_pkts': '348017648',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 392,
                                                                                                                                                     'mac_address': 'b8:69:f4:d5:3d:63',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN4-N60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '63218514073',
                                                                       'in_ucast_pkts': '348017648',
                                                                       'name': 'ether1',
                                                                       'out_octets': '590004028024',
                                                                       'out_ucast_pkts': '586136163',
                                                                       'poller_hash': 'MDRkNmFhYThkNGEzZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNSj',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_6_46_6_05(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.6.46.6.05")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 2,
                'sw_version': '6.46.6',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 3560977987887,
                'dl_en_packets': 2849419395,
                'dl_noise_floor': None,
                'dl_rf_bytes': 3545249605868,
                'dl_rf_packets': 3095102393,
                'en_if_speed': 1000000000,
                'mem': 21.551513671875,
                'serial_number': 'A2B20934D73F',
                'ssid': 'TN4-N60G',
                'system_mac_address': 'b8:69:f4:d5:3d:62',
                'ul_en_bytes': 501514557965,
                'ul_en_packets': 1121069714,
                'ul_noise_floor': None,
                'ul_rf_bytes': 504112626173,
                'ul_rf_packets': 1375960038
        }
        exp_sta_stats = {
                '04:d6:aa:a8:d4:a3': {       'alt_macs': None,
                                             'dev_macs': {'74:4d:28:0f:74:1c'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d4:a3',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -143.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -63,
                                             'ul_snr': 80},
                '24:18:1d:99:67:d2': {       'alt_macs': None,
                                             'dev_macs': {       '74:4d:28:18:fe:07',
                                                                 'b8:69:f4:3f:9b:7a',
                                                                 'b8:69:f4:d5:3d:63'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '24:18:1d:99:67:d2',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -137.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -57,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '504112626173',
                                                              'in_ucast_pkts': '1375960038',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '74:4d:28:18:fe:07',
                                                                                                                        'b8:69:f4:3f:9b:7a',
                                                                                                                        'b8:69:f4:d5:3d:63'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '440894112100',
                                                                                       'in_ucast_pkts': '1027942390',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '24:18:1d:99:67:d2',
                                                                                       'out_discards': '1040',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '2955245577844',
                                                                                       'out_ucast_pkts': '2508966230'},
                                                                               {       'bridged_mac_addresses': [       '74:4d:28:0f:74:1c'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '63218514073',
                                                                                       'in_ucast_pkts': '348017648',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d4:a3',
                                                                                       'out_discards': '347',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '590004028024',
                                                                                       'out_ucast_pkts': '586136163'}],
                                                              'mac_address': 'b8:69:f4:d5:3d:63',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '1387',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '3545249605868',
                                                              'out_ucast_pkts': '3095102393',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 85,
                                                                                                                                            'mac_address': '24:18:1d:99:67:d2',
                                                                                                                                            'noise_floor': -137.0,
                                                                                                                                            'rssi': -57.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 392,
                                                                                                                                            'mac_address': '04:d6:aa:a8:d4:a3',
                                                                                                                                            'noise_floor': -143.0,
                                                                                                                                            'rssi': -63.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -137.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'TN4-N60G'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '22843703',
                                                              'in_octets': '3560977987887',
                                                              'in_ucast_pkts': '2826575692',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': 'b8:69:f4:d5:3d:62',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '21687496',
                                                              'out_octets': '501514557965',
                                                              'out_ucast_pkts': '1099382218',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 21.551514,
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'uGn01T1j',
                                'serial_number': 'A2B20934D73F',
                                'sw_version': '6.46.6',
                                'system_mac_address': 'b8:69:f4:d5:3d:62',
                                'uptime': '25538087'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '1040',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '2955245577844',
                                                                       'in_ucast_pkts': '2508966230',
                                                                       'links': [       {       'in_discards': '1040',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '2955245577844',
                                                                                                'in_ucast_pkts': '2508966230',
                                                                                                'mac_address': 'b8:69:f4:d5:3d:63',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '440894112100',
                                                                                                'out_ucast_pkts': '1027942390'}],
                                                                       'mac_address': '24:18:1d:99:67:d2',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '440894112100',
                                                                       'out_ucast_pkts': '1027942390',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 85,
                                                                                                                                                     'mac_address': 'b8:69:f4:d5:3d:63',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN4-N60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '440894112100',
                                                                       'in_ucast_pkts': '1027942390',
                                                                       'name': 'ether1',
                                                                       'out_octets': '2955245577844',
                                                                       'out_ucast_pkts': '2508966230',
                                                                       'poller_hash': 'MjQxODFkOTk2N2QyZXRoZXIx'}],
                                         'poller_hash': 'JBgdmWfS',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '347',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '590004028024',
                                                                       'in_ucast_pkts': '586136163',
                                                                       'links': [       {       'in_discards': '347',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '590004028024',
                                                                                                'in_ucast_pkts': '586136163',
                                                                                                'mac_address': 'b8:69:f4:d5:3d:63',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '63218514073',
                                                                                                'out_ucast_pkts': '348017648'}],
                                                                       'mac_address': '04:d6:aa:a8:d4:a3',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '63218514073',
                                                                       'out_ucast_pkts': '348017648',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 392,
                                                                                                                                                     'mac_address': 'b8:69:f4:d5:3d:63',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'TN4-N60G'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '63218514073',
                                                                       'in_ucast_pkts': '348017648',
                                                                       'name': 'ether1',
                                                                       'out_octets': '590004028024',
                                                                       'out_ucast_pkts': '586136163',
                                                                       'poller_hash': 'MDRkNmFhYThkNGEzZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNSj',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_6_48_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.6.48.01")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': 60480,
                'sta_count': 0,
                'sw_version': '6.48',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 28499861012,
                'dl_en_packets': 604351555,
                'dl_noise_floor': None,
                'dl_rf_bytes': 0,
                'dl_rf_packets': 0,
                'en_if_speed': 1000000000,
                'mem': 19.866943359375,
                'serial_number': 'D6910D9E9B8E',
                'ssid': 'AP60-N',
                'system_mac_address': '08:55:31:07:31:05',
                'ul_en_bytes': 3821365121,
                'ul_en_packets': 16729443,
                'ul_noise_floor': None,
                'ul_rf_bytes': 0,
                'ul_rf_packets': 0
        }
        exp_sta_stats = {
         
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '295350694',
                                                              'in_octets': '28499861012',
                                                              'in_ucast_pkts': '309000861',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '08:55:31:07:31:05',
                                                              'mtu': 1500,
                                                              'name': 'ether1-POE',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '1666630',
                                                              'out_octets': '3821365121',
                                                              'out_ucast_pkts': '15062813',
                                                              'speed': '1000000000',
                                                              'type': 6},
                                                      {       'admin_up': True,
                                                              'id': '6',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '0',
                                                              'in_ucast_pkts': '0',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '08:55:31:07:31:06',
                                                              'mtu': 1500,
                                                              'name': 'AP60-N',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '0',
                                                              'out_ucast_pkts': '0',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 60480,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1'}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'AP60-N'}],
                                                              'type': 71}],
                                'manufacturer': 'Mikrotik',
                                'mem': 19.866943,
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'CFUxBzEG',
                                'serial_number': 'D6910D9E9B8E',
                                'sw_version': '6.48',
                                'system_mac_address': '08:55:31:07:31:05',
                                'uptime': '33242721'}
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_6_49_5_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.6.49.5.01")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 5,
                'sw_version': '6.49.5',
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 4335758218660,
                'dl_en_packets': 4831369145,
                'dl_noise_floor': None,
                'dl_rf_bytes': 4546711375623,
                'dl_rf_packets': 7236414361,
                'en_if_speed': 1000000000,
                'mem': 20.30029296875,
                'serial_number': 'D6910C752CBC',
                'ssid': 'PRWN-KGNC-NNW-60',
                'system_mac_address': '48:8f:5a:cf:51:79',
                'ul_en_bytes': 310196256916,
                'ul_en_packets': 1349555800,
                'ul_noise_floor': None,
                'ul_rf_bytes': 311862607548,
                'ul_rf_packets': 1400824396
        }
        exp_sta_stats = {
                '04:d6:aa:a2:30:cc': {       'alt_macs': None,
                                             'dev_macs': {       '18:fd:74:15:00:04',
                                                                 '28:76:10:1b:b7:97',
                                                                 '28:76:10:1b:b7:98',
                                                                 '28:76:10:23:e7:1c',
                                                                 '28:76:10:23:fe:89',
                                                                 '28:76:10:23:ff:59',
                                                                 '48:a9:8a:0a:ab:39',
                                                                 '78:9a:18:3e:bc:bd',
                                                                 '78:9a:18:6b:62:56',
                                                                 'c4:ad:34:83:c0:0a',
                                                                 'cc:2d:e0:91:c8:84',
                                                                 'ec:13:b2:91:a1:ee'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a2:30:cc',
                                             'name': 'Peppertree-KGNC',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -142.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -62,
                                             'ul_snr': 80},
                '48:8f:5a:80:6f:ad': {       'alt_macs': None,
                                             'dev_macs': {       '18:fd:74:92:fd:d7',
                                                                 '18:fd:74:94:86:a8',
                                                                 '28:76:10:1a:0e:04',
                                                                 '28:76:10:1a:0e:05',
                                                                 '28:76:10:23:f4:69',
                                                                 '48:8f:5a:4e:c3:da',
                                                                 'dc:2c:6e:62:08:28',
                                                                 'ec:13:b2:91:e0:40'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:80:6f:ad',
                                             'name': 'Peppertree Bldg C',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -146.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -66,
                                             'ul_snr': 80},
                '48:8f:5a:80:6f:bd': {       'alt_macs': None,
                                             'dev_macs': {       '28:76:10:1c:e7:9b',
                                                                 '28:76:10:1c:e7:9c',
                                                                 '78:9a:18:6b:54:d2',
                                                                 'cc:2d:e0:91:c8:60',
                                                                 'ec:13:b2:92:98:30'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '48:8f:5a:80:6f:bd',
                                             'name': 'Peppertree Bldg A',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -149.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -69,
                                             'ul_snr': 80},
                '48:8f:5a:80:70:6d': {       'alt_macs': {'48:8f:5a:80:70:6c'},
                                             'dev_macs': set(),
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': 8,
                                             'dl_noise_floor': -149.0,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': -54.0,
                                             'dl_snr': 95.0,
                                             'ip_address': '172.16.149.16',
                                             'mac_address': '48:8f:5a:80:70:6d',
                                             'name': 'PSquare-95090',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': 2310000000,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -145.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -65,
                                             'ul_snr': 80},
                'c4:ad:34:16:d1:8d': {       'alt_macs': {'c4:ad:34:16:d1:8c'},
                                             'dev_macs': set(),
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': 8,
                                             'dl_noise_floor': -152.0,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': -57.0,
                                             'dl_snr': 95.0,
                                             'ip_address': '172.16.149.13',
                                             'mac_address': 'c4:ad:34:16:d1:8d',
                                             'name': 'BJimPizza-91818',
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': 2310000000,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -145.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -65,
                                             'ul_snr': 80}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '311862607548',
                                                              'in_ucast_pkts': '1400824396',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '18:fd:74:15:00:04',
                                                                                                                        '28:76:10:1b:b7:97',
                                                                                                                        '28:76:10:1b:b7:98',
                                                                                                                        '28:76:10:23:e7:1c',
                                                                                                                        '28:76:10:23:fe:89',
                                                                                                                        '28:76:10:23:ff:59',
                                                                                                                        '48:a9:8a:0a:ab:39',
                                                                                                                        '78:9a:18:3e:bc:bd',
                                                                                                                        '78:9a:18:6b:62:56',
                                                                                                                        'c4:ad:34:83:c0:0a',
                                                                                                                        'cc:2d:e0:91:c8:84',
                                                                                                                        'ec:13:b2:91:a1:ee'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '196247864743',
                                                                                       'in_ucast_pkts': '902188410',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a2:30:cc',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '2671994284470',
                                                                                       'out_ucast_pkts': '2802346615'},
                                                                               {       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '7987428882',
                                                                                       'in_ucast_pkts': '41617696',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:80:70:6d',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '114334030334',
                                                                                       'out_ucast_pkts': '856284657'},
                                                                               {       'bridged_mac_addresses': [       '18:fd:74:92:fd:d7',
                                                                                                                        '18:fd:74:94:86:a8',
                                                                                                                        '28:76:10:1a:0e:04',
                                                                                                                        '28:76:10:1a:0e:05',
                                                                                                                        '28:76:10:23:f4:69',
                                                                                                                        '48:8f:5a:4e:c3:da',
                                                                                                                        'dc:2c:6e:62:08:28',
                                                                                                                        'ec:13:b2:91:e0:40'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '75256034566',
                                                                                       'in_ucast_pkts': '218711045',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:80:6f:ad',
                                                                                       'out_discards': '384',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '851407291920',
                                                                                       'out_ucast_pkts': '1412008130'},
                                                                               {       'bridged_mac_addresses': [       '28:76:10:1c:e7:9b',
                                                                                                                        '28:76:10:1c:e7:9c',
                                                                                                                        '78:9a:18:6b:54:d2',
                                                                                                                        'cc:2d:e0:91:c8:60',
                                                                                                                        'ec:13:b2:92:98:30'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '31361794272',
                                                                                       'in_ucast_pkts': '219273731',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '48:8f:5a:80:6f:bd',
                                                                                       'out_discards': '0',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '856489079824',
                                                                                       'out_ucast_pkts': '1368691702'},
                                                                               {       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '1009485085',
                                                                                       'in_ucast_pkts': '19033514',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': 'c4:ad:34:16:d1:8d',
                                                                                       'out_discards': '132490',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '52486689075',
                                                                                       'out_ucast_pkts': '797083257'}],
                                                              'mac_address': '48:8f:5a:cf:51:7a',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '132874',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '4546711375623',
                                                              'out_ucast_pkts': '7236414361',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'distance': 253,
                                                                                                                                            'mac_address': '04:d6:aa:a2:30:cc',
                                                                                                                                            'noise_floor': -142.0,
                                                                                                                                            'rssi': -62.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 276,
                                                                                                                                            'mac_address': '48:8f:5a:80:70:6d',
                                                                                                                                            'noise_floor': -145.0,
                                                                                                                                            'rssi': -65.0,
                                                                                                                                            'rx_link_rate': '2310000000',
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000',
                                                                                                                                            'tx_mcs': 8},
                                                                                                                                    {       'distance': 278,
                                                                                                                                            'mac_address': '48:8f:5a:80:6f:ad',
                                                                                                                                            'noise_floor': -146.0,
                                                                                                                                            'rssi': -66.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 213,
                                                                                                                                            'mac_address': '48:8f:5a:80:6f:bd',
                                                                                                                                            'noise_floor': -149.0,
                                                                                                                                            'rssi': -69.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'mac_address': 'c4:ad:34:16:d1:8d',
                                                                                                                                            'noise_floor': -145.0,
                                                                                                                                            'rssi': -65.0,
                                                                                                                                            'rx_link_rate': '2310000000',
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 80.0,
                                                                                                                                            'tx_link_rate': '2310000000',
                                                                                                                                            'tx_mcs': 8}],
                                                                                                                   'noise_floor': -142.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'PRWN-KGNC-NNW-60'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '801314127',
                                                              'in_octets': '4335758218660',
                                                              'in_ucast_pkts': '4030055018',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '48:8f:5a:cf:51:79',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '3877463',
                                                              'out_octets': '310196256916',
                                                              'out_ucast_pkts': '1345678337',
                                                              'speed': '1000000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.300293,
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'SI9az1F6',
                                'serial_number': 'D6910C752CBC',
                                'sw_version': '6.49.5',
                                'system_mac_address': '48:8f:5a:cf:51:79',
                                'uptime': '1768303'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '2671994284470',
                                                                       'in_ucast_pkts': '2802346615',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '2671994284470',
                                                                                                'in_ucast_pkts': '2802346615',
                                                                                                'mac_address': '48:8f:5a:cf:51:7a',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '196247864743',
                                                                                                'out_ucast_pkts': '902188410'}],
                                                                       'mac_address': '04:d6:aa:a2:30:cc',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '196247864743',
                                                                       'out_ucast_pkts': '902188410',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 253,
                                                                                                                                                     'mac_address': '48:8f:5a:cf:51:7a',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'PRWN-KGNC-NNW-60'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '196247864743',
                                                                       'in_ucast_pkts': '902188410',
                                                                       'name': 'ether1',
                                                                       'out_octets': '2671994284470',
                                                                       'out_ucast_pkts': '2802346615',
                                                                       'poller_hash': 'MDRkNmFhYTIzMGNjZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': 'Peppertree-KGNC',
                                         'poller_hash': 'BNaqojDM',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.49'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '114334030334',
                                                                       'in_ucast_pkts': '856284657',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '114334030334',
                                                                                                'in_ucast_pkts': '856284657',
                                                                                                'mac_address': '48:8f:5a:cf:51:7a',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '7987428882',
                                                                                                'out_ucast_pkts': '41617696'}],
                                                                       'mac_address': '48:8f:5a:80:70:6d',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '7987428882',
                                                                       'out_ucast_pkts': '41617696',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 276,
                                                                                                                                                     'mac_address': '48:8f:5a:cf:51:7a',
                                                                                                                                                     'noise_floor': -149.0,
                                                                                                                                                     'rssi': -54.0,
                                                                                                                                                     'rx_link_rate': '2310000000',
                                                                                                                                                     'rx_mcs': 8,
                                                                                                                                                     'snr': 95.0,
                                                                                                                                                     'tx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'PRWN-KGNC-NNW-60'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '7987428882',
                                                                       'in_ucast_pkts': '41617696',
                                                                       'name': 'ether1',
                                                                       'out_octets': '114334030334',
                                                                       'out_ucast_pkts': '856284657',
                                                                       'poller_hash': 'NDg4ZjVhODA3MDZkZXRoZXIx'}],
                                         'management_ip': '172.16.149.16',
                                         'manufacturer': 'Mikrotik',
                                         'model': 'RBwAPG-60ad-SA',
                                         'name': 'PSquare-95090',
                                         'poller_hash': 'SI9agHBt',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.49.5'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '384',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '851407291920',
                                                                       'in_ucast_pkts': '1412008130',
                                                                       'links': [       {       'in_discards': '384',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '851407291920',
                                                                                                'in_ucast_pkts': '1412008130',
                                                                                                'mac_address': '48:8f:5a:cf:51:7a',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '75256034566',
                                                                                                'out_ucast_pkts': '218711045'}],
                                                                       'mac_address': '48:8f:5a:80:6f:ad',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '75256034566',
                                                                       'out_ucast_pkts': '218711045',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 278,
                                                                                                                                                     'mac_address': '48:8f:5a:cf:51:7a',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'PRWN-KGNC-NNW-60'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '75256034566',
                                                                       'in_ucast_pkts': '218711045',
                                                                       'name': 'ether1',
                                                                       'out_octets': '851407291920',
                                                                       'out_ucast_pkts': '1412008130',
                                                                       'poller_hash': 'NDg4ZjVhODA2ZmFkZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': 'Peppertree Bldg C',
                                         'poller_hash': 'SI9agG+t',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.45.8'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '0',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '856489079824',
                                                                       'in_ucast_pkts': '1368691702',
                                                                       'links': [       {       'in_discards': '0',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '856489079824',
                                                                                                'in_ucast_pkts': '1368691702',
                                                                                                'mac_address': '48:8f:5a:cf:51:7a',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '31361794272',
                                                                                                'out_ucast_pkts': '219273731'}],
                                                                       'mac_address': '48:8f:5a:80:6f:bd',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '31361794272',
                                                                       'out_ucast_pkts': '219273731',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 213,
                                                                                                                                                     'mac_address': '48:8f:5a:cf:51:7a',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'PRWN-KGNC-NNW-60'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '31361794272',
                                                                       'in_ucast_pkts': '219273731',
                                                                       'name': 'ether1',
                                                                       'out_octets': '856489079824',
                                                                       'out_ucast_pkts': '1368691702',
                                                                       'poller_hash': 'NDg4ZjVhODA2ZmJkZXRoZXIx'}],
                                         'manufacturer': 'Mikrotik',
                                         'name': 'Peppertree Bldg A',
                                         'poller_hash': 'SI9agG+9',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.45.8'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '132490',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '52486689075',
                                                                       'in_ucast_pkts': '797083257',
                                                                       'links': [       {       'in_discards': '132490',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '52486689075',
                                                                                                'in_ucast_pkts': '797083257',
                                                                                                'mac_address': '48:8f:5a:cf:51:7a',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '1009485085',
                                                                                                'out_ucast_pkts': '19033514'}],
                                                                       'mac_address': 'c4:ad:34:16:d1:8d',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '1009485085',
                                                                       'out_ucast_pkts': '19033514',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': '48:8f:5a:cf:51:7a',
                                                                                                                                                     'noise_floor': -152.0,
                                                                                                                                                     'rssi': -57.0,
                                                                                                                                                     'rx_link_rate': '2310000000',
                                                                                                                                                     'rx_mcs': 8,
                                                                                                                                                     'snr': 95.0,
                                                                                                                                                     'tx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'PRWN-KGNC-NNW-60'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '1009485085',
                                                                       'in_ucast_pkts': '19033514',
                                                                       'name': 'ether1',
                                                                       'out_octets': '52486689075',
                                                                       'out_ucast_pkts': '797083257',
                                                                       'poller_hash': 'YzRhZDM0MTZkMThkZXRoZXIx'}],
                                         'management_ip': '172.16.149.13',
                                         'manufacturer': 'Mikrotik',
                                         'model': 'RBwAPG-60ad-SA',
                                         'name': 'BJimPizza-91818',
                                         'poller_hash': 'xK00FtGN',
                                         'status': 'ELEMENT_STATUS_ONLINE',
                                         'sw_version': '6.49.5'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))

    def test_mikrotik_mikrotik_60g_RBwAPG_60ad_SA_None_01(self):
        obj = self.run_data("mikrotik.mikrotik-60g.RBwAPG-60ad-SA.None.01")
        exp_info = {
                'model': 'RBwAPG-60ad-SA',
                'rf_chan_width': 2160,
                'rf_freq': 58320,
                'sta_count': 2,
                'sw_version': None,
                'vendor': 'Mikrotik'
        }
        exp_stats = {
                'cpu': 0,
                'dl_en_bytes': 1097824374322,
                'dl_en_packets': 790490733,
                'dl_noise_floor': None,
                'dl_rf_bytes': 1101033244651,
                'dl_rf_packets': 923003845,
                'en_if_speed': 100000000,
                'mem': 20.81146240234375,
                'serial_number': None,
                'ssid': 'Bethel.West',
                'system_mac_address': '74:4d:28:0c:d2:ef',
                'ul_en_bytes': 49799012895,
                'ul_en_packets': 478755986,
                'ul_noise_floor': None,
                'ul_rf_bytes': 52215879793,
                'ul_rf_packets': 615205714
        }
        exp_sta_stats = {
                '04:d6:aa:a8:4d:f5': {       'alt_macs': None,
                                             'dev_macs': set(),
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:4d:f5',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -119.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -69,
                                             'ul_snr': 50},
                '04:d6:aa:a8:d2:a9': {       'alt_macs': None,
                                             'dev_macs': {'74:4d:28:0c:d2:f0'},
                                             'dl_link_rate': 2310000000,
                                             'dl_mcs': None,
                                             'dl_noise_floor': None,
                                             'dl_rf_bytes': None,
                                             'dl_rf_packets': None,
                                             'dl_rssi': None,
                                             'dl_snr': None,
                                             'ip_address': None,
                                             'mac_address': '04:d6:aa:a8:d2:a9',
                                             'name': None,
                                             'serial_number': None,
                                             'ssid': None,
                                             'system_mac_address': None,
                                             'ul_link_rate': None,
                                             'ul_mcs': 8,
                                             'ul_noise_floor': -130.0,
                                             'ul_rf_bytes': None,
                                             'ul_rf_packets': None,
                                             'ul_rssi': -65,
                                             'ul_snr': 65}
        }
        exp_ne_msg = {
                'data': {       'cpu': 0.0,
                                'interfaces': [       {       'admin_up': True,
                                                              'id': '1',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '0',
                                                              'in_octets': '52215879793',
                                                              'in_ucast_pkts': '615205714',
                                                              'in_unknown_protos': '0',
                                                              'links': [       {       'bridged_mac_addresses': [       '74:4d:28:0c:d2:f0'],
                                                                                       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '43334597569',
                                                                                       'in_ucast_pkts': '490165588',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:d2:a9',
                                                                                       'out_discards': '497',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '1041580698619',
                                                                                       'out_ucast_pkts': '784506368'},
                                                                               {       'in_discards': '0',
                                                                                       'in_errors': '0',
                                                                                       'in_nucast_pkts': '0',
                                                                                       'in_octets': '8881282224',
                                                                                       'in_ucast_pkts': '125040126',
                                                                                       'in_unknown_protos': '0',
                                                                                       'mac_address': '04:d6:aa:a8:4d:f5',
                                                                                       'out_discards': '2638',
                                                                                       'out_errors': '0',
                                                                                       'out_nucast_pkts': '0',
                                                                                       'out_octets': '59452546032',
                                                                                       'out_ucast_pkts': '138497477'}],
                                                              'mac_address': '74:4d:28:0c:d2:f0',
                                                              'mtu': 1500,
                                                              'name': 'wlan60-1',
                                                              'oper_up': True,
                                                              'out_discards': '3135',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '0',
                                                              'out_octets': '1101033244651',
                                                              'out_ucast_pkts': '923003845',
                                                              'radios': [       {       'chan_width': 2160,
                                                                                        'framing': 'FLEXIBLE',
                                                                                        'frequency': 58320,
                                                                                        'id': '1',
                                                                                        'streams': [       {       'id': '1',
                                                                                                                   'links': [       {       'mac_address': '04:d6:aa:a8:d2:a9',
                                                                                                                                            'noise_floor': -130.0,
                                                                                                                                            'rssi': -65.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 65.0,
                                                                                                                                            'tx_link_rate': '2310000000'},
                                                                                                                                    {       'distance': 134,
                                                                                                                                            'mac_address': '04:d6:aa:a8:4d:f5',
                                                                                                                                            'noise_floor': -119.0,
                                                                                                                                            'rssi': -69.0,
                                                                                                                                            'rx_mcs': 8,
                                                                                                                                            'snr': 50.0,
                                                                                                                                            'tx_link_rate': '2310000000'}],
                                                                                                                   'noise_floor': -119.0}]}],
                                                              'sectors': [       {       'mode': 'AP',
                                                                                         'ssid': 'Bethel.West'}],
                                                              'speed': '2310000000',
                                                              'type': 71},
                                                      {       'admin_up': True,
                                                              'id': '2',
                                                              'in_discards': '0',
                                                              'in_errors': '0',
                                                              'in_nucast_pkts': '6218299',
                                                              'in_octets': '1097824374322',
                                                              'in_ucast_pkts': '784272434',
                                                              'in_unknown_protos': '0',
                                                              'mac_address': '74:4d:28:0c:d2:ef',
                                                              'mtu': 1500,
                                                              'name': 'ether1',
                                                              'oper_up': True,
                                                              'out_discards': '0',
                                                              'out_errors': '0',
                                                              'out_nucast_pkts': '1442205',
                                                              'out_octets': '49799012895',
                                                              'out_ucast_pkts': '477313781',
                                                              'speed': '100000000',
                                                              'type': 6}],
                                'manufacturer': 'Mikrotik',
                                'mem': 20.811462,
                                'model': 'RBwAPG-60ad-SA',
                                'poller_hash': 'dE0oDNLw',
                                'system_mac_address': '74:4d:28:0c:d2:ef',
                                'uptime': '9145270'},
                'peers': [       {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '497',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '1041580698619',
                                                                       'in_ucast_pkts': '784506368',
                                                                       'links': [       {       'in_discards': '497',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '1041580698619',
                                                                                                'in_ucast_pkts': '784506368',
                                                                                                'mac_address': '74:4d:28:0c:d2:f0',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '43334597569',
                                                                                                'out_ucast_pkts': '490165588'}],
                                                                       'mac_address': '04:d6:aa:a8:d2:a9',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '43334597569',
                                                                       'out_ucast_pkts': '490165588',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'mac_address': '74:4d:28:0c:d2:f0',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Bethel.West'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '43334597569',
                                                                       'in_ucast_pkts': '490165588',
                                                                       'name': 'ether1',
                                                                       'out_octets': '1041580698619',
                                                                       'out_ucast_pkts': '784506368',
                                                                       'poller_hash': 'MDRkNmFhYThkMmE5ZXRoZXIx'}],
                                         'poller_hash': 'BNaqqNKp',
                                         'status': 'ELEMENT_STATUS_ONLINE'},
                                 {       'interfaces': [       {       'admin_up': True,
                                                                       'id': '1',
                                                                       'in_discards': '2638',
                                                                       'in_errors': '0',
                                                                       'in_nucast_pkts': '0',
                                                                       'in_octets': '59452546032',
                                                                       'in_ucast_pkts': '138497477',
                                                                       'links': [       {       'in_discards': '2638',
                                                                                                'in_errors': '0',
                                                                                                'in_nucast_pkts': '0',
                                                                                                'in_octets': '59452546032',
                                                                                                'in_ucast_pkts': '138497477',
                                                                                                'mac_address': '74:4d:28:0c:d2:f0',
                                                                                                'out_discards': '0',
                                                                                                'out_errors': '0',
                                                                                                'out_nucast_pkts': '0',
                                                                                                'out_octets': '8881282224',
                                                                                                'out_ucast_pkts': '125040126'}],
                                                                       'mac_address': '04:d6:aa:a8:4d:f5',
                                                                       'name': 'wlan60-1',
                                                                       'oper_up': True,
                                                                       'out_discards': '0',
                                                                       'out_errors': '0',
                                                                       'out_nucast_pkts': '0',
                                                                       'out_octets': '8881282224',
                                                                       'out_ucast_pkts': '125040126',
                                                                       'radios': [       {       'chan_width': 2160,
                                                                                                 'framing': 'FLEXIBLE',
                                                                                                 'frequency': 58320,
                                                                                                 'id': '1',
                                                                                                 'streams': [       {       'id': '1',
                                                                                                                            'links': [       {       'distance': 134,
                                                                                                                                                     'mac_address': '74:4d:28:0c:d2:f0',
                                                                                                                                                     'rx_link_rate': '2310000000'}]}]}],
                                                                       'sectors': [       {       'mode': 'STA',
                                                                                                  'ssid': 'Bethel.West'}]},
                                                               {       'id': '2',
                                                                       'in_octets': '8881282224',
                                                                       'in_ucast_pkts': '125040126',
                                                                       'name': 'ether1',
                                                                       'out_octets': '59452546032',
                                                                       'out_ucast_pkts': '138497477',
                                                                       'poller_hash': 'MDRkNmFhYTg0ZGY1ZXRoZXIx'}],
                                         'poller_hash': 'BNaqqE31',
                                         'status': 'ELEMENT_STATUS_ONLINE'}]
        }
        id_field = 'mac_address' if not obj.stations else ('mac_address' if hasattr(obj.stations[0], 'mac_address') and getattr(obj.stations[0], 'mac_address') else ('imsi' if hasattr(obj.stations[0], 'imsi') else 'serial'))
        cur_info = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('info', 'ap', obj.model) + [('vendor', 'str'), ('model', 'str'), ('sw_version', 'str')]}
        if 'rf_freq' in cur_info and cur_info.get('rf_freq') and (cur_info['rf_freq'] <= 0 or int.bit_length(cur_info['rf_freq']) >= 32):
            cur_info.pop('rf_freq')
        cur_stats = {x: getattr(obj, x, None) for (x, data_type) in self.apdd.get_metric_fields('stats', 'ap', obj.model)}
        cur_sta_stats = {getattr(sta, id_field): {x: getattr(sta, x, None) for (x, data_type) in sorted(self.apdd.get_metric_fields('stats', 'cpe', obj.model)) + [(id_field, 'str'), ('ip_address', 'str'), ('name', 'str'), ('dev_macs', 'str')]} for sta in sorted(obj.stations)}
        cur_ne_msg = getattr(obj, 'network_element_update_msg', None)
        cur_ne_msg = cur_ne_msg.pb if cur_ne_msg else None
        self.assertEqual(cur_info, exp_info)
        self.assertEqual(cur_stats, exp_stats)
        self.assertEqual(cur_sta_stats, exp_sta_stats)
        self.assertTrue(self.compare_pb_dict(cur_ne_msg, exp_ne_msg))
