From d49c345b9b0fe6bddf177c543de11c0c662d1ff9 Mon Sep 17 00:00:00 2001 From: Mykola F <37578614+mykolaf@users.noreply.github.com> Date: Thu, 19 Jul 2018 01:20:55 +0300 Subject: [PATCH] [lldp] add new OIDs - lldpRemTable & lldpLocPortTable (#70) * [lldp] add new OIDs - lldpRemTable & lldpLocPortTable * [lldp] add new OIDs - lldpLocalSystemData * pr comments - change mock table indent, remove commented out code, imports ordering * pr comments - avoid updating data too frequently --- src/sonic_ax_impl/main.py | 1 + src/sonic_ax_impl/mibs/__init__.py | 1 + src/sonic_ax_impl/mibs/ieee802_1ab.py | 284 ++++++++-- tests/mock_tables/appl_db.json | 728 +++++++++++++++++++------- tests/test_lldp.py | 35 +- 5 files changed, 799 insertions(+), 250 deletions(-) diff --git a/src/sonic_ax_impl/main.py b/src/sonic_ax_impl/main.py index 682fecaaea07..b428778c0984 100644 --- a/src/sonic_ax_impl/main.py +++ b/src/sonic_ax_impl/main.py @@ -30,6 +30,7 @@ class SonicMIB( rfc4292.IpCidrRouteTable, ieee802_1ab.LLDPLocPortTable, ieee802_1ab.LLDPRemTable, + ieee802_1ab.LLDPLocalSystemData, dell.force10.SSeriesMIB, cisco.ciscoPfcExtMIB.cpfcIfTable, cisco.ciscoPfcExtMIB.cpfcIfPriorityTable, diff --git a/src/sonic_ax_impl/mibs/__init__.py b/src/sonic_ax_impl/mibs/__init__.py index 38aa6f10371e..7bae8497ba52 100644 --- a/src/sonic_ax_impl/mibs/__init__.py +++ b/src/sonic_ax_impl/mibs/__init__.py @@ -10,6 +10,7 @@ COUNTERS_QUEUE_NAME_MAP = b'COUNTERS_QUEUE_NAME_MAP' LAG_TABLE = b'LAG_TABLE' LAG_MEMBER_TABLE = b'LAG_MEMBER_TABLE' +LOC_CHASSIS_TABLE = b'LLDP_LOC_CHASSIS' APPL_DB = 'APPL_DB' ASIC_DB = 'ASIC_DB' COUNTERS_DB = 'COUNTERS_DB' diff --git a/src/sonic_ax_impl/mibs/ieee802_1ab.py b/src/sonic_ax_impl/mibs/ieee802_1ab.py index 6b50c2456912..793a6c92390a 100644 --- a/src/sonic_ax_impl/mibs/ieee802_1ab.py +++ b/src/sonic_ax_impl/mibs/ieee802_1ab.py @@ -5,7 +5,8 @@ from bisect import bisect_right from sonic_ax_impl import mibs, logger -from ax_interface import MIBMeta, SubtreeMIBEntry, MIBUpdater, ValueType +from ax_interface import MIBMeta, SubtreeMIBEntry, MIBEntry, MIBUpdater, ValueType + @unique class LLDPRemoteTables(int, Enum): @@ -13,8 +14,8 @@ class LLDPRemoteTables(int, Enum): REDIS_KEY_NAME <--> OID_INDEX """ lldp_rem_time_mark = 1 - # lldp_rem_local_port_num = 2 - # lldp_rem_index = 3 + lldp_rem_local_port_num = 2 + lldp_rem_index = 3 lldp_rem_chassis_id_subtype = 4 lldp_rem_chassis_id = 5 lldp_rem_port_id_subtype = 6 @@ -22,8 +23,179 @@ class LLDPRemoteTables(int, Enum): lldp_rem_port_desc = 8 lldp_rem_sys_name = 9 lldp_rem_sys_desc = 10 - # lldp_rem_sys_cap_supported = 11 - # lldp_rem_sys_cap_enabled = 12 + lldp_rem_sys_cap_supported = 11 + lldp_rem_sys_cap_enabled = 12 + +@unique +class LLDPLocalChassis(int, Enum): + """ + REDIS_KEY_NAME <--> OID_INDEX + """ + lldp_loc_chassis_id_subtype = 1 + lldp_loc_chassis_id = 2 + lldp_loc_sys_name = 3 + lldp_loc_sys_desc = 4 + # *lldp_rem_sys_cap_supported = 5 + # *lldp_rem_sys_cap_enabled = 6 + + +class LocPortUpdater(MIBUpdater): + + def __init__(self): + super().__init__() + + self.db_conn = mibs.init_db() + self.if_name_map = {} + self.if_alias_map = {} + self.if_id_map = {} + self.oid_sai_map = {} + self.oid_name_map = {} + self.if_range = [] + + # cache of port data + # { if_name -> { 'key': 'value' } } + self.loc_port_data = {} + self.pubsub = None + + def reinit_data(self): + """ + Subclass update interface information + """ + self.if_name_map, \ + self.if_alias_map, \ + self.if_id_map, \ + self.oid_sai_map, \ + self.oid_name_map = mibs.init_sync_d_interface_tables(self.db_conn) + + # establish connection to application database. + self.db_conn.connect(mibs.APPL_DB) + self.if_range = [] + # get local port kvs from APP_BD's PORT_TABLE + self.loc_port_data = {} + for if_oid, if_name in self.oid_name_map.items(): + self.update_interface_data(if_name) + self.if_range.append((if_oid, )) + self.if_range.sort() + if not self.loc_port_data: + logger.warning("0 - b'PORT_TABLE' is empty. No local port information could be retrieved.") + + def update_interface_data(self, if_name): + """ + Update data from the DB for a single interface + """ + loc_port_kvs = self.db_conn.get_all(mibs.APPL_DB, mibs.if_entry_table(bytes(if_name, 'utf-8'))) + if not loc_port_kvs: + return + self.loc_port_data.update({if_name: loc_port_kvs}) + + def get_next(self, sub_id): + """ + :param sub_id: The 1-based sub-identifier query. + :return: the next sub id. + """ + right = bisect_right(self.if_range, sub_id) + if right == len(self.if_range): + return None + return self.if_range[right] + + def update_data(self): + """ + Listen to updates in APP DB, update local cache + """ + if not self.pubsub: + redis_client = self.db_conn.get_redis_client(self.db_conn.APPL_DB) + db = self.db_conn.db_map[self.db_conn.APPL_DB]["db"] + self.pubsub = redis_client.pubsub() + self.pubsub.psubscribe("__keyspace@{}__:{}".format(db, "LLDP_ENTRY_TABLE:*")) + + while True: + msg = self.pubsub.get_message() + + if not msg: + break + + lldp_entry = msg["channel"].split(b":")[-1].decode() + data = msg['data'] # event data + + # extract interface name + interface = lldp_entry.split('|')[-1] + # get interface from interface name + if_index = port_util.get_index_from_str(interface) + + if if_index is None: + # interface name invalid, skip this entry + logger.warning("Invalid interface name in {} in APP_DB, skipping" + .format(lldp_entry)) + continue + + if b"set" in data: + self.update_interface_data(interface.encode('utf-8')) + + def local_port_num(self, sub_id): + if len(sub_id) <= 0: + return None + sub_id = sub_id[0] + if sub_id not in self.oid_name_map: + return None + return int(sub_id) + + def local_port_id(self, sub_id): + if len(sub_id) <= 0: + return None + sub_id = sub_id[0] + if sub_id not in self.oid_name_map: + return None + if_name = self.oid_name_map[sub_id] + if if_name not in self.loc_port_data: + # no LLDP data for this interface--we won't report the local interface + return None + return self.if_alias_map[if_name] + + def port_table_lookup(self, sub_id, table_name): + if len(sub_id) <= 0: + return None + sub_id = sub_id[0] + if sub_id not in self.oid_name_map: + return None + if_name = self.oid_name_map[sub_id] + if if_name not in self.loc_port_data: + # no data for this interface + return None + counters = self.loc_port_data[if_name] + _table_name = bytes(getattr(table_name, 'name', table_name), 'utf-8') + try: + return counters[_table_name] + except KeyError as e: + logger.warning(" 0 - b'PORT_TABLE' missing attribute '{}'.".format(e)) + return None + + +class LLDPLocalSystemDataUpdater(MIBUpdater): + def __init__(self): + super().__init__() + + self.db_conn = mibs.init_db() + self.loc_chassis_data = {} + + def reinit_data(self): + """ + Subclass update data routine. + """ + # establish connection to application database. + self.db_conn.connect(mibs.APPL_DB) + self.loc_chassis_data = self.db_conn.get_all(mibs.APPL_DB, mibs.LOC_CHASSIS_TABLE) + + def table_lookup(self, table_name): + try: + _table_name = bytes(getattr(table_name, 'name', table_name), 'utf-8') + return self.loc_chassis_data[_table_name] + except KeyError as e: + mibs.logger.warning(" 0 - b'LOC_CHASSIS' missing attribute '{}'.".format(e)) + return None + + def table_lookup_integer(self, table_name): + subtype_str = self.table_lookup(table_name) + return int(subtype_str) if subtype_str is not None else None class LLDPUpdater(MIBUpdater): @@ -79,17 +251,13 @@ def update_data(self): self.lldp_counters.update({if_name: lldp_kvs}) self.if_range.sort() - def local_port_id(self, sub_id): + def local_port_num(self, sub_id): if len(sub_id) <= 0: return None sub_id = sub_id[0] if sub_id not in self.oid_name_map: return None - if_name = self.oid_name_map[sub_id] - if if_name not in self.lldp_counters: - # no LLDP data for this interface--we won't report the local interface - return None - return self.if_alias_map[if_name] + return int(sub_id) def lldp_table_lookup(self, sub_id, table_name): if len(sub_id) <= 0: @@ -120,22 +288,56 @@ def lldp_table_lookup_integer(self, sub_id, table_name): _lldp_updater = LLDPUpdater() +_port_updater = LocPortUpdater() +_chassis_updater = LLDPLocalSystemDataUpdater() + + +class LLDPLocalSystemData(metaclass=MIBMeta, prefix='.1.0.8802.1.1.2.1.3'): + """ + + """ + chassis_updater = _chassis_updater + lldpLocChassisIdSubtype = MIBEntry('1', ValueType.INTEGER, chassis_updater.table_lookup_integer, LLDPLocalChassis(1)) + + lldpLocChassisId = MIBEntry('2', ValueType.OCTET_STRING, chassis_updater.table_lookup, LLDPLocalChassis(2)) + + lldpLocSysName = MIBEntry('3', ValueType.OCTET_STRING, chassis_updater.table_lookup, LLDPLocalChassis(3)) + + lldpLocSysDesc = MIBEntry('4', ValueType.OCTET_STRING, chassis_updater.table_lookup, LLDPLocalChassis(4)) + class LLDPLocPortTable(metaclass=MIBMeta, prefix='.1.0.8802.1.1.2.1.3.7'): """ - 'lldpLocPortTable' + lldpLocPortTable OBJECT-TYPE + SYNTAX SEQUENCE OF LldpLocPortEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table contains one or more rows per port information + associated with the local system known to this agent." + ::= { lldpLocalSystemData 7 } + + LldpLocPortEntry ::= SEQUENCE { + lldpLocPortNum LldpPortNumber, + lldpLocPortIdSubtype LldpPortIdSubtype, + lldpLocPortId LldpPortId, + lldpLocPortDesc SnmpAdminString + } + """ - lldp_updater = _lldp_updater + port_updater = _port_updater # lldpLocPortEntry = '1' - # lldpLocPortNum = '1.1' + lldpLocPortNum = SubtreeMIBEntry('1.1', port_updater, ValueType.INTEGER, port_updater.local_port_num) - # lldpLocPortIdSubtype = '1.2' + # We're using interface name as port id, so according to textual convention, the subtype is 5 + lldpLocPortIdSubtype = SubtreeMIBEntry('1.2', port_updater, ValueType.INTEGER, lambda _: 5) - lldpLocPortId = SubtreeMIBEntry('1.3', lldp_updater, ValueType.OCTET_STRING, lldp_updater.local_port_id) + lldpLocPortId = SubtreeMIBEntry('1.3', port_updater, ValueType.OCTET_STRING, port_updater.local_port_id) - # lldpLocPortDesc = '1.4' + lldpLocPortDesc = SubtreeMIBEntry('1.4', port_updater, ValueType.OCTET_STRING, port_updater.port_table_lookup, + "description") class LLDPRemTable(metaclass=MIBMeta, prefix='.1.0.8802.1.1.2.1.4.1'): @@ -230,50 +432,48 @@ class LLDPRemTable(metaclass=MIBMeta, prefix='.1.0.8802.1.1.2.1.4.1'): lldpRemTimeMark = \ SubtreeMIBEntry('1.1', lldp_updater, ValueType.TIME_TICKS, lldp_updater.lldp_table_lookup_integer, - LLDPRemoteTables(1)) + LLDPRemoteTables(1)) + + lldpRemLocalPortNum = \ + SubtreeMIBEntry('1.2', lldp_updater, ValueType.INTEGER, lldp_updater.local_port_num) - # TODO: Impl. - # lldpRemLocalPortNum = \ - # ContextualMIBEntry('1.2', if_range, ValueType.INTEGER, lldp_updater.lldp_subtype_id, - # LLDPRemoteTables(2)) - # TODO: Impl. - # lldpRemIndex = \ - # ContextualMIBEntry('1.3', if_range, ValueType.INTEGER, lldp_updater.lldp_subtype_id, - # LLDPRemoteTables(3)) + lldpRemIndex = \ + SubtreeMIBEntry('1.3', lldp_updater, ValueType.INTEGER, lldp_updater.lldp_table_lookup_integer, + LLDPRemoteTables(3)) lldpRemChassisIdSubtype = \ SubtreeMIBEntry('1.4', lldp_updater, ValueType.INTEGER, lldp_updater.lldp_table_lookup_integer, - LLDPRemoteTables(4)) + LLDPRemoteTables(4)) lldpRemChassisId = \ SubtreeMIBEntry('1.5', lldp_updater, ValueType.OCTET_STRING, lldp_updater.lldp_table_lookup, - LLDPRemoteTables(5)) + LLDPRemoteTables(5)) lldpRemPortIdSubtype = \ SubtreeMIBEntry('1.6', lldp_updater, ValueType.INTEGER, lldp_updater.lldp_table_lookup_integer, - LLDPRemoteTables(6)) + LLDPRemoteTables(6)) lldpRemPortId = \ SubtreeMIBEntry('1.7', lldp_updater, ValueType.OCTET_STRING, lldp_updater.lldp_table_lookup, - LLDPRemoteTables(7)) + LLDPRemoteTables(7)) lldpRemPortDesc = \ SubtreeMIBEntry('1.8', lldp_updater, ValueType.OCTET_STRING, lldp_updater.lldp_table_lookup, - LLDPRemoteTables(8)) + LLDPRemoteTables(8)) lldpRemSysName = \ SubtreeMIBEntry('1.9', lldp_updater, ValueType.OCTET_STRING, lldp_updater.lldp_table_lookup, - LLDPRemoteTables(9)) + LLDPRemoteTables(9)) lldpRemSysDesc = \ SubtreeMIBEntry('1.10', lldp_updater, ValueType.OCTET_STRING, lldp_updater.lldp_table_lookup, - LLDPRemoteTables(10)) - - # TODO: Impl. - # lldpRemSysCapSupported = \ - # ContextualMIBEntry('1.11', if_range, ValueType.INTEGER, lldp_updater.lldp_subtype_id, - # LLDPRemoteTables(11)) - # TODO: Impl. - # lldpRemSysCapEnabled = \ - # ContextualMIBEntry('1.12', if_range, ValueType.INTEGER, lldp_updater.lldp_subtype_id, - # LLDPRemoteTables(12)) + LLDPRemoteTables(10)) + + lldpRemSysCapSupported = \ + SubtreeMIBEntry('1.11', lldp_updater, ValueType.OCTET_STRING, lldp_updater.lldp_table_lookup, + LLDPRemoteTables(11)) + + lldpRemSysCapEnabled = \ + SubtreeMIBEntry('1.12', lldp_updater, ValueType.OCTET_STRING, lldp_updater.lldp_table_lookup, + LLDPRemoteTables(12)) + diff --git a/tests/mock_tables/appl_db.json b/tests/mock_tables/appl_db.json index 77008d9b31de..5ed1d21045ff 100644 --- a/tests/mock_tables/appl_db.json +++ b/tests/mock_tables/appl_db.json @@ -1,333 +1,675 @@ { - "LLDP_ENTRY_TABLE:Ethernet100": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet0": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18544, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18545", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet26" + "lldp_rem_port_id": "Ethernet1" }, "LLDP_ENTRY_TABLE:Ethernet4": { - "lldp_rem_port_id_subtype": 5, + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18543, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18543", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet2" }, - "LLDP_ENTRY_TABLE:Ethernet104": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet8": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18544, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18543", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet27" + "lldp_rem_port_id": "Ethernet3" }, - "LLDP_ENTRY_TABLE:Ethernet0": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet12": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18545, - "lldp_rem_port_desc": "this is a port description", - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18545", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet1" + "lldp_rem_port_id": "Ethernet4" }, - "LLDP_ENTRY_TABLE:Ethernet108": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet16": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18544, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18545", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet28" + "lldp_rem_port_id": "Ethernet5" }, - "LLDP_ENTRY_TABLE:Ethernet8": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet20": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18543, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18545", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet3" + "lldp_rem_port_id": "Ethernet6" }, - "LLDP_ENTRY_TABLE:Ethernet96": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet24": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18543, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "1775", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet25" + "lldp_rem_port_id": "Ethernet7" }, - "LLDP_ENTRY_TABLE:Ethernet92": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet28": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 32, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18513", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet24" + "lldp_rem_port_id": "Ethernet8" }, - "LLDP_ENTRY_TABLE:Ethernet124": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet32": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 4834, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "1142", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet32" + "lldp_rem_port_id": "Ethernet9" }, - "LLDP_ENTRY_TABLE:Ethernet120": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet36": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 3844, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "152", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet31" + "lldp_rem_port_id": "Ethernet10" }, "LLDP_ENTRY_TABLE:Ethernet40": { - "lldp_rem_port_id_subtype": 5, + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 572, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "572", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet11" }, "LLDP_ENTRY_TABLE:Ethernet44": { - "lldp_rem_port_id_subtype": 5, + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 1202, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "1202", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet12" }, "LLDP_ENTRY_TABLE:Ethernet48": { - "lldp_rem_port_id_subtype": 5, + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 1202, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "1202", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet13" }, - "LLDP_ENTRY_TABLE:Ethernet24": { - "lldp_rem_port_id_subtype": 5, - "lldp_rem_chassis_id": "00:11:22:33:44:55", - "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 1775, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, - "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet7" - }, - "LLDP_ENTRY_TABLE:Ethernet68": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet52": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18543, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18543", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet18" - }, - "LLDP_ENTRY_TABLE:eth0": { - "lldp_rem_port_id_subtype": 5, - "lldp_rem_chassis_id": "f4:b5:2f:56:34:00", - "lldp_rem_sys_desc": "I'm going to need you to come in on saturday", - "lldp_rem_time_mark": 18542, - "lldp_rem_port_desc": "TPS report vending machine", - "lldp_rem_chassis_id_subtype": 4, - "lldp_rem_sys_name": "switch218ad08", - "lldp_rem_port_id": "ge-0/0/17" + "lldp_rem_port_id": "Ethernet14" }, - "LLDP_ENTRY_TABLE:Ethernet20": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet56": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18545, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18543", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet6" + "lldp_rem_port_id": "Ethernet15" }, "LLDP_ENTRY_TABLE:Ethernet60": { - "lldp_rem_port_id_subtype": 5, + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18543, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18543", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet16" }, "LLDP_ENTRY_TABLE:Ethernet64": { - "lldp_rem_port_id_subtype": 5, + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18543, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18543", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet17" }, - "LLDP_ENTRY_TABLE:Ethernet112": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet68": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 2103, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18543", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet29" + "lldp_rem_port_id": "Ethernet18" }, - "LLDP_ENTRY_TABLE:Ethernet116": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet72": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 1113, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18543", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet30" + "lldp_rem_port_id": "Ethernet19" }, - "LLDP_ENTRY_TABLE:Ethernet84": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet76": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 362, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18543", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet22" + "lldp_rem_port_id": "Ethernet20" }, "LLDP_ENTRY_TABLE:Ethernet80": { - "lldp_rem_port_id_subtype": 5, + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 362, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "362", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet21" }, + "LLDP_ENTRY_TABLE:Ethernet84": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", + "lldp_rem_chassis_id": "00:11:22:33:44:55", + "lldp_rem_sys_desc": "I'm a little teapot.", + "lldp_rem_time_mark": "362", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", + "lldp_rem_sys_name": "switch13", + "lldp_rem_port_id": "Ethernet22" + }, "LLDP_ENTRY_TABLE:Ethernet88": { - "lldp_rem_port_id_subtype": 5, + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 92, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "92", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet23" }, - "LLDP_ENTRY_TABLE:Ethernet52": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet92": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18543, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "32", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet14" + "lldp_rem_port_id": "Ethernet24" }, - "LLDP_ENTRY_TABLE:Ethernet76": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet96": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18543, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18543", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet20" + "lldp_rem_port_id": "Ethernet25" }, - "LLDP_ENTRY_TABLE:Ethernet56": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet100": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18543, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18544", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet15" + "lldp_rem_port_id": "Ethernet26" }, - "LLDP_ENTRY_TABLE:Ethernet72": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet104": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18543, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18544", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet19" + "lldp_rem_port_id": "Ethernet27" }, - "LLDP_ENTRY_TABLE:Ethernet32": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet108": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 1142, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "18544", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet9" + "lldp_rem_port_id": "Ethernet28" }, - "LLDP_ENTRY_TABLE:Ethernet28": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet112": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18513, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "2103", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet8" + "lldp_rem_port_id": "Ethernet29" }, - "LLDP_ENTRY_TABLE:Ethernet36": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet116": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 152, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "1113", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet10" + "lldp_rem_port_id": "Ethernet30" }, - "LLDP_ENTRY_TABLE:Ethernet16": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet120": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18545, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "3844", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet5" + "lldp_rem_port_id": "Ethernet31" }, - "LLDP_ENTRY_TABLE:Ethernet12": { - "lldp_rem_port_id_subtype": 5, + "LLDP_ENTRY_TABLE:Ethernet124": { + "lldp_rem_port_id_subtype": "5", + "lldp_rem_sys_cap_supported": "28 00", + "lldp_rem_index": "1", "lldp_rem_chassis_id": "00:11:22:33:44:55", "lldp_rem_sys_desc": "I'm a little teapot.", - "lldp_rem_time_mark": 18545, - "lldp_rem_port_desc": null, - "lldp_rem_chassis_id_subtype": 4, + "lldp_rem_time_mark": "4834", + "lldp_rem_sys_cap_enabled": "28 00", + "lldp_rem_port_desc": " ", + "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", - "lldp_rem_port_id": "Ethernet4" + "lldp_rem_port_id": "Ethernet32" + }, + "PORT_TABLE:Ethernet0": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet4": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet8": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet12": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet16": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet20": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet24": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet28": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet32": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet36": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet40": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet44": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet48": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet52": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet56": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet60": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet64": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet68": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet72": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet76": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet80": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet84": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet88": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet92": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet96": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet100": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet104": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet108": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet112": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet116": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet120": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet124": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet0": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet4": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet8": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet12": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet16": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet20": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet24": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet28": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet32": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet36": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet40": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet44": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet48": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet52": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet56": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet60": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet64": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet68": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet72": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet76": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet80": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet84": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet88": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet92": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet96": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet100": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet104": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet108": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet112": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet116": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet120": { + "description": "snowflake", + "speed": 100000 + }, + "PORT_TABLE:Ethernet124": { + "description": "snowflake", + "speed": 100000 }, "ROUTE_TABLE:0.0.0.0/0": { "ifname": "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52", @@ -342,13 +684,13 @@ "ifname": "lo" }, "LAG_MEMBER_TABLE:PortChannel01:Ethernet112": { - "status": "enabled" + "status": "enabled" }, "LAG_MEMBER_TABLE:PortChannel02:Ethernet116": { - "status": "enabled" + "status": "enabled" }, "LAG_MEMBER_TABLE:PortChannel03:Ethernet120": { - "status": "enabled" + "status": "enabled" }, "LAG_MEMBER_TABLE:PortChannel04:Ethernet124": { "status": "enabled" diff --git a/tests/test_lldp.py b/tests/test_lldp.py index b0d40ca046ba..eca49bcbe5a5 100644 --- a/tests/test_lldp.py +++ b/tests/test_lldp.py @@ -5,6 +5,7 @@ sys.path.insert(0, os.path.join(modules_path, 'src')) from unittest import TestCase +import tests.mock_tables.dbconnector from ax_interface import ValueType from ax_interface.pdu_implementations import GetPDU, GetNextPDU @@ -22,9 +23,12 @@ class LLDPMIB(ieee802_1ab.LLDPRemTable, ieee802_1ab.LLDPLocPortTable): pass cls.lut = MIBTable(LLDPMIB) + for updater in cls.lut.updater_instances: + updater.update_data() + updater.reinit_data() + updater.update_data() def test_getnextpdu_eth1(self): - # oid.include = 1 oid = ObjectIdentifier(12, 0, 1, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 1, 1, 7, 1)) get_pdu = GetNextPDU( header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), @@ -35,9 +39,6 @@ def test_getnextpdu_eth1(self): encoded = get_pdu.encode() response = get_pdu.make_response(self.lut) print(response) - - n = len(response.values) - # self.assertEqual(n, 7) value0 = response.values[0] self.assertEqual(value0.type_, ValueType.OCTET_STRING) print("test_getnextpdu_exactmatch: ", str(oid)) @@ -56,28 +57,38 @@ def test_getnextpdu_eth2(self): encoded = get_pdu.encode() response = get_pdu.make_response(self.lut) print(response) - - n = len(response.values) - # self.assertEqual(n, 7) value0 = response.values[0] self.assertEqual(value0.type_, ValueType.OCTET_STRING) print("test_getnextpdu_exactmatch: ", str(oid)) self.assertEqual(str(value0.name), str(ObjectIdentifier(11, 0, 1, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 1, 1, 7, 5)))) self.assertEqual(str(value0.data), "Ethernet2") - def test_subtype(self): - for entry in range(4, 11): + def test_subtype_lldp_rem_table(self): + for entry in range(2, 13): mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 1, 1, entry)] ret = mib_entry(sub_id=(1,)) self.assertIsNotNone(ret) print(ret) + def test_subtype_lldp_loc_port_table(self): + for entry in range(1, 5): + mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 3, 7, 1, entry)] + ret = mib_entry(sub_id=(1,)) + self.assertIsNotNone(ret) + print(ret) + def test_local_port_identification(self): mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 3, 7, 1, 3)] ret = mib_entry(sub_id=(1,)) self.assertEquals(ret, b'Ethernet0') print(ret) + def test_local_port_num(self): + mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 1, 1, 2)] + for num in range(1, 126, 4): + ret = mib_entry(sub_id=(num,)) + self.assertEqual(ret, num) + def test_getnextpdu_local_port_identification(self): # oid.include = 1 oid = ObjectIdentifier(11, 0, 1, 0, (1, 0, 8802, 1, 1, 2, 1, 3, 7, 1, 3)) @@ -88,9 +99,6 @@ def test_getnextpdu_local_port_identification(self): encoded = get_pdu.encode() response = get_pdu.make_response(self.lut) - - n = len(response.values) - # self.assertEqual(n, 7) value0 = response.values[0] self.assertEqual(value0.type_, ValueType.OCTET_STRING) self.assertEqual(str(value0.data), "Ethernet0") @@ -129,9 +137,6 @@ def test_getnextpdu_noeth(self): encoded = get_pdu.encode() response = get_pdu.make_response(self.lut) print(response) - - n = len(response.values) - # self.assertEqual(n, 7) value0 = response.values[0] self.assertEqual(value0.type_, ValueType.END_OF_MIB_VIEW)