From 3194691c61c3cf978c13133b1c7a9626ce6e93e7 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Fri, 12 Mar 2021 19:47:13 +0000 Subject: [PATCH 01/13] Fixes: https://github.com/Azure/sonic-buildimage/issues/7036 https://github.com/Azure/sonic-buildimage/issues/6636 Signed-off-by: Abhishek Dosi --- src/sonic_ax_impl/mibs/ieee802_1ab.py | 59 +++++++++++---------------- tests/mock_tables/appl_db.json | 8 ++-- tests/test_lldp.py | 25 ++++++++++++ 3 files changed, 53 insertions(+), 39 deletions(-) diff --git a/src/sonic_ax_impl/mibs/ieee802_1ab.py b/src/sonic_ax_impl/mibs/ieee802_1ab.py index ac1b3b642..da319ebd3 100644 --- a/src/sonic_ax_impl/mibs/ieee802_1ab.py +++ b/src/sonic_ax_impl/mibs/ieee802_1ab.py @@ -494,10 +494,9 @@ def __init__(self): # establish connection to application database. Namespace.connect_all_dbs(self.db_conn, mibs.APPL_DB) self.if_range = [] - self.mgmt_ips = {} + self.if_with_mgmt_ips = set() self.oid_name_map = {} self.mgmt_oid_name_map = {} - self.mgmt_ip_str = None self.pubsub = [None] * len(self.db_conn) def update_rem_if_mgmt(self, if_oid, if_name): @@ -511,28 +510,27 @@ def update_rem_if_mgmt(self, if_oid, if_name): if len(mgmt_ip_str) == 0: # the peer advertise an emtpy mgmt address return - time_mark = int(lldp_kvs['lldp_rem_time_mark']) - remote_index = int(lldp_kvs['lldp_rem_index']) - subtype = self.get_subtype(mgmt_ip_str) - ip_hex = self.get_ip_hex(mgmt_ip_str, subtype) - if subtype == ManAddrConst.man_addr_subtype_ipv4: - addr_subtype_sub_oid = 4 - mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i) for i in mgmt_ip_str.split('.')]) - elif subtype == ManAddrConst.man_addr_subtype_ipv6: - addr_subtype_sub_oid = 6 - mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i, 16) if i else 0 for i in mgmt_ip_str.split(':')]) - else: - logger.warning("Invalid management IP {}".format(mgmt_ip_str)) - return - self.if_range.append((time_mark, - if_oid, - remote_index, - subtype, - *mgmt_ip_sub_oid)) - - self.mgmt_ips.update({if_name: {"ip_str": mgmt_ip_str, - "addr_subtype": subtype, - "addr_hex": ip_hex}}) + for mgmt_ip in set(mgmt_ip_str.split(',')): + time_mark = int(lldp_kvs['lldp_rem_time_mark']) + remote_index = int(lldp_kvs['lldp_rem_index']) + subtype = self.get_subtype(mgmt_ip) + ip_hex = self.get_ip_hex(mgmt_ip, subtype) + if subtype == ManAddrConst.man_addr_subtype_ipv4: + addr_subtype_sub_oid = 4 + mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i) for i in mgmt_ip.split('.')]) + elif subtype == ManAddrConst.man_addr_subtype_ipv6: + addr_subtype_sub_oid = 6 + mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i, 16) if i else 0 for i in mgmt_ip.split(':')]) + else: + logger.warning("Invalid management IP {}".format(mgmt_ip_str)) + continue + self.if_range.append((time_mark, + if_oid, + remote_index, + subtype, + *mgmt_ip_sub_oid)) + self.if_with_mgmt_ips.add(if_name) + except (KeyError, AttributeError) as e: logger.warning("Error updating remote mgmt addr: {}".format(e)) return @@ -577,7 +575,7 @@ def reinit_data(self): Namespace.connect_all_dbs(self.db_conn, mibs.APPL_DB) self.if_range = [] - self.mgmt_ips = {} + self.if_with_mgmt_ips = set() for if_oid, if_name in self.oid_name_map.items(): self.update_rem_if_mgmt(if_oid, if_name) @@ -594,7 +592,7 @@ def lookup(self, sub_id, callable): 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.mgmt_ips: + if if_name not in self.if_with_mgmt_ips: # no data for this interface return None return callable(sub_id, if_name) @@ -623,15 +621,6 @@ def get_subtype(self, ip_str): logger.warning("Invalid mgmt IP {}".format(ip_str)) return None - def man_addr_subtype(self, sub_id, if_name): - return self.mgmt_ips[if_name]['addr_subtype'] - - def man_addr(self, sub_id, if_name): - """ - :param sub_id: - :return: MGMT IP in HEX - """ - return self.mgmt_ips[if_name]['addr_hex'] @staticmethod def man_addr_if_subtype(sub_id, _): return ManAddrConst.man_addr_if_subtype diff --git a/tests/mock_tables/appl_db.json b/tests/mock_tables/appl_db.json index 784a5212e..b1b079757 100644 --- a/tests/mock_tables/appl_db.json +++ b/tests/mock_tables/appl_db.json @@ -11,7 +11,7 @@ "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet1", - "lldp_rem_man_addr": "10.224.25.100" + "lldp_rem_man_addr": "10.224.25.100,2603:10e2:290:5016::" }, "LLDP_ENTRY_TABLE:Ethernet4": { "lldp_rem_port_id_subtype": "5", @@ -25,7 +25,7 @@ "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet2", - "lldp_rem_man_addr": "fe80::268a:7ff:fe3f:834c" + "lldp_rem_man_addr": "fe80::268a::7ff:fe3f:834c,10.224.25.101" }, "LLDP_ENTRY_TABLE:Ethernet8": { "lldp_rem_port_id_subtype": "5", @@ -53,7 +53,7 @@ "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet4", - "lldp_rem_man_addr": "10.224.25.103" + "lldp_rem_man_addr": "fe80:268a::7ff:fe3f:834c" }, "LLDP_ENTRY_TABLE:Ethernet16": { "lldp_rem_port_id_subtype": "5", @@ -67,7 +67,7 @@ "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet5", - "lldp_rem_man_addr": "10.224.25.104" + "lldp_rem_man_addr": "" }, "LLDP_ENTRY_TABLE:Ethernet20": { "lldp_rem_port_id_subtype": "5", diff --git a/tests/test_lldp.py b/tests/test_lldp.py index a9ee5f2fe..83808cc88 100644 --- a/tests/test_lldp.py +++ b/tests/test_lldp.py @@ -106,11 +106,36 @@ def test_subtype_lldp_loc_man_addr_table(self): def test_subtype_lldp_rem_man_addr_table(self): + # Verfiy both valid ipv4 and ipv6 address exit for entry in range(3, 6): mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] ret = mib_entry(sub_id=(1, 1)) self.assertIsNotNone(ret) print(ret) + # Verfiy valid ipv4 and invalid ipv6 address exit + for entry in range(3, 6): + mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] + ret = mib_entry(sub_id=(1, 5)) + self.assertIsNotNone(ret) + print(ret) + # Verfiy only valid ipv4 address exit + for entry in range(3, 6): + mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] + ret = mib_entry(sub_id=(1, 9)) + self.assertIsNotNone(ret) + print(ret) + # Verfiy only valid ipv6 address exit + for entry in range(3, 6): + mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] + ret = mib_entry(sub_id=(1, 13)) + self.assertIsNotNone(ret) + print(ret) + # Verfiy no mgmt address exit + for entry in range(3, 6): + mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] + ret = mib_entry(sub_id=(1, 17)) + self.assertIsNone(ret) + print(ret) def test_local_port_identification(self): mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 3, 7, 1, 3)] From 4dbc4dc46ef2f4540a8d935fc71a6065002e06ee Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Fri, 12 Mar 2021 19:58:11 +0000 Subject: [PATCH 02/13] Fix typo in comment Signed-off-by: Abhishek Dosi --- tests/test_lldp.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_lldp.py b/tests/test_lldp.py index 83808cc88..906a15953 100644 --- a/tests/test_lldp.py +++ b/tests/test_lldp.py @@ -106,31 +106,31 @@ def test_subtype_lldp_loc_man_addr_table(self): def test_subtype_lldp_rem_man_addr_table(self): - # Verfiy both valid ipv4 and ipv6 address exit + # Verfiy both valid ipv4 and ipv6 address exist for entry in range(3, 6): mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] ret = mib_entry(sub_id=(1, 1)) self.assertIsNotNone(ret) print(ret) - # Verfiy valid ipv4 and invalid ipv6 address exit + # Verfiy valid ipv4 and invalid ipv6 address exist for entry in range(3, 6): mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] ret = mib_entry(sub_id=(1, 5)) self.assertIsNotNone(ret) print(ret) - # Verfiy only valid ipv4 address exit + # Verfiy only valid ipv4 address exist for entry in range(3, 6): mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] ret = mib_entry(sub_id=(1, 9)) self.assertIsNotNone(ret) print(ret) - # Verfiy only valid ipv6 address exit + # Verfiy only valid ipv6 address exist for entry in range(3, 6): mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] ret = mib_entry(sub_id=(1, 13)) self.assertIsNotNone(ret) print(ret) - # Verfiy no mgmt address exit + # Verfiy no mgmt address exist for entry in range(3, 6): mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] ret = mib_entry(sub_id=(1, 17)) From a0e0ef10dff31f37c737acba7895a9ee75f4ffc9 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Fri, 12 Mar 2021 20:09:09 +0000 Subject: [PATCH 03/13] FIX LGTM Signed-off-by: Abhishek Dosi --- src/sonic_ax_impl/mibs/ieee802_1ab.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sonic_ax_impl/mibs/ieee802_1ab.py b/src/sonic_ax_impl/mibs/ieee802_1ab.py index da319ebd3..f86d839c3 100644 --- a/src/sonic_ax_impl/mibs/ieee802_1ab.py +++ b/src/sonic_ax_impl/mibs/ieee802_1ab.py @@ -514,7 +514,6 @@ def update_rem_if_mgmt(self, if_oid, if_name): time_mark = int(lldp_kvs['lldp_rem_time_mark']) remote_index = int(lldp_kvs['lldp_rem_index']) subtype = self.get_subtype(mgmt_ip) - ip_hex = self.get_ip_hex(mgmt_ip, subtype) if subtype == ManAddrConst.man_addr_subtype_ipv4: addr_subtype_sub_oid = 4 mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i) for i in mgmt_ip.split('.')]) From 9749374022771138fde9651348ba84d89e77dfb8 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Fri, 12 Mar 2021 21:51:45 +0000 Subject: [PATCH 04/13] Updated for Multi-asic Signed-off-by: Abhishek Dosi --- tests/mock_tables/asic0/appl_db.json | 4 ++-- tests/mock_tables/asic1/appl_db.json | 4 ++-- tests/mock_tables/asic2/appl_db.json | 19 +++++++++++++++++++ tests/namespace/test_lldp.py | 25 +++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/tests/mock_tables/asic0/appl_db.json b/tests/mock_tables/asic0/appl_db.json index af2167338..c3f2760a9 100644 --- a/tests/mock_tables/asic0/appl_db.json +++ b/tests/mock_tables/asic0/appl_db.json @@ -11,7 +11,7 @@ "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet1", - "lldp_rem_man_addr": "10.224.25.100" + "lldp_rem_man_addr": "10.224.25.101,fe80:268a::7ff:fe3f:834c" }, "LLDP_ENTRY_TABLE:Ethernet4": { "lldp_rem_port_id_subtype": "5", @@ -25,7 +25,7 @@ "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet2", - "lldp_rem_man_addr": "fe80::268a:7ff:fe3f:834c" + "lldp_rem_man_addr": "fe80::268a::7ff:fe3f:834c,10.224.25.102" }, "LLDP_LOC_CHASSIS": { "lldp_loc_chassis_id_subtype": "5", diff --git a/tests/mock_tables/asic1/appl_db.json b/tests/mock_tables/asic1/appl_db.json index 3c03bcc12..7530a1d6b 100644 --- a/tests/mock_tables/asic1/appl_db.json +++ b/tests/mock_tables/asic1/appl_db.json @@ -11,7 +11,7 @@ "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet3", - "lldp_rem_man_addr": "fe80::268a:7ff:fe3f:834c" + "lldp_rem_man_addr": "10.224.25.102" }, "LLDP_ENTRY_TABLE:Ethernet12": { "lldp_rem_port_id_subtype": "5", @@ -25,7 +25,7 @@ "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet4", - "lldp_rem_man_addr": "10.224.25.102" + "lldp_rem_man_addr": "fe80::268a:7ff:fe3f:834c" }, "LLDP_LOC_CHASSIS": { "lldp_loc_chassis_id_subtype": "5", diff --git a/tests/mock_tables/asic2/appl_db.json b/tests/mock_tables/asic2/appl_db.json index 87a07cf31..c1cb8b996 100644 --- a/tests/mock_tables/asic2/appl_db.json +++ b/tests/mock_tables/asic2/appl_db.json @@ -1,4 +1,18 @@ { + "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": "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": "Ethernet5", + "lldp_rem_man_addr": "" + }, "LLDP_LOC_CHASSIS": { "lldp_loc_chassis_id_subtype": "5", "lldp_loc_chassis_id": "00:11:22:AB:CD:EF", @@ -8,6 +22,11 @@ "lldp_loc_sys_cap_supported": "28 00", "lldp_loc_man_addr": "fe80::ce37:abff:feec:de9c" }, + "PORT_TABLE:Ethernet16": { + "description": "snowflake", + "alias": "etp5", + "speed": 100000 + }, "PORT_TABLE:Ethernet-BP16": { "description": "backplane", "alias": "etp9", diff --git a/tests/namespace/test_lldp.py b/tests/namespace/test_lldp.py index 96e940fa7..68005bbfb 100644 --- a/tests/namespace/test_lldp.py +++ b/tests/namespace/test_lldp.py @@ -124,11 +124,36 @@ def test_subtype_lldp_loc_man_addr_table(self): def test_subtype_lldp_rem_man_addr_table(self): + # Verfiy both valid ipv4 and ipv6 address exit for entry in range(3, 6): mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] ret = mib_entry(sub_id=(1, 1)) self.assertIsNotNone(ret) print(ret) + # Verfiy both valid ipv4 and invalid ipv6 address exit + for entry in range(3, 6): + mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] + ret = mib_entry(sub_id=(1, 5)) + self.assertIsNotNone(ret) + print(ret) + # Verfiy only valid ipv4 address exit + for entry in range(3, 6): + mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] + ret = mib_entry(sub_id=(1, 9)) + self.assertIsNotNone(ret) + print(ret) + # Verfiy only valid ipv6 address exit + for entry in range(3, 6): + mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] + ret = mib_entry(sub_id=(1, 13)) + self.assertIsNotNone(ret) + print(ret) + # Verfiy no mgmt address exit + for entry in range(3, 6): + mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] + ret = mib_entry(sub_id=(1, 17)) + self.assertIsNone(ret) + print(ret) def test_local_port_identification(self): mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 3, 7, 1, 3)] From 2b3ffc7ecdfa6aec6459ad7fa804b08dec53f3cc Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Fri, 12 Mar 2021 21:59:39 +0000 Subject: [PATCH 05/13] Fix Signed-off-by: Abhishek Dosi --- src/sonic_ax_impl/mibs/ieee802_1ab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic_ax_impl/mibs/ieee802_1ab.py b/src/sonic_ax_impl/mibs/ieee802_1ab.py index f86d839c3..a4ef3bedd 100644 --- a/src/sonic_ax_impl/mibs/ieee802_1ab.py +++ b/src/sonic_ax_impl/mibs/ieee802_1ab.py @@ -521,7 +521,7 @@ def update_rem_if_mgmt(self, if_oid, if_name): addr_subtype_sub_oid = 6 mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i, 16) if i else 0 for i in mgmt_ip.split(':')]) else: - logger.warning("Invalid management IP {}".format(mgmt_ip_str)) + logger.warning("Invalid management IP {}".format(mgmt_ip)) continue self.if_range.append((time_mark, if_oid, From 7f7418511eab6f012f5eb4540ab97cb20c51321b Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Sat, 13 Mar 2021 02:43:14 +0000 Subject: [PATCH 06/13] Address Review Comments Signed-off-by: Abhishek Dosi --- src/sonic_ax_impl/mibs/ieee802_1ab.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/sonic_ax_impl/mibs/ieee802_1ab.py b/src/sonic_ax_impl/mibs/ieee802_1ab.py index a4ef3bedd..7193d8869 100644 --- a/src/sonic_ax_impl/mibs/ieee802_1ab.py +++ b/src/sonic_ax_impl/mibs/ieee802_1ab.py @@ -510,18 +510,24 @@ def update_rem_if_mgmt(self, if_oid, if_name): if len(mgmt_ip_str) == 0: # the peer advertise an emtpy mgmt address return - for mgmt_ip in set(mgmt_ip_str.split(',')): + + mgmt_ip_set=set() + for mgmt_ip in mgmt_ip_str.split(','): time_mark = int(lldp_kvs['lldp_rem_time_mark']) remote_index = int(lldp_kvs['lldp_rem_index']) - subtype = self.get_subtype(mgmt_ip) - if subtype == ManAddrConst.man_addr_subtype_ipv4: + subtype, exploded_mgmt_ip = self.get_subtype_and_exploded_ip(mgmt_ip) + if exploded_mgmt_ip in mgmt_ip_set: + continue + elif subtype == ManAddrConst.man_addr_subtype_ipv4: addr_subtype_sub_oid = 4 - mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i) for i in mgmt_ip.split('.')]) + mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i) for i in exploded_mgmt_ip.split('.')]) + mgmt_ip_set.add(exploded_mgmt_ip) elif subtype == ManAddrConst.man_addr_subtype_ipv6: addr_subtype_sub_oid = 6 - mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i, 16) if i else 0 for i in mgmt_ip.split(':')]) + mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i, 16) if i else 0 for i in exploded_mgmt_ip.split(':')]) + mgmt_ip_set.add(exploded_mgmt_ip) else: - logger.warning("Invalid management IP {}".format(mgmt_ip)) + logger.warning("Invalid management IP {}".format(exploded_mgmt_ip)) continue self.if_range.append((time_mark, if_oid, @@ -605,20 +611,20 @@ def get_ip_hex(self, mgmt_ip_str, subtype): hex_ip = None return hex_ip - def get_subtype(self, ip_str): + def get_subtype_and_exploded_ip(self, ip_str): try: ipaddress.IPv4Address(ip_str) - return ManAddrConst.man_addr_subtype_ipv4 + return ManAddrConst.man_addr_subtype_ipv4, ipaddress.ip_address(ip_str).exploded except ipaddress.AddressValueError: # not a valid IPv4 pass try: ipaddress.IPv6Address(ip_str) - return ManAddrConst.man_addr_subtype_ipv6 + return ManAddrConst.man_addr_subtype_ipv6, ipaddress.ip_address(ip_str).exploded except ipaddress.AddressValueError: # not a valid IPv6 logger.warning("Invalid mgmt IP {}".format(ip_str)) - return None + return None, None @staticmethod From 448cad1967c1c8881324483c8e48f1358e4bab30 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Sat, 13 Mar 2021 02:46:27 +0000 Subject: [PATCH 07/13] Fix Signed-off-by: Abhishek Dosi --- src/sonic_ax_impl/mibs/ieee802_1ab.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic_ax_impl/mibs/ieee802_1ab.py b/src/sonic_ax_impl/mibs/ieee802_1ab.py index 7193d8869..b978ab0ee 100644 --- a/src/sonic_ax_impl/mibs/ieee802_1ab.py +++ b/src/sonic_ax_impl/mibs/ieee802_1ab.py @@ -614,13 +614,13 @@ def get_ip_hex(self, mgmt_ip_str, subtype): def get_subtype_and_exploded_ip(self, ip_str): try: ipaddress.IPv4Address(ip_str) - return ManAddrConst.man_addr_subtype_ipv4, ipaddress.ip_address(ip_str).exploded + return ManAddrConst.man_addr_subtype_ipv4, ip_str except ipaddress.AddressValueError: # not a valid IPv4 pass try: ipaddress.IPv6Address(ip_str) - return ManAddrConst.man_addr_subtype_ipv6, ipaddress.ip_address(ip_str).exploded + return ManAddrConst.man_addr_subtype_ipv6, ipaddress.IPv6Address(ip_str).exploded except ipaddress.AddressValueError: # not a valid IPv6 logger.warning("Invalid mgmt IP {}".format(ip_str)) From 4aaa7930fbc72363e628179b491c0b45cc99f010 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Sat, 13 Mar 2021 02:50:25 +0000 Subject: [PATCH 08/13] Fix error case Signed-off-by: Abhishek Dosi --- src/sonic_ax_impl/mibs/ieee802_1ab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic_ax_impl/mibs/ieee802_1ab.py b/src/sonic_ax_impl/mibs/ieee802_1ab.py index b978ab0ee..ed06c5409 100644 --- a/src/sonic_ax_impl/mibs/ieee802_1ab.py +++ b/src/sonic_ax_impl/mibs/ieee802_1ab.py @@ -516,7 +516,7 @@ def update_rem_if_mgmt(self, if_oid, if_name): time_mark = int(lldp_kvs['lldp_rem_time_mark']) remote_index = int(lldp_kvs['lldp_rem_index']) subtype, exploded_mgmt_ip = self.get_subtype_and_exploded_ip(mgmt_ip) - if exploded_mgmt_ip in mgmt_ip_set: + if exploded_mgmt_ip and exploded_mgmt_ip in mgmt_ip_set: continue elif subtype == ManAddrConst.man_addr_subtype_ipv4: addr_subtype_sub_oid = 4 From 6956f42a634bae766f08b8651a15111fbae0d72f Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Sat, 13 Mar 2021 02:56:52 +0000 Subject: [PATCH 09/13] Fix Signed-off-by: Abhishek Dosi --- src/sonic_ax_impl/mibs/ieee802_1ab.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/sonic_ax_impl/mibs/ieee802_1ab.py b/src/sonic_ax_impl/mibs/ieee802_1ab.py index ed06c5409..1738c81d8 100644 --- a/src/sonic_ax_impl/mibs/ieee802_1ab.py +++ b/src/sonic_ax_impl/mibs/ieee802_1ab.py @@ -516,19 +516,26 @@ def update_rem_if_mgmt(self, if_oid, if_name): time_mark = int(lldp_kvs['lldp_rem_time_mark']) remote_index = int(lldp_kvs['lldp_rem_index']) subtype, exploded_mgmt_ip = self.get_subtype_and_exploded_ip(mgmt_ip) - if exploded_mgmt_ip and exploded_mgmt_ip in mgmt_ip_set: + + # Invalid Managent IP + if not subtype or not exploded_mgmt_ip: + logger.warning("Invalid management IP {}".format(mgmt_ip)) + continue + # Non-Unique Managemnt IP + elif exploded_mgmt_ip in mgmt_ip_set: continue + # IPv4 Managemnt IP elif subtype == ManAddrConst.man_addr_subtype_ipv4: addr_subtype_sub_oid = 4 mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i) for i in exploded_mgmt_ip.split('.')]) mgmt_ip_set.add(exploded_mgmt_ip) + # IPv6 Managemnt IP elif subtype == ManAddrConst.man_addr_subtype_ipv6: addr_subtype_sub_oid = 6 mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i, 16) if i else 0 for i in exploded_mgmt_ip.split(':')]) mgmt_ip_set.add(exploded_mgmt_ip) else: - logger.warning("Invalid management IP {}".format(exploded_mgmt_ip)) - continue + pass self.if_range.append((time_mark, if_oid, remote_index, From 09d41cfaa779e8234ca8e6fe786994d83d3f38cc Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Sat, 13 Mar 2021 03:02:04 +0000 Subject: [PATCH 10/13] Fix typo in comment Signed-off-by: Abhishek Dosi --- src/sonic_ax_impl/mibs/ieee802_1ab.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sonic_ax_impl/mibs/ieee802_1ab.py b/src/sonic_ax_impl/mibs/ieee802_1ab.py index 1738c81d8..50888d39a 100644 --- a/src/sonic_ax_impl/mibs/ieee802_1ab.py +++ b/src/sonic_ax_impl/mibs/ieee802_1ab.py @@ -517,19 +517,19 @@ def update_rem_if_mgmt(self, if_oid, if_name): remote_index = int(lldp_kvs['lldp_rem_index']) subtype, exploded_mgmt_ip = self.get_subtype_and_exploded_ip(mgmt_ip) - # Invalid Managent IP + # Invalid management IP if not subtype or not exploded_mgmt_ip: logger.warning("Invalid management IP {}".format(mgmt_ip)) continue - # Non-Unique Managemnt IP + # Non-Unique management IP elif exploded_mgmt_ip in mgmt_ip_set: continue - # IPv4 Managemnt IP + # IPv4 management IP elif subtype == ManAddrConst.man_addr_subtype_ipv4: addr_subtype_sub_oid = 4 mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i) for i in exploded_mgmt_ip.split('.')]) mgmt_ip_set.add(exploded_mgmt_ip) - # IPv6 Managemnt IP + # IPv6 management IP elif subtype == ManAddrConst.man_addr_subtype_ipv6: addr_subtype_sub_oid = 6 mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i, 16) if i else 0 for i in exploded_mgmt_ip.split(':')]) From 341f548b73db7f998ad999432c8faadb83205000 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Sun, 14 Mar 2021 02:29:27 +0000 Subject: [PATCH 11/13] Address Review Comments and more fixes in code and test Signed-off-by: Abhishek Dosi --- src/ax_interface/util.py | 9 +- src/sonic_ax_impl/mibs/ieee802_1ab.py | 67 ++++-------- src/sonic_ax_impl/mibs/ietf/rfc1213.py | 6 +- src/sonic_ax_impl/mibs/ietf/rfc4292.py | 6 +- src/sonic_ax_impl/mibs/vendor/cisco/bgp4.py | 3 +- tests/mock_tables/appl_db.json | 2 +- tests/mock_tables/asic0/appl_db.json | 4 +- tests/namespace/test_lldp.py | 112 ++++++++++++++----- tests/test_lldp.py | 114 +++++++++++++++----- 9 files changed, 205 insertions(+), 118 deletions(-) diff --git a/src/ax_interface/util.py b/src/ax_interface/util.py index e5122328b..afe369115 100644 --- a/src/ax_interface/util.py +++ b/src/ax_interface/util.py @@ -1,3 +1,4 @@ +import ipaddress import re from ax_interface import constants @@ -98,10 +99,12 @@ def mac_decimals(mac): """ return tuple(int(h, 16) for h in mac.split(":")) -def ip2tuple_v4(ip): +def ip2byte_tuple(ip): """ - >>> ip2tuple_v4("192.168.1.253") + >>> ip2byte_tuple("192.168.1.253") (192, 168, 1, 253) + >>> ip2byte_tuple("2001:db8::3") + (32, 1, 13, 184, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3) """ - return tuple(int(bs) for bs in str(ip).split('.')) + return tuple(i for i in ipaddress.ip_address(ip).packed) diff --git a/src/sonic_ax_impl/mibs/ieee802_1ab.py b/src/sonic_ax_impl/mibs/ieee802_1ab.py index 50888d39a..852635236 100644 --- a/src/sonic_ax_impl/mibs/ieee802_1ab.py +++ b/src/sonic_ax_impl/mibs/ieee802_1ab.py @@ -8,6 +8,7 @@ from swsssdk import port_util from sonic_ax_impl import mibs, logger from sonic_ax_impl.mibs import Namespace +from ax_interface.util import ip2byte_tuple from ax_interface import MIBMeta, SubtreeMIBEntry, MIBEntry, MIBUpdater, ValueType @@ -317,7 +318,8 @@ def reinit_data(self): mgmt_ip_sub_oid = None for mgmt_ip in self.mgmt_ip_str.split(','): if '.' in mgmt_ip: - mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i) for i in mgmt_ip.split('.')]) + mgmt_ip_tuple = ip2byte_tuple(mgmt_ip) + mgmt_ip_sub_oid = (addr_subtype_sub_oid, *mgmt_ip_tuple) break else: logger.error("Could not find IPv4 address in lldp_loc_man_addr") @@ -494,7 +496,6 @@ def __init__(self): # establish connection to application database. Namespace.connect_all_dbs(self.db_conn, mibs.APPL_DB) self.if_range = [] - self.if_with_mgmt_ips = set() self.oid_name_map = {} self.mgmt_oid_name_map = {} self.pubsub = [None] * len(self.db_conn) @@ -510,39 +511,28 @@ def update_rem_if_mgmt(self, if_oid, if_name): if len(mgmt_ip_str) == 0: # the peer advertise an emtpy mgmt address return - mgmt_ip_set=set() for mgmt_ip in mgmt_ip_str.split(','): time_mark = int(lldp_kvs['lldp_rem_time_mark']) remote_index = int(lldp_kvs['lldp_rem_index']) - subtype, exploded_mgmt_ip = self.get_subtype_and_exploded_ip(mgmt_ip) - - # Invalid management IP - if not subtype or not exploded_mgmt_ip: + subtype = self.get_subtype(mgmt_ip) + if not subtype: logger.warning("Invalid management IP {}".format(mgmt_ip)) continue - # Non-Unique management IP - elif exploded_mgmt_ip in mgmt_ip_set: + mgmt_ip_tuple = ip2byte_tuple(mgmt_ip) + if mgmt_ip_tuple in mgmt_ip_set: continue - # IPv4 management IP elif subtype == ManAddrConst.man_addr_subtype_ipv4: addr_subtype_sub_oid = 4 - mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i) for i in exploded_mgmt_ip.split('.')]) - mgmt_ip_set.add(exploded_mgmt_ip) - # IPv6 management IP - elif subtype == ManAddrConst.man_addr_subtype_ipv6: - addr_subtype_sub_oid = 6 - mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i, 16) if i else 0 for i in exploded_mgmt_ip.split(':')]) - mgmt_ip_set.add(exploded_mgmt_ip) else: - pass + addr_subtype_sub_oid = 16 + mgmt_ip_set.add(mgmt_ip_tuple) + mgmt_ip_sub_oid = (addr_subtype_sub_oid, *mgmt_ip_tuple) self.if_range.append((time_mark, if_oid, remote_index, subtype, *mgmt_ip_sub_oid)) - self.if_with_mgmt_ips.add(if_name) - except (KeyError, AttributeError) as e: logger.warning("Error updating remote mgmt addr: {}".format(e)) return @@ -572,7 +562,6 @@ def update_data(self): self.pubsub[i] = mibs.get_redis_pubsub(self.db_conn[i], self.db_conn[i].APPL_DB, pattern) self._update_per_namespace_data(self.pubsub[i]) - def reinit_data(self): """ Subclass reinit data routine. @@ -587,7 +576,6 @@ def reinit_data(self): Namespace.connect_all_dbs(self.db_conn, mibs.APPL_DB) self.if_range = [] - self.if_with_mgmt_ips = set() for if_oid, if_name in self.oid_name_map.items(): self.update_rem_if_mgmt(if_oid, if_name) @@ -598,50 +586,33 @@ def get_next(self, sub_id): return self.if_range[right] def lookup(self, sub_id, callable): - if len(sub_id) == 0: + if sub_id not in self.if_range: return None - sub_id = sub_id[1] - 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.if_with_mgmt_ips: - # no data for this interface - return None - return callable(sub_id, if_name) - - def get_ip_hex(self, mgmt_ip_str, subtype): - if subtype == ManAddrConst.man_addr_subtype_ipv4: - hex_ip = " ".join([format(int(i), '02X') for i in mgmt_ip_str.split('.')]) - elif subtype == ManAddrConst.man_addr_subtype_ipv6: - hex_ip = " ".join([format(int(i, 16), 'x') if i else "0" for i in mgmt_ip_str.split(':')]) - else: - hex_ip = None - return hex_ip + return callable(sub_id) - def get_subtype_and_exploded_ip(self, ip_str): + def get_subtype(self, ip_str): try: ipaddress.IPv4Address(ip_str) - return ManAddrConst.man_addr_subtype_ipv4, ip_str + return ManAddrConst.man_addr_subtype_ipv4 except ipaddress.AddressValueError: # not a valid IPv4 pass try: ipaddress.IPv6Address(ip_str) - return ManAddrConst.man_addr_subtype_ipv6, ipaddress.IPv6Address(ip_str).exploded + return ManAddrConst.man_addr_subtype_ipv6 except ipaddress.AddressValueError: # not a valid IPv6 logger.warning("Invalid mgmt IP {}".format(ip_str)) - return None, None - + return None @staticmethod - def man_addr_if_subtype(sub_id, _): return ManAddrConst.man_addr_if_subtype + def man_addr_if_subtype(sub_id): return ManAddrConst.man_addr_if_subtype @staticmethod - def man_addr_if_id(sub_id, _): return ManAddrConst.man_addr_if_id + def man_addr_if_id(sub_id): return ManAddrConst.man_addr_if_id @staticmethod - def man_addr_OID(sub_id, _): return ManAddrConst.man_addr_oid + def man_addr_OID(sub_id): return ManAddrConst.man_addr_oid class LLDPLocalSystemData(metaclass=MIBMeta, prefix='.1.0.8802.1.1.2.1.3'): diff --git a/src/sonic_ax_impl/mibs/ietf/rfc1213.py b/src/sonic_ax_impl/mibs/ietf/rfc1213.py index 75238b054..35c6e1f0c 100644 --- a/src/sonic_ax_impl/mibs/ietf/rfc1213.py +++ b/src/sonic_ax_impl/mibs/ietf/rfc1213.py @@ -8,7 +8,7 @@ from sonic_ax_impl.mibs import Namespace from ax_interface.mib import MIBMeta, ValueType, MIBUpdater, MIBEntry, SubtreeMIBEntry, OverlayAdpaterMIBEntry, OidMIBEntry from ax_interface.encodings import ObjectIdentifier -from ax_interface.util import mac_decimals, ip2tuple_v4 +from ax_interface.util import mac_decimals, ip2byte_tuple @unique class DbTables(int, Enum): @@ -99,7 +99,7 @@ def _update_arp_info(self, dev, mac, ip): # if MAC is all zero #if not any(mac): continue - iptuple = ip2tuple_v4(ip) + iptuple = ip2byte_tuple(ip) subid = (if_index,) + iptuple self.arp_dest_map[subid] = machex @@ -154,7 +154,7 @@ def update_data(self): nexthops = ent["nexthop"] for nh in nexthops.split(','): # TODO: if ipn contains IP range, create more sub_id here - sub_id = ip2tuple_v4(ipn.network_address) + sub_id = ip2byte_tuple(ipn.network_address) self.route_list.append(sub_id) self.nexthop_map[sub_id] = ipaddress.ip_address(nh).packed break # Just need the first nexthop diff --git a/src/sonic_ax_impl/mibs/ietf/rfc4292.py b/src/sonic_ax_impl/mibs/ietf/rfc4292.py index 38ce35c67..de75c05cf 100644 --- a/src/sonic_ax_impl/mibs/ietf/rfc4292.py +++ b/src/sonic_ax_impl/mibs/ietf/rfc4292.py @@ -3,7 +3,7 @@ from sonic_ax_impl import mibs from sonic_ax_impl.mibs import Namespace from ax_interface import MIBMeta, ValueType, MIBUpdater, SubtreeMIBEntry -from ax_interface.util import ip2tuple_v4 +from ax_interface.util import ip2byte_tuple from bisect import bisect_right from sonic_py_common import multi_asic @@ -46,7 +46,7 @@ def update_data(self): ## The nexthop for loopbacks should be all zero for loip in self.loips: - sub_id = ip2tuple_v4(loip) + (255, 255, 255, 255) + (self.tos,) + (0, 0, 0, 0) + sub_id = ip2byte_tuple(loip) + (255, 255, 255, 255) + (self.tos,) + (0, 0, 0, 0) self.route_dest_list.append(sub_id) self.route_dest_map[sub_id] = self.loips[loip].packed @@ -84,7 +84,7 @@ def update_data(self): port_table[ifn][multi_asic.PORT_ROLE] == multi_asic.INTERNAL_PORT): continue - sub_id = ip2tuple_v4(ipn.network_address) + ip2tuple_v4(ipn.netmask) + (self.tos,) + ip2tuple_v4(nh) + sub_id = ip2byte_tuple(ipn.network_address) + ip2byte_tuple(ipn.netmask) + (self.tos,) + ip2byte_tuple(nh) self.route_dest_list.append(sub_id) self.route_dest_map[sub_id] = ipn.network_address.packed diff --git a/src/sonic_ax_impl/mibs/vendor/cisco/bgp4.py b/src/sonic_ax_impl/mibs/vendor/cisco/bgp4.py index f5f3e3724..87214707b 100644 --- a/src/sonic_ax_impl/mibs/vendor/cisco/bgp4.py +++ b/src/sonic_ax_impl/mibs/vendor/cisco/bgp4.py @@ -1,6 +1,7 @@ from bisect import bisect_right from sonic_ax_impl import mibs from ax_interface import MIBMeta, ValueType, MIBUpdater, SubtreeMIBEntry +from ax_interface.util import ip2byte_tuple from sonic_ax_impl.mibs import Namespace import ipaddress @@ -43,7 +44,7 @@ def update_data(self): oid_head = (1, 4) else: oid_head = (2, 16) - oid_ip = tuple(i for i in ip.packed) + oid_ip = ip2byte_tuple(neigh_str) if state.isdigit(): status = 6 diff --git a/tests/mock_tables/appl_db.json b/tests/mock_tables/appl_db.json index b1b079757..69bdbf1ad 100644 --- a/tests/mock_tables/appl_db.json +++ b/tests/mock_tables/appl_db.json @@ -333,7 +333,7 @@ "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet24", - "lldp_rem_man_addr": "10.224.25.123" + "lldp_rem_man_addr": "10.224.25.123,2603:10e2:290:5016::" }, "LLDP_ENTRY_TABLE:Ethernet96": { "lldp_rem_port_id_subtype": "5", diff --git a/tests/mock_tables/asic0/appl_db.json b/tests/mock_tables/asic0/appl_db.json index c3f2760a9..d741bf6f8 100644 --- a/tests/mock_tables/asic0/appl_db.json +++ b/tests/mock_tables/asic0/appl_db.json @@ -5,13 +5,13 @@ "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_time_mark": "0", "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_man_addr": "10.224.25.101,fe80:268a::7ff:fe3f:834c" + "lldp_rem_man_addr": "10.224.25.123,2603:10e2:290:5016::" }, "LLDP_ENTRY_TABLE:Ethernet4": { "lldp_rem_port_id_subtype": "5", diff --git a/tests/namespace/test_lldp.py b/tests/namespace/test_lldp.py index 68005bbfb..54aa59ae0 100644 --- a/tests/namespace/test_lldp.py +++ b/tests/namespace/test_lldp.py @@ -124,36 +124,92 @@ def test_subtype_lldp_loc_man_addr_table(self): def test_subtype_lldp_rem_man_addr_table(self): + + # Get the first entry of walk. We will get IPv4 Address associated with Ethernet0 Port # Verfiy both valid ipv4 and ipv6 address exit for entry in range(3, 6): - mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] - ret = mib_entry(sub_id=(1, 1)) - self.assertIsNotNone(ret) - print(ret) - # Verfiy both valid ipv4 and invalid ipv6 address exit - for entry in range(3, 6): - mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] - ret = mib_entry(sub_id=(1, 5)) - self.assertIsNotNone(ret) - print(ret) - # Verfiy only valid ipv4 address exit - for entry in range(3, 6): - mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] - ret = mib_entry(sub_id=(1, 9)) - self.assertIsNotNone(ret) - print(ret) - # Verfiy only valid ipv6 address exit - for entry in range(3, 6): - mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] - ret = mib_entry(sub_id=(1, 13)) - self.assertIsNotNone(ret) - print(ret) - # Verfiy no mgmt address exit - for entry in range(3, 6): - mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] - ret = mib_entry(sub_id=(1, 17)) - self.assertIsNone(ret) - print(ret) + oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)) + get_pdu = GetNextPDU( + header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), + oids=[oid] + ) + response = get_pdu.make_response(self.lut) + value0 = response.values[0] + self.assertEqual(str(value0.name), str(ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry, 0, 1, 1, 1, 4, 10, 224, 25, 123)))) + if entry == 3: + self.assertEqual(value0.type_, ValueType.INTEGER) + self.assertEqual(value0.data, 2) + elif entry == 4: + self.assertEqual(value0.type_, ValueType.INTEGER) + self.assertEqual(value0.data, 0) + else: + self.assertEqual(value0.type_, ValueType.OBJECT_IDENTIFIER) + self.assertEqual(str(value0.data), str(ObjectIdentifier(5, 2, 0, 0, (1, 2, 2, 1, 1)))) + + # Get next on above to get IPv6 Entry. We will get IPv6 Address associated with Ethernet0 Port + oid = ObjectIdentifier(16, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry, 0, 1, 1, 1, 16)) + get_pdu = GetNextPDU( + header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), + oids=[oid] + ) + response = get_pdu.make_response(self.lut) + value0 = response.values[0] + self.assertEqual(str(value0.name), str(ObjectIdentifier(20, 0, 1, 0, + (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry, 0, 1, 1, 2, 16, 38, 3, 16, 226, 2, 144, 80, 22, 0, 0, 0, 0, 0, 0, 0, 0)))) + if entry == 3: + self.assertEqual(value0.type_, ValueType.INTEGER) + self.assertEqual(value0.data, 2) + elif entry == 4: + self.assertEqual(value0.type_, ValueType.INTEGER) + self.assertEqual(value0.data, 0) + else: + self.assertEqual(value0.type_, ValueType.OBJECT_IDENTIFIER) + self.assertEqual(str(value0.data), str(ObjectIdentifier(5, 2, 0, 0, (1, 2, 2, 1, 1)))) + + + # Verfiy both valid ipv4 and invalid ipv6 address exit. Ethernet5 has this config. + oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 5)) + get_pdu = GetNextPDU( + header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), + oids=[oid] + ) + response = get_pdu.make_response(self.lut) + value0 = response.values[0] + self.assertEqual(value0.type_, ValueType.INTEGER) + self.assertEqual(value0.data, 2) + + # Verfiy only valid ipv4 address exit. Ethernet8 has this config. + oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 9)) + get_pdu = GetNextPDU( + header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), + oids=[oid] + ) + response = get_pdu.make_response(self.lut) + value0 = response.values[0] + self.assertEqual(value0.type_, ValueType.INTEGER) + self.assertEqual(value0.data, 2) + + # Verfiy only valid ipv6 address exiit. Ethernet12 has this config. + oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 13)) + get_pdu = GetNextPDU( + header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), + oids=[oid] + ) + response = get_pdu.make_response(self.lut) + value0 = response.values[0] + self.assertEqual(value0.type_, ValueType.INTEGER) + self.assertEqual(value0.data, 2) + + # Verfiy no mgmt address exit. Ethernet16 has this config. + oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18545, 17)) + get_pdu = GetNextPDU( + header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), + oids=[oid] + ) + response = get_pdu.make_response(self.lut) + value0 = response.values[0] + # Should result End of Mib View + self.assertEqual(value0.type_, ValueType.END_OF_MIB_VIEW) def test_local_port_identification(self): mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 3, 7, 1, 3)] diff --git a/tests/test_lldp.py b/tests/test_lldp.py index 906a15953..54cdb0451 100644 --- a/tests/test_lldp.py +++ b/tests/test_lldp.py @@ -106,36 +106,92 @@ def test_subtype_lldp_loc_man_addr_table(self): def test_subtype_lldp_rem_man_addr_table(self): - # Verfiy both valid ipv4 and ipv6 address exist + # Get the first entry of walk. We will get IPv4 Address associated with Ethernet92 Port + # Verfiy both valid ipv4 and ipv6 address exit for entry in range(3, 6): - mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] - ret = mib_entry(sub_id=(1, 1)) - self.assertIsNotNone(ret) - print(ret) - # Verfiy valid ipv4 and invalid ipv6 address exist - for entry in range(3, 6): - mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] - ret = mib_entry(sub_id=(1, 5)) - self.assertIsNotNone(ret) - print(ret) - # Verfiy only valid ipv4 address exist - for entry in range(3, 6): - mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] - ret = mib_entry(sub_id=(1, 9)) - self.assertIsNotNone(ret) - print(ret) - # Verfiy only valid ipv6 address exist - for entry in range(3, 6): - mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] - ret = mib_entry(sub_id=(1, 13)) - self.assertIsNotNone(ret) - print(ret) - # Verfiy no mgmt address exist - for entry in range(3, 6): - mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)] - ret = mib_entry(sub_id=(1, 17)) - self.assertIsNone(ret) - print(ret) + oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)) + get_pdu = GetNextPDU( + header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), + oids=[oid] + ) + response = get_pdu.make_response(self.lut) + value0 = response.values[0] + self.assertEqual(str(value0.name), str(ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry, 32, 93, 1, 1, 4, 10, 224, 25, 123)))) + if entry == 3: + self.assertEqual(value0.type_, ValueType.INTEGER) + self.assertEqual(value0.data, 2) + elif entry == 4: + self.assertEqual(value0.type_, ValueType.INTEGER) + self.assertEqual(value0.data, 0) + else: + self.assertEqual(value0.type_, ValueType.OBJECT_IDENTIFIER) + self.assertEqual(str(value0.data), str(ObjectIdentifier(5, 2, 0, 0, (1, 2, 2, 1, 1)))) + + # Get next on above to get IPv6 Entry. We will get IPv6 Address associated with Ethernet92 Port + oid = ObjectIdentifier(16, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry, 32, 93, 1, 1, 16)) + get_pdu = GetNextPDU( + header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), + oids=[oid] + ) + response = get_pdu.make_response(self.lut) + value0 = response.values[0] + self.assertEqual(str(value0.name), str(ObjectIdentifier(20, 0, 1, 0, + (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry, 32, 93, 1, 2, 16, 38, 3, 16, 226, 2, 144, 80, 22, 0, 0, 0, 0, 0, 0, 0, 0)))) + if entry == 3: + self.assertEqual(value0.type_, ValueType.INTEGER) + self.assertEqual(value0.data, 2) + elif entry == 4: + self.assertEqual(value0.type_, ValueType.INTEGER) + self.assertEqual(value0.data, 0) + else: + self.assertEqual(value0.type_, ValueType.OBJECT_IDENTIFIER) + self.assertEqual(str(value0.data), str(ObjectIdentifier(5, 2, 0, 0, (1, 2, 2, 1, 1)))) + + # Verfiy both valid ipv4 and invalid ipv6 address exit. Ethernet5 has this config. + oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 5)) + get_pdu = GetNextPDU( + header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), + oids=[oid] + ) + response = get_pdu.make_response(self.lut) + value0 = response.values[0] + self.assertEqual(value0.type_, ValueType.INTEGER) + self.assertEqual(value0.data, 2) + + # Verfiy only valid ipv4 address exit. Ethernet8 has this config. + oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 9)) + get_pdu = GetNextPDU( + header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), + oids=[oid] + ) + response = get_pdu.make_response(self.lut) + value0 = response.values[0] + self.assertEqual(value0.type_, ValueType.INTEGER) + self.assertEqual(value0.data, 2) + + # Verfiy only valid ipv6 address exiit. Ethernet12 has this config. + oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18545, 13)) + get_pdu = GetNextPDU( + header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), + oids=[oid] + ) + response = get_pdu.make_response(self.lut) + value0 = response.values[0] + self.assertEqual(value0.type_, ValueType.INTEGER) + self.assertEqual(value0.data, 2) + + # Verfiy no mgmt address exit. Ethernet16 has this config. + oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18545, 17)) + get_pdu = GetNextPDU( + header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), + oids=[oid] + ) + response = get_pdu.make_response(self.lut) + value0 = response.values[0] + # Should move to other interface. Ethernet22 + self.assertEqual(str(value0.name), str(ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18545, 21, 1, 1, 4, 10, 224, 25, 105)))) + self.assertEqual(value0.type_, ValueType.INTEGER) + self.assertEqual(value0.data, 2) def test_local_port_identification(self): mib_entry = self.lut[(1, 0, 8802, 1, 1, 2, 1, 3, 7, 1, 3)] From 80417eed937f7bb9957fe9a7a0d4c19516e05967 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Sun, 14 Mar 2021 15:27:40 +0000 Subject: [PATCH 12/13] Verified GET also. Signed-off-by: Abhishek Dosi --- tests/mock_tables/asic1/appl_db.json | 2 +- tests/namespace/test_lldp.py | 16 ++++++++++------ tests/test_lldp.py | 16 ++++++++++------ 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/tests/mock_tables/asic1/appl_db.json b/tests/mock_tables/asic1/appl_db.json index 7530a1d6b..b1389f441 100644 --- a/tests/mock_tables/asic1/appl_db.json +++ b/tests/mock_tables/asic1/appl_db.json @@ -25,7 +25,7 @@ "lldp_rem_chassis_id_subtype": "4", "lldp_rem_sys_name": "switch13", "lldp_rem_port_id": "Ethernet4", - "lldp_rem_man_addr": "fe80::268a:7ff:fe3f:834c" + "lldp_rem_man_addr": "fe80:268a::7ff:fe3f:834c" }, "LLDP_LOC_CHASSIS": { "lldp_loc_chassis_id_subtype": "5", diff --git a/tests/namespace/test_lldp.py b/tests/namespace/test_lldp.py index 54aa59ae0..2ae032cc0 100644 --- a/tests/namespace/test_lldp.py +++ b/tests/namespace/test_lldp.py @@ -168,35 +168,39 @@ def test_subtype_lldp_rem_man_addr_table(self): # Verfiy both valid ipv4 and invalid ipv6 address exit. Ethernet5 has this config. - oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 5)) - get_pdu = GetNextPDU( + oid = ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 5, 1, 1, 4, 10, 224, 25, 102)) + get_pdu = GetPDU( header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), oids=[oid] ) response = get_pdu.make_response(self.lut) value0 = response.values[0] + self.assertEqual(str(value0.name), str(ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 5, 1, 1, 4, 10, 224, 25, 102)))) self.assertEqual(value0.type_, ValueType.INTEGER) self.assertEqual(value0.data, 2) # Verfiy only valid ipv4 address exit. Ethernet8 has this config. - oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 9)) - get_pdu = GetNextPDU( + oid = ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 9, 1, 1, 4, 10, 224, 25, 102)) + get_pdu = GetPDU( header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), oids=[oid] ) response = get_pdu.make_response(self.lut) value0 = response.values[0] + self.assertEqual(str(value0.name), str(ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 9, 1, 1, 4, 10, 224, 25, 102)))) self.assertEqual(value0.type_, ValueType.INTEGER) self.assertEqual(value0.data, 2) # Verfiy only valid ipv6 address exiit. Ethernet12 has this config. - oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 13)) - get_pdu = GetNextPDU( + oid = ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 13, 1, 2, 16, 254, 128, 38, 138, 0, 0, 0, 0, 0, 0, 7, 255, 254, 63, 131, 76)) + get_pdu = GetPDU( header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), oids=[oid] ) response = get_pdu.make_response(self.lut) value0 = response.values[0] + self.assertEqual(str(value0.name), str(ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, + 13, 1, 2, 16, 254, 128, 38, 138, 0, 0, 0, 0, 0, 0, 7, 255, 254, 63, 131, 76)))) self.assertEqual(value0.type_, ValueType.INTEGER) self.assertEqual(value0.data, 2) diff --git a/tests/test_lldp.py b/tests/test_lldp.py index 54cdb0451..9b94b89c7 100644 --- a/tests/test_lldp.py +++ b/tests/test_lldp.py @@ -148,35 +148,39 @@ def test_subtype_lldp_rem_man_addr_table(self): self.assertEqual(str(value0.data), str(ObjectIdentifier(5, 2, 0, 0, (1, 2, 2, 1, 1)))) # Verfiy both valid ipv4 and invalid ipv6 address exit. Ethernet5 has this config. - oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 5)) - get_pdu = GetNextPDU( + oid = ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 5, 1, 1, 4, 10, 224, 25, 101)) + get_pdu = GetPDU( header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), oids=[oid] ) response = get_pdu.make_response(self.lut) value0 = response.values[0] + self.assertEqual(str(value0.name), str(ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 5, 1, 1, 4, 10, 224, 25, 101)))) self.assertEqual(value0.type_, ValueType.INTEGER) self.assertEqual(value0.data, 2) # Verfiy only valid ipv4 address exit. Ethernet8 has this config. - oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 9)) - get_pdu = GetNextPDU( + oid = ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 9, 1, 1, 4, 10, 224, 25, 102)) + get_pdu = GetPDU( header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), oids=[oid] ) response = get_pdu.make_response(self.lut) value0 = response.values[0] + self.assertEqual(str(value0.name), str(ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 9, 1, 1, 4, 10, 224, 25, 102)))) self.assertEqual(value0.type_, ValueType.INTEGER) self.assertEqual(value0.data, 2) # Verfiy only valid ipv6 address exiit. Ethernet12 has this config. - oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18545, 13)) - get_pdu = GetNextPDU( + oid = ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18545, 13, 1, 2, 16, 254, 128, 38, 138, 0, 0, 0, 0, 0, 0, 7, 255, 254, 63, 131, 76)) + get_pdu = GetPDU( header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), oids=[oid] ) response = get_pdu.make_response(self.lut) value0 = response.values[0] + self.assertEqual(str(value0.name), str(ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18545, + 13, 1, 2, 16, 254, 128, 38, 138, 0, 0, 0, 0, 0, 0, 7, 255, 254, 63, 131, 76)))) self.assertEqual(value0.type_, ValueType.INTEGER) self.assertEqual(value0.data, 2) From bab90f4ab28f600186905d532a4970280b28c0e8 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Mon, 15 Mar 2021 02:10:26 +0000 Subject: [PATCH 13/13] Fix Typo Signed-off-by: Abhishek Dosi --- tests/namespace/test_lldp.py | 8 ++++---- tests/test_lldp.py | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/namespace/test_lldp.py b/tests/namespace/test_lldp.py index 2ae032cc0..fbfd4e260 100644 --- a/tests/namespace/test_lldp.py +++ b/tests/namespace/test_lldp.py @@ -126,7 +126,7 @@ def test_subtype_lldp_loc_man_addr_table(self): def test_subtype_lldp_rem_man_addr_table(self): # Get the first entry of walk. We will get IPv4 Address associated with Ethernet0 Port - # Verfiy both valid ipv4 and ipv6 address exit + # Verfiy both valid ipv4 and ipv6 address exist for entry in range(3, 6): oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)) get_pdu = GetNextPDU( @@ -167,7 +167,7 @@ def test_subtype_lldp_rem_man_addr_table(self): self.assertEqual(str(value0.data), str(ObjectIdentifier(5, 2, 0, 0, (1, 2, 2, 1, 1)))) - # Verfiy both valid ipv4 and invalid ipv6 address exit. Ethernet5 has this config. + # Verfiy both valid ipv4 and invalid ipv6 address exist. Ethernet5 has this config. oid = ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 5, 1, 1, 4, 10, 224, 25, 102)) get_pdu = GetPDU( header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), @@ -179,7 +179,7 @@ def test_subtype_lldp_rem_man_addr_table(self): self.assertEqual(value0.type_, ValueType.INTEGER) self.assertEqual(value0.data, 2) - # Verfiy only valid ipv4 address exit. Ethernet8 has this config. + # Verfiy only valid ipv4 address exist. Ethernet8 has this config. oid = ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 9, 1, 1, 4, 10, 224, 25, 102)) get_pdu = GetPDU( header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), @@ -191,7 +191,7 @@ def test_subtype_lldp_rem_man_addr_table(self): self.assertEqual(value0.type_, ValueType.INTEGER) self.assertEqual(value0.data, 2) - # Verfiy only valid ipv6 address exiit. Ethernet12 has this config. + # Verfiy only valid ipv6 address exist. Ethernet12 has this config. oid = ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 13, 1, 2, 16, 254, 128, 38, 138, 0, 0, 0, 0, 0, 0, 7, 255, 254, 63, 131, 76)) get_pdu = GetPDU( header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), diff --git a/tests/test_lldp.py b/tests/test_lldp.py index 9b94b89c7..0ff3e1059 100644 --- a/tests/test_lldp.py +++ b/tests/test_lldp.py @@ -107,7 +107,7 @@ def test_subtype_lldp_loc_man_addr_table(self): def test_subtype_lldp_rem_man_addr_table(self): # Get the first entry of walk. We will get IPv4 Address associated with Ethernet92 Port - # Verfiy both valid ipv4 and ipv6 address exit + # Verfiy both valid ipv4 and ipv6 address exist for entry in range(3, 6): oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, entry)) get_pdu = GetNextPDU( @@ -147,7 +147,7 @@ def test_subtype_lldp_rem_man_addr_table(self): self.assertEqual(value0.type_, ValueType.OBJECT_IDENTIFIER) self.assertEqual(str(value0.data), str(ObjectIdentifier(5, 2, 0, 0, (1, 2, 2, 1, 1)))) - # Verfiy both valid ipv4 and invalid ipv6 address exit. Ethernet5 has this config. + # Verfiy both valid ipv4 and invalid ipv6 address exist. Ethernet5 has this config. oid = ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 5, 1, 1, 4, 10, 224, 25, 101)) get_pdu = GetPDU( header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), @@ -159,7 +159,7 @@ def test_subtype_lldp_rem_man_addr_table(self): self.assertEqual(value0.type_, ValueType.INTEGER) self.assertEqual(value0.data, 2) - # Verfiy only valid ipv4 address exit. Ethernet8 has this config. + # Verfiy only valid ipv4 address exist. Ethernet8 has this config. oid = ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18543, 9, 1, 1, 4, 10, 224, 25, 102)) get_pdu = GetPDU( header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), @@ -171,7 +171,7 @@ def test_subtype_lldp_rem_man_addr_table(self): self.assertEqual(value0.type_, ValueType.INTEGER) self.assertEqual(value0.data, 2) - # Verfiy only valid ipv6 address exiit. Ethernet12 has this config. + # Verfiy only valid ipv6 address exist. Ethernet12 has this config. oid = ObjectIdentifier(20, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18545, 13, 1, 2, 16, 254, 128, 38, 138, 0, 0, 0, 0, 0, 0, 7, 255, 254, 63, 131, 76)) get_pdu = GetPDU( header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0), @@ -184,7 +184,7 @@ def test_subtype_lldp_rem_man_addr_table(self): self.assertEqual(value0.type_, ValueType.INTEGER) self.assertEqual(value0.data, 2) - # Verfiy no mgmt address exit. Ethernet16 has this config. + # Verfiy no mgmt address exist. Ethernet16 has this config. oid = ObjectIdentifier(11, 0, 0, 0, (1, 0, 8802, 1, 1, 2, 1, 4, 2, 1, 3, 18545, 17)) get_pdu = GetNextPDU( header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0),