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

Show mac learned on lag interface #730

Closed
wants to merge 1 commit into from
Closed

Show mac learned on lag interface #730

wants to merge 1 commit into from

Conversation

JiangboHe
Copy link
Contributor

- What I did
The code is to show mac learned on lag.
The funtion need to read the LAG_NAME_MAP_TABLE data.

- How I did it
To read mac table and get its learned portchannel name from LAG_NAME_MAP_TABLE in COUNTERS_DB with oid.

- How to verify it

  1. Create PortChannel1 and add member port Ethernet10.
  2. Create vlan 10 and add member port PortChannel1.
  3. Create neighbor port PortChannel1 and add it to vlan 10.
  4. "show mac‘’ to see if it could show mac on PortChannel1.

- Previous command output (if the output of a command-line utility has changed)
root@sonic:/home/admin# show mac
2000000000658

- New command output (if the output of a command-line utility has changed)
root@sonic:/home/admin# show mac
No. Vlan MacAddress Port Type


1      10  00:8C:FA:9A:31:E3  PortChannel1  Dynamic

@lguohan lguohan requested a review from prsunny November 9, 2019 22:25
scripts/fdbshow Outdated
@@ -76,7 +78,10 @@ class FdbShow(object):
if br_port_id not in self.if_br_oid_map:
continue
port_id = self.if_br_oid_map[br_port_id]
if_name = self.if_oid_map[port_id]
if port_id.startswith("1"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think this assumption can be hard-coded here. You can check if the port_id exists in lag_if_oid_map, if so fetch from that and if not, get from if_oid_map

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi prsunny,
It is a very good suggestion, I have modified and tested the modifaction. The new commit is 6f281af.
Thanks.

@prsunny
Copy link
Contributor

prsunny commented Nov 14, 2019

retest this please

@JiangboHe
Copy link
Contributor Author

retest this please

This is the new test result yesterday:

root@sonic:/home/admin# show mac
No. Vlan MacAddress Port Type


1       2  00:8C:FA:C7:AE:B8  PortChannel1  Dynamic
2       3  80:05:88:5C:C7:75  Ethernet8     Dynamic

Total number of entries 2

@JiangboHe
Copy link
Contributor Author

I see that the commit sonic-net/sonic-py-swsssdk#51 will also fix the error. But I think a better modification is to provide API with a unique function such as API to get oid-map for interface/lag/bridge_port/vlan.
I have push another pull request sonic-net/sonic-py-swsssdk#55 for this error fix.
Thanks.

@rameshsanth
Copy link

This change is needed in nbrshow as well.. "show arp" has exact same issue.

thanks,

@prsunny
Copy link
Contributor

prsunny commented Nov 19, 2019

Merged, this - sonic-net/sonic-py-swsssdk#51. I think this should fix both fdb and nbr show.

@jleveque
Copy link
Contributor

Retest this please

@prsunny
Copy link
Contributor

prsunny commented Nov 21, 2019

@JiangboHe , can we close this PR as the fix is merged?

@JiangboHe JiangboHe closed this Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants