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

[sonic-utilities] fix config/show vlan members #768

Closed
wants to merge 2 commits into from

Conversation

dawnbeauty
Copy link

@dawnbeauty dawnbeauty commented Dec 17, 2019

- What I did
fixes Azure/SONiC issue 323

- How I did it
As the issue mentioned, the "members@" field of VLAN is for backward compatibility.
Utility script should no longer use it when config add/del vlan members.

  • config add vlan members
    pre-add: check "members" of given vlan entry and vlan members table to ensure that the interface is not a member of given vlan.
    add: add interface to VLAN_MEMBER table. (not to "members" of vlan.)

  • config del vlan members
    pre-del: check "members" of given vlan entry and vlan members table to ensure that the interface is a member of given vlan.
    del: not only remove interface from VLAN_MEMBER table but also from "members" of vlan(if existing)

  • show vlan config
    collect members info from "members" list of given vlan and VLAN_MEMBER_TABLE.

- How to verify it
assume boot with below vlan configuration in config_db.json

    "VLAN": {
        "Vlan100": {
            "vlanid": "100"
        },
        "Vlan200": {
            "vlanid": "200"
        }
    },
    "VLAN_MEMBER": {
        "Vlan100|Ethernet0": {
            "tagging_mode": "untagged"
        },
        "Vlan100|Ethernet1": {
            "tagging_mode": "untagged"
        },
        "Vlan200|Ethernet2": {
            "tagging_mode": "tagged"
        },
        "Vlan200|Ethernet3": {
            "tagging_mode": "tagged"
        }
    }

- Previous command output (if the output of a command-line utility has changed)

  • show
admin@sonic:~$ show vlan brief
+-----------+-------------------+-----------+----------------+-----------------------+
|   VLAN ID | IP Address        | Ports     | Port Tagging   | DHCP Helper Address   |
+===========+===================+===========+================+=======================+
|       100 | 10.1.1.1/24       | Ethernet0 | untagged       |                       |
|           | 2000::10:1:1:1/80 | Ethernet1 | untagged       |                       |
+-----------+-------------------+-----------+----------------+-----------------------+
|       200 | 20.1.1.1/24       | Ethernet2 | tagged         |                       |
|           | 2000::20:1:1:1/80 | Ethernet3 | tagged         |                       |
+-----------+-------------------+-----------+----------------+-----------------------+
admin@sonic:~$ show vlan config
Name       VID
-------  -----
Vlan100    100
Vlan200    200

NOTICE: here we could not get vlan member output from show vlan config

  • config del vlan member
admin@sonic:~$ sudo config vlan member del 100 Ethernet0
Usage: config vlan member del [OPTIONS] <vid> <interface_name>

Error: Ethernet0 is not a member of Vlan100
  • config add vlan member
sudo config vlan member add 100 Ethernet4
admin@sonic:~$ redis-cli -n 4 hgetall "VLAN|Vlan100" 
1) "vlanid"
2) "100"
3) "members@"
4) "Ethernet4"

admin@sonic:~$ show vlan config
Name       VID  Member     Mode
-------  -----  ---------  ------
Vlan100    100  Ethernet4  tagged
Vlan200    200

- New command output (if the output of a command-line utility has changed)

  • show
admin@sonic:~$ show vlan config
Name       VID  Member     Mode
-------  -----  ---------  --------
Vlan100    100  Ethernet0  untagged
Vlan100    100  Ethernet1  untagged
Vlan200    200  Ethernet2  tagged
Vlan200    200  Ethernet3  tagged
  • config del vlan member
admin@sonic:~$ sudo config vlan member del 100 Ethernet0
admin@sonic:~$ show vlan config
Name       VID  Member     Mode
-------  -----  ---------  --------
Vlan100    100  Ethernet1  untagged
Vlan200    200  Ethernet2  tagged
Vlan200    200  Ethernet3  tagged
  • config add vlan member
admin@sonic:~$ sudo config vlan member add 100 Ethernet4
admin@sonic:~$ redis-cli -n 4 hgetall "VLAN|Vlan100"                
1) "vlanid"
2) "100"
admin@sonic:~$ show vlan config
Name       VID  Member     Mode
-------  -----  ---------  --------
Vlan100    100  Ethernet1  untagged
Vlan100    100  Ethernet4  tagged
Vlan200    200  Ethernet2  tagged
Vlan200    200  Ethernet3  tagged

@prsunny
Copy link
Contributor

prsunny commented Feb 8, 2020

Can you update the description with previous and new output?

@jleveque
Copy link
Contributor

@dawnbeauty: Can you update the description with previous and new output?

@dawnbeauty
Copy link
Author

@prsunny @jleveque Updated comments. Please review again, thanks.

@jleveque
Copy link
Contributor

jleveque commented Apr 8, 2020

@dawnbeauty: Thanks. Can you also fix the recent merge conflict?

@dawnbeauty
Copy link
Author

Done.

@jleveque
Copy link
Contributor

Retest this please

@jleveque jleveque added the Bug label Apr 20, 2020
Copy link
Contributor

@prsunny prsunny left a comment

Choose a reason for hiding this comment

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

So command is no longer updating "members" field of VLAN table during add, correct?. Lgtm!

@lguohan
Copy link
Contributor

lguohan commented Aug 13, 2020

obsoleted by #1050

@lguohan lguohan closed this Aug 13, 2020
@dawnbeauty
Copy link
Author

@lguohan #1050 only fix the show commands, how about the add/del actions?

stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Apr 28, 2022
6cfb3ecb0248768da0a91e5f7fb4477c5da7eb4e (HEAD -> 201911, origin/201911) [build]: allow to use extra inc/lib location to build the package (sonic-net#595)
40d34872d3b7f354adac67f084eebf6ee467f779 Merge pull request sonic-net#846 from xumia/azp-201911
76ac50f147a7d820b19d8d7628a67f2fe4f5159b Disable the build test
6c9cf655b8b5b152cab1d578e05eddf8238b81b0 Fix branch reference error
ca8d81d37a9b0294098f161b036d330d9ff461e0 [ci]: download artifacts from master branch (sonic-net#768)
0cbf4d55c67a9f8f52715f95536f3588acf06c4a [ci]: use sonicbld pool (sonic-net#766)
b6f1265ee9bd86f8a5e909a6f1e9b2384497c906 [ci]: add build for arm64 and armhf (sonic-net#757)
9ec0a7da64d479b124815edc5b505fb88b2532a0 CI: add azure pipeline CI/CD (sonic-net#754)
1436dbe02cd3c56f796c6b3398d4075cd05d97e0 Fix RIF issue (sonic-net#835)

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants