Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions scripts/fast-reboot-dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import binascii
import argparse


ARP_CHUNK = binascii.unhexlify('08060001080006040001') # defines a part of the packet for ARP Request
ARP_PAD = binascii.unhexlify('00' * 18)

Expand Down Expand Up @@ -148,7 +147,7 @@ def get_fdb(db, vlan_name, vlan_id, bridge_id_2_iface):
def generate_fdb_entries(filename):
fdb_entries = []

db = swsssdk.SonicV2Connector(host='127.0.0.1')
db = swsssdk.SonicV2Connector(host='127.0.0.1', port=6380)
db.connect(db.ASIC_DB, False) # Make one attempt only

bridge_id_2_iface = get_map_bridge_port_id_2_iface_name(db)
Expand Down
11 changes: 6 additions & 5 deletions scripts/fdbshow
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ class FdbShow(object):
def __init__(self):
super(FdbShow,self).__init__()
self.db = SonicV2Connector(host="127.0.0.1")
self.db_sec = SonicV2Connector(host="127.0.0.1", port=6380)
self.if_name_map, \
self.if_oid_map = port_util.get_interface_oid_map(self.db)
self.if_br_oid_map = port_util.get_bridge_port_map(self.db)
self.if_br_oid_map = port_util.get_bridge_port_map(self.db_sec)
self.fetch_fdb_data()
return

Expand All @@ -52,10 +53,10 @@ class FdbShow(object):
Fetch FDB entries from ASIC DB.
FDB entries are sorted on "VlanID" and stored as a list of tuples
"""
self.db.connect(self.db.ASIC_DB)
self.db_sec.connect(self.db_sec.ASIC_DB)
self.bridge_mac_list = []

fdb_str = self.db.keys('ASIC_DB', "ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY:*")
fdb_str = self.db_sec.keys('ASIC_DB', "ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY:*")
if not fdb_str:
return

Expand All @@ -69,7 +70,7 @@ class FdbShow(object):
if not fdb:
continue

ent = self.db.get_all('ASIC_DB', s, blocking=True)
ent = self.db_sec.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"]
fdb_type = ['Dynamic','Static'][ent_type == "SAI_FDB_ENTRY_TYPE_STATIC"]
Expand All @@ -80,7 +81,7 @@ class FdbShow(object):
if 'vlan' in fdb:
vlan_id = fdb["vlan"]
elif 'bvid' in fdb:
vlan_id = port_util.get_vlan_id_from_bvid(self.db, fdb["bvid"])
vlan_id = port_util.get_vlan_id_from_bvid(self.db_sec, fdb["bvid"])
self.bridge_mac_list.append((int(vlan_id),) + (fdb["mac"],) + (if_name,) + (fdb_type,))

self.bridge_mac_list.sort(key = lambda x: x[0])
Expand Down