Skip to content

show mac display wrong information for tagged vlan #894

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

Closed
Junchao-Mellanox opened this issue Apr 29, 2020 · 2 comments · Fixed by #1368
Closed

show mac display wrong information for tagged vlan #894

Junchao-Mellanox opened this issue Apr 29, 2020 · 2 comments · Fixed by #1368

Comments

@Junchao-Mellanox
Copy link
Collaborator

Description

Steps to reproduce the issue

  1. Add a tagged vlan
  2. Add a vlan member to it
  3. Save config and reboot
  4. Issue "show mac"

Describe the results you received

admin@sonic:~$ show mac
Failed to get Vlan id for bvid oid:0x26000000000013

invalid literal for int() with base 16: 'oid:0x26000000000013'

Describe the results you expected

It should show the correct fdb entry.

Additional information you deem important (e.g. issue happens only occasionally)

This is always reproducible. And here is the related data in ASIC db:

admin@sonic:~$ redis-cli -n 1
127.0.0.1:6379[1]> keys ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY:*
1) "ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY:{\"bvid\":\"oid:0x26000000000013\",\"mac\":\"EC:0D:9A:C3:B1:00\",\"switch_id\":\"oid:0x21000000000000\"}"
127.0.0.1:6379[1]> keys ASIC_STATE:SAI_OBJECT_TYPE_VLAN:*
1) "ASIC_STATE:SAI_OBJECT_TYPE_VLAN:oid:0x260000000005c1"
2) "ASIC_STATE:SAI_OBJECT_TYPE_VLAN:oid:0x26000000000647"
3) "ASIC_STATE:SAI_OBJECT_TYPE_VLAN:oid:0x26000000000013"
4) "ASIC_STATE:SAI_OBJECT_TYPE_VLAN:oid:0x260000000005c0"
127.0.0.1:6379[1]> hgetall ASIC_STATE:SAI_OBJECT_TYPE_VLAN:oid:0x26000000000013
1) "NULL"
2) "NULL"

According to the code in fanshow, I think we might have a few problems:

  1. bvid value "oid:0x26000000000013" cannot be converted to an int value, we might need do it like:
int(fdb["bvid"][oid_pfx:], 16)
  1. Even if we convert it as above, we will display the integer value of an oid to the "Vlan" column. Not sure if it is a good idea.
  2. I am not sure why there is a vlan entry in ASIC DB whose key/value is "NULL"/"NULL". Maybe is for the default vlan?

Output of show version

SONiC Software Version: SONiC.201911.80-827aab79
Distribution: Debian 9.12
Kernel: 4.9.0-11-2-amd64
Build commit: 827aab79
Build date: Tue Apr 28 04:09:04 UTC 2020
Built by: johnar@jenkins-worker-8

Platform: x86_64-mlnx_msn2100-r0
HwSKU: ACS-MSN2100
ASIC: mellanox
Serial Number: MT1851X13655
Uptime: 08:01:02 up 57 min,  1 user,  load average: 0.68, 0.40, 0.55

Docker images:
REPOSITORY                    TAG                  IMAGE ID            SIZE
docker-syncd-mlnx             201911.80-827aab79   460bca0bf4b1        383MB
docker-syncd-mlnx             latest               460bca0bf4b1        383MB
docker-router-advertiser      201911.80-827aab79   16c0820ef408        283MB
docker-router-advertiser      latest               16c0820ef408        283MB
docker-sonic-mgmt-framework   201911.80-827aab79   589a1f619061        422MB
docker-sonic-mgmt-framework   latest               589a1f619061        422MB
docker-platform-monitor       201911.80-827aab79   6f95ab58f81b        628MB
docker-platform-monitor       latest               6f95ab58f81b        628MB
docker-fpm-frr                201911.80-827aab79   051f94c9fe59        327MB
docker-fpm-frr                latest               051f94c9fe59        327MB
docker-sflow                  201911.80-827aab79   00a8e232d52b        307MB
docker-sflow                  latest               00a8e232d52b        307MB
docker-lldp-sv2               201911.80-827aab79   7c33ccec4241        304MB
docker-lldp-sv2               latest               7c33ccec4241        304MB
docker-dhcp-relay             201911.80-827aab79   e3273113f651        293MB
docker-dhcp-relay             latest               e3273113f651        293MB
docker-database               201911.80-827aab79   d7efde7ed482        283MB
docker-database               latest               d7efde7ed482        283MB
docker-teamd                  201911.80-827aab79   2489501d9bbf        307MB
docker-teamd                  latest               2489501d9bbf        307MB
docker-snmp-sv2               201911.80-827aab79   f18e81125d34        340MB
docker-snmp-sv2               latest               f18e81125d34        340MB
docker-orchagent              201911.80-827aab79   e07a3afec267        325MB
docker-orchagent              latest               e07a3afec267        325MB
docker-nat                    201911.80-827aab79   04cff4f32dc6        309MB
docker-nat                    latest               04cff4f32dc6        309MB
docker-sonic-telemetry        201911.80-827aab79   8175d18b53c0        344MB
docker-sonic-telemetry        latest               8175d18b53c0        344MB

@madhanmellanox
Copy link
Contributor

This is an issue caused by NULL values in ASIC DB for VLAN 1. This is a Day-1 issue. Fdbshow script is unable to find VLAN id corresponding to BVID of that of VLAN 1, so it reports error.

admin@r-qa-sw-eth-2133:~$ show mac
Failed to get Vlan id for bvid oid:0x26000000000013

invalid literal for int() with base 10: 'oid:0x26000000000013'
admin@r-qa-sw-eth-2133:$
admin@r-qa-sw-eth-2133:
$ redis-cli -n 1
127.0.0.1:6379[1]> keys VLAN

  1. "ASIC_STATE:SAI_OBJECT_TYPE_VLAN_MEMBER:oid:0x270000000005a6"
  2. "ASIC_STATE:SAI_OBJECT_TYPE_VLAN:oid:0x2600000000058d"
  3. "ASIC_STATE:SAI_OBJECT_TYPE_VLAN:oid:0x26000000000013"
    127.0.0.1:6379[1]> hgetall "ASIC_STATE:SAI_OBJECT_TYPE_VLAN:oid:0x2600000000058d"
  4. "SAI_VLAN_ATTR_VLAN_ID"
  5. "2"
    127.0.0.1:6379[1]> hgetall "ASIC_STATE:SAI_OBJECT_TYPE_VLAN:oid:0x26000000000013"
  6. "NULL"
  7. "NULL"
    127.0.0.1:6379[1]> keys FDB
  8. "ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY:{"bvid":"oid:0x26000000000013","mac":"1C:34:DA:1B:3E:00","switch_id":"oid:0x21000000000000"}"
    127.0.0.1:6379[1]>

This is as per design. Since SONiC creates VLAN 1, but SAI is unaware of it.

@ghost
Copy link

ghost commented Jan 19, 2021

Dear @Junchao-Mellanox, @madhanmellanox,

It seems the system currently does not throw the exception here https://github.com/Azure/sonic-utilities/blob/master/scripts/fdbshow#L89. But it throws exception little bit further, so, currently, we are getting the next output:

int() argument must be a string, a bytes-like object or a number, not 'NoneType'

The output has changed, but the root cause is the same. I have prepared PR to handle FDB entries with default Vlan. Could you check it? #1368

qiluo-msft pushed a commit that referenced this issue Mar 16, 2021
…1507)

* Skip records of FDB entries, which are linked to default Vlan 1,
  to prevent exception throwing while performing
  command 'show mac' or 'fdbshow'.

#### What I did
Resolves #894
Fixed "show mac" command execution failure in case, when the system has an FDB entry, which is linked to default Vlan 1.
The failure is caused by throwing exception, while trying to get int from None type object.
#### How I did it
The condition has added to src/sonic-utilities/scripts/fdbshow script to handle and skip FDB entries, for which the system can not get Vlan ID.

#### How to verify it
Configure your system to receive both tagged and untagged traffic. For example, you could use the next steps:

Do configuration on DUT
sudo config portchannel add PortChannel0002
sudo config portchannel member add PortChannel0002 Ethernet68
sudo config vlan add 40
sudo config vlan member add 40 PortChannel0002
sudo config interface ip add Vlan40 40.0.0.1/24
Do configuration on Linux host
sudo ip link add bond0 type bond
sudo ip link set dev bond0 type bond mode 4
sudo ip link set enp5s0f1 down
sudo ip link set enp5s0f1 master bond0
sudo ip link set enp5s0f1 up
sudo ip link set bond0 up
sudo ip link add link bond0 name bond0.40 type vlan id 40
sudo ip link set bond0.40 up
sudo ip addr add 40.0.0.3/24 dev bond0.40
Do ping from linux host to DUT IP 40.0.0.1
Do command "show mac" on DUT
"show mac" command should not be finished with the next message: int() argument must be a string, a bytes-like object or a number, not 'NoneType'. Instead, the normal output of the command should be shown.

#### Additional information
Cherry-pick of #1368.

Pay attention, additional change is required. HEAD of https://github.com/Azure/sonic-py-swsssdk submodule of buildimage should be updated and be pointed to the top of 201911 branch, because current head of the submodule causes KeyError exception raising inside function `get_vlan_id_from_bvid` of `port_util.py` module:
```
SAI_VLAN_ATTR_VLAN_ID ('SAI_VLAN_ATTR_VLAN_ID',)
Failed to get Vlan id for bvid oid:0x26000000000013
```
The raising has already fixed on the top of 201911 branch of the submodule.
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 a pull request may close this issue.

2 participants