From 3e2bfa8bb1b7505b67631e23bfd27f2e66120004 Mon Sep 17 00:00:00 2001 From: madhanmellanox <62459540+madhanmellanox@users.noreply.github.com> Date: Tue, 1 Dec 2020 23:53:53 -0800 Subject: [PATCH] Fixing python porting errors in fdbshow, natshow and nbrshow (#1280) I fixed python porting errors in fdbshow, natshow and nbrshow scripts by removing 'b' from strings of the form b"xxxxx" Co-authored-by: Madhan Babu --- scripts/fdbshow | 4 ++-- scripts/natshow | 16 ++++++++-------- scripts/nbrshow | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/fdbshow b/scripts/fdbshow index 9122740e83..759472a56d 100755 --- a/scripts/fdbshow +++ b/scripts/fdbshow @@ -72,8 +72,8 @@ class FdbShow(object): continue ent = self.db.get_all('ASIC_DB', s, blocking=True) - br_port_id = ent[b"SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID"][oid_pfx:] - ent_type = ent[b"SAI_FDB_ENTRY_ATTR_TYPE"] + br_port_id = ent["SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID"][oid_pfx:] + ent_type = ent["SAI_FDB_ENTRY_ATTR_TYPE"] fdb_type = ['Dynamic','Static'][ent_type == "SAI_FDB_ENTRY_TYPE_STATIC"] if br_port_id not in self.if_br_oid_map: continue diff --git a/scripts/natshow b/scripts/natshow index b4ea21af56..cd0a58c38b 100644 --- a/scripts/natshow +++ b/scripts/natshow @@ -139,30 +139,30 @@ class NatShow(object): nat_type = nat['nat_type'] if nat_type == "SAI_NAT_TYPE_DESTINATION_NAT": - translated_dst_ip = ent[b"SAI_NAT_ENTRY_ATTR_DST_IP"] + translated_dst_ip = ent["SAI_NAT_ENTRY_ATTR_DST_IP"] if "SAI_NAT_ENTRY_ATTR_L4_DST_PORT" in ent: - translated_dst_port = ent[b"SAI_NAT_ENTRY_ATTR_L4_DST_PORT"] + translated_dst_port = ent["SAI_NAT_ENTRY_ATTR_L4_DST_PORT"] translated_dst = translated_dst_ip + ":" + translated_dst_port else: translated_dst = translated_dst_ip elif nat_type == "SAI_NAT_TYPE_SOURCE_NAT": - translated_src_ip = ent[b"SAI_NAT_ENTRY_ATTR_SRC_IP"] + translated_src_ip = ent["SAI_NAT_ENTRY_ATTR_SRC_IP"] if "SAI_NAT_ENTRY_ATTR_L4_SRC_PORT" in ent: - translated_src_port = ent[b"SAI_NAT_ENTRY_ATTR_L4_SRC_PORT"] + translated_src_port = ent["SAI_NAT_ENTRY_ATTR_L4_SRC_PORT"] translated_src = translated_src_ip + ":" + translated_src_port else: translated_src = translated_src_ip elif nat_type == "SAI_NAT_TYPE_DOUBLE_NAT": - translated_dst_ip = ent[b"SAI_NAT_ENTRY_ATTR_DST_IP"] + translated_dst_ip = ent["SAI_NAT_ENTRY_ATTR_DST_IP"] if "SAI_NAT_ENTRY_ATTR_L4_DST_PORT" in ent: - translated_dst_port = ent[b"SAI_NAT_ENTRY_ATTR_L4_DST_PORT"] + translated_dst_port = ent["SAI_NAT_ENTRY_ATTR_L4_DST_PORT"] translated_dst = translated_dst_ip + ":" + translated_dst_port else: translated_dst = translated_dst_ip - translated_src_ip = ent[b"SAI_NAT_ENTRY_ATTR_SRC_IP"] + translated_src_ip = ent["SAI_NAT_ENTRY_ATTR_SRC_IP"] if "SAI_NAT_ENTRY_ATTR_L4_SRC_PORT" in ent: - translated_src_port = ent[b"SAI_NAT_ENTRY_ATTR_L4_SRC_PORT"] + translated_src_port = ent["SAI_NAT_ENTRY_ATTR_L4_SRC_PORT"] translated_src = translated_src_ip + ":" + translated_src_port else: translated_src = translated_src_ip diff --git a/scripts/nbrshow b/scripts/nbrshow index 8791803298..980ddd9d77 100644 --- a/scripts/nbrshow +++ b/scripts/nbrshow @@ -82,7 +82,7 @@ class NbrBase(object): continue ent = self.db.get_all('ASIC_DB', s, blocking=True) - br_port_id = ent[b"SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID"][oid_pfx:] + br_port_id = ent["SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID"][oid_pfx:] if br_port_id not in self.if_br_oid_map: continue port_id = self.if_br_oid_map[br_port_id]