Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layer 2 Forwarding Enhancements #529

Closed
wants to merge 59 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
eee827e
Update main.py
anilkpandey May 9, 2019
d4e5346
Update main.py
anilkpandey May 9, 2019
b63e795
Update main.py
anilkpandey May 9, 2019
a4beefc
added configuration validations
anilkpandey May 10, 2019
1564302
'show mac' performance improvement
anilkpandey Jun 5, 2019
f567fbb
revert changes
anilkpandey Jun 5, 2019
0bfb742
Delete .DS_Store
anilkpandey Jun 5, 2019
d544203
revert validation related changes
anilkpandey Jun 6, 2019
186b295
removed code repetition
anilkpandey Jun 26, 2019
6742c63
Merge remote-tracking branch 'upstream/master'
anilkpandey Sep 7, 2019
a8935af
Layer 2 Forwarding Enhancements
anilkpandey Sep 8, 2019
7d272ed
Layer 2 Forwarding Enhancements
anilkpandey Sep 8, 2019
863fb4e
Merge remote-tracking branch 'upstream/master'
anilkpandey Oct 15, 2019
224ea6a
Merge remote-tracking branch 'upstream/master'
anilkpandey Nov 8, 2019
2c504a3
Update main.py
anilkpandey Nov 8, 2019
714001d
Update main.py
anilkpandey Nov 8, 2019
83cbba4
Update main.py
anilkpandey Nov 8, 2019
c5892c5
Merge remote-tracking branch 'upstream/master'
anilkpandey Nov 14, 2019
c7fc6e2
Merge remote-tracking branch 'upstream/master'
anilkpandey Nov 14, 2019
14acb2b
Merge remote-tracking branch 'upstream/master'
anilkpandey Dec 3, 2019
851963e
Merge remote-tracking branch 'upstream/master'
anilkpandey Apr 21, 2020
ed5961d
Merge remote-tracking branch 'upstream/master'
anilkpandey Aug 14, 2020
0dde163
Merge remote-tracking branch 'upstream/master'
anilkpandey Aug 14, 2020
ff828a8
move "show vlan count" command to vlan.py
anilkpandey Aug 14, 2020
1289a59
Update main.py
anilkpandey Aug 14, 2020
91ffc2c
Update main.py
anilkpandey Aug 14, 2020
463f738
Update main.py
anilkpandey Aug 16, 2020
325327d
moved vlan commands to vlan.py
anilkpandey Aug 17, 2020
4eda4a5
fixed lgtm
anilkpandey Aug 17, 2020
3689a4d
fixed lgtm
anilkpandey Aug 17, 2020
e642d83
fix lgtm
anilkpandey Aug 17, 2020
e9ab1d6
updated as per review comments
anilkpandey Aug 21, 2020
a6fbfc3
Merge remote-tracking branch 'upstream/master'
anilkpandey Aug 21, 2020
d087bcf
Merge remote-tracking branch 'upstream/master'
anilkpandey Sep 11, 2020
b49e6af
Update main.py
anilkpandey Sep 11, 2020
4b4d16d
Update main.py
anilkpandey Sep 11, 2020
aa927ce
addressed review comments
anilkpandey Sep 18, 2020
d98e16c
Update main.py
anilkpandey Oct 1, 2020
c3252ea
Update fast-reboot-dump.py
anilkpandey Oct 1, 2020
59ffd0e
Merge remote-tracking branch 'upstream/master'
anilkpandey Oct 15, 2020
820cb10
Merge remote-tracking branch 'upstream/master'
anilkpandey Oct 21, 2020
d9fd950
Merge remote-tracking branch 'upstream/master'
anilkpandey Oct 26, 2020
cb7a37d
include latest changes after syncing to master
anilkpandey Dec 4, 2020
ad620a2
Merge remote-tracking branch 'upstream/master'
anilkpandey Dec 4, 2020
afc5321
Update vlan.py
anilkpandey Dec 4, 2020
82d8c88
Update fdbshow
anilkpandey Dec 4, 2020
588db37
Update vlan.py
anilkpandey Dec 4, 2020
349c5a1
Update fdbshow
anilkpandey Dec 7, 2020
243c85a
Update fdbshow
anilkpandey Dec 7, 2020
36fa108
Update main.py
anilkpandey Dec 7, 2020
12e7482
Update main.py
anilkpandey Dec 7, 2020
65b1b18
fixed LGTM issue
anilkpandey Dec 7, 2020
38fd881
Merge remote-tracking branch 'upstream/master'
anilkpandey Dec 9, 2020
2a9ab88
added pytests
anilkpandey Dec 9, 2020
a8c651e
added more tests for vlan range and fdb config commands
anilkpandey Dec 17, 2020
2800171
fix lgtm
anilkpandey Dec 18, 2020
2fcd83d
Merge remote-tracking branch 'upstream/master'
anilkpandey Nov 3, 2021
b037b7d
fixed test failures
anilkpandey Nov 9, 2021
3a28e06
Fix lgtm error
anilkpandey Nov 9, 2021
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
2 changes: 1 addition & 1 deletion config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,4 +1124,4 @@ def naming_mode_alias():


if __name__ == '__main__':
config()
config()
34 changes: 29 additions & 5 deletions scripts/fdbshow
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,49 @@ class FdbShow(object):
return

oid_pfx = len("oid:0x")

client = self.db.redis_clients["ASIC_DB"]
pipe = client.pipeline()
values = []
fdb_list = []
for s in fdb_str:
fdb_entry = s.decode()
fdb = json.loads(fdb_entry .split(":", 2)[-1])
if not fdb:
continue

ent = self.db.get_all('ASIC_DB', s, blocking=True)
fdb_list.append(fdb)
pipe.hgetall(s)
values = pipe.execute()
vlans = []
vlan_keys = self.db.keys('ASIC_DB', "ASIC_STATE:SAI_OBJECT_TYPE_VLAN:*")
for v in vlan_keys:
pipe.hgetall(v)
vlans = pipe.execute()

posi = 0
for ent in values:
if 'SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID' not in ent:
posi = posi + 1
anilkpandey marked this conversation as resolved.
Show resolved Hide resolved
continue
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"]
if br_port_id not in self.if_br_oid_map:
posi = posi + 1
continue
port_id = self.if_br_oid_map[br_port_id]
if_name = self.if_oid_map[port_id]
#When if_name not mapped to port_id in DB, using port_id as if_name in the display.
try:
if_name = self.if_oid_map[port_id]
except :
if_name = port_id

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"])
self.bridge_mac_list.append((int(vlan_id),) + (fdb["mac"],) + (if_name,) + (fdb_type,))
vlan_id = vlans[vlan_keys.index("ASIC_STATE:SAI_OBJECT_TYPE_VLAN:{}".format(fdb_list[posi][u'bvid']))] [b"SAI_VLAN_ATTR_VLAN_ID"]
prsunny marked this conversation as resolved.
Show resolved Hide resolved
self.bridge_mac_list.append((int(vlan_id),) + (fdb_list[posi]["mac"],) + (if_name,) + (fdb_type,))
posi = posi + 1

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