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

"config vlan member del 1000 Ethernet4" failed with "Ethernet4 is not a member of Vlan1000" #2665

Closed
wangxin opened this issue Mar 13, 2019 · 2 comments
Assignees
Labels
Triaged this issue has been triaged

Comments

@wangxin
Copy link
Contributor

wangxin commented Mar 13, 2019

Description
SONiC switch is running the t0 topology. On my DUT switch, ports Ethernet4 to Ethernet96 are in Vlan1000. If use command like config vlan member del 1000 Ethernet4 to remove a port from vlan, the cmd would fail with error "Ethernet4 is not a member of Vlan1000"

Steps to reproduce the issue:

  1. Deploy SONiC switch with t0 topology defined in sonic-mgmt.
  2. Run command config vlan member del 1000 Ethernet4. Here Ethernet4 can be any other port in Vlan1000.

Describe the results you received:
The command failed with Ethernet4 is not a member of Vlan1000.

Describe the results you expected:
The command should be able to remove the specified port from VLAN.

Additional information you deem important (e.g. issue happens only occasionally):
My DUT switch was deployed with minigraph firstly. Vlan related configuration in my minigraph.xml:

<VlanInterfaces>
  <VlanInterface>
    <Name>Vlan1000</Name>
    <AttachTo>Ethernet4;Ethernet8;Ethernet12;Ethernet16;Ethernet20;Ethernet24;Ethernet28;Ethernet32;Ethernet36;Ethernet40;Ethernet44;Ethernet48;Ethernet52;Ethernet56;Ethernet60;Ethernet64;Ethernet68;Ethernet72;Ethernet76;Ethernet80;Ethernet84;Ethernet88;Ethernet92;Ethernet96</AttachTo>
    <NoDhcpRelay>False</NoDhcpRelay>
    <StaticDHCPRelay>0.0.0.0/0</StaticDHCPRelay>
    <Type i:nil="true"/>
    <DhcpRelays>192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4</DhcpRelays>
    <VlanID>1000</VlanID>
    <Tag>1000</Tag>
    <Subnets>192.168.0.0/21</Subnets>
  </VlanInterface>
</VlanInterfaces>

After this minigraph was loaded, command config save -y was used to save the config to configDB. VLAN related information in /etc/sonic/config_db.json:

"VLAN": {
    "Vlan1000": {
        "dhcp_servers": [
            "192.0.0.1", 
            "192.0.0.2", 
            "192.0.0.3", 
            "192.0.0.4"
        ], 
        "vlanid": "1000"
    }
}
...
"VLAN_MEMBER": {
    "Vlan1000|Ethernet4": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet8": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet12": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet16": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet20": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet24": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet28": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet32": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet36": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet40": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet44": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet48": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet52": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet56": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet60": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet64": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet68": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet72": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet76": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet80": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet84": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet88": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet92": {
        "tagging_mode": "untagged"
    }, 
    "Vlan1000|Ethernet96": {
        "tagging_mode": "untagged"
    }
}

VLAN related configurations output by CLI:

admin@sonic-sw:~$ show vlan brief
+-----------+----------------+------------+----------------+-----------------------+
|   VLAN ID | IP Address     | Ports      | Port Tagging   | DHCP Helper Address   |
+===========+================+============+================+=======================+
|      1000 | 192.168.0.1/21 | Ethernet4  | untagged       | 192.0.0.1             |
|           |                | Ethernet8  | untagged       | 192.0.0.2             |
|           |                | Ethernet12 | untagged       | 192.0.0.3             |
|           |                | Ethernet16 | untagged       | 192.0.0.4             |
|           |                | Ethernet20 | untagged       |                       |
|           |                | Ethernet24 | untagged       |                       |
|           |                | Ethernet28 | untagged       |                       |
|           |                | Ethernet32 | untagged       |                       |
|           |                | Ethernet36 | untagged       |                       |
|           |                | Ethernet40 | untagged       |                       |
|           |                | Ethernet44 | untagged       |                       |
|           |                | Ethernet48 | untagged       |                       |
|           |                | Ethernet52 | untagged       |                       |
|           |                | Ethernet56 | untagged       |                       |
|           |                | Ethernet60 | untagged       |                       |
|           |                | Ethernet64 | untagged       |                       |
|           |                | Ethernet68 | untagged       |                       |
|           |                | Ethernet72 | untagged       |                       |
|           |                | Ethernet76 | untagged       |                       |
|           |                | Ethernet80 | untagged       |                       |
|           |                | Ethernet84 | untagged       |                       |
|           |                | Ethernet88 | untagged       |                       |
|           |                | Ethernet92 | untagged       |                       |
|           |                | Ethernet96 | untagged       |                       |
+-----------+----------------+------------+----------------+-----------------------+
admin@sonic-sw:~$ show vlan config
Name    VID    Member    Mode
------  -----  --------  ------
admin@sonic-sw:~$ redis-cli -n 4 keys VLAN\*
 1) "VLAN_MEMBER|Vlan1000|Ethernet56"
 2) "VLAN_MEMBER|Vlan1000|Ethernet28"
 3) "VLAN_MEMBER|Vlan1000|Ethernet40"
 4) "VLAN_MEMBER|Vlan1000|Ethernet48"
 5) "VLAN_MEMBER|Vlan1000|Ethernet68"
 6) "VLAN_MEMBER|Vlan1000|Ethernet52"
 7) "VLAN_MEMBER|Vlan1000|Ethernet24"
 8) "VLAN|Vlan1000"
 9) "VLAN_MEMBER|Vlan1000|Ethernet36"
10) "VLAN_MEMBER|Vlan1000|Ethernet64"
11) "VLAN_MEMBER|Vlan1000|Ethernet16"
12) "VLAN_MEMBER|Vlan1000|Ethernet72"
13) "VLAN_MEMBER|Vlan1000|Ethernet92"
14) "VLAN_MEMBER|Vlan1000|Ethernet4"
15) "VLAN_MEMBER|Vlan1000|Ethernet84"
16) "VLAN_MEMBER|Vlan1000|Ethernet88"
17) "VLAN_MEMBER|Vlan1000|Ethernet20"
18) "VLAN_MEMBER|Vlan1000|Ethernet60"
19) "VLAN_MEMBER|Vlan1000|Ethernet76"
20) "VLAN_MEMBER|Vlan1000|Ethernet80"
21) "VLAN_INTERFACE|Vlan1000|192.168.0.1/21"
22) "VLAN_MEMBER|Vlan1000|Ethernet8"
23) "VLAN_MEMBER|Vlan1000|Ethernet96"
24) "VLAN_MEMBER|Vlan1000|Ethernet32"
25) "VLAN_MEMBER|Vlan1000|Ethernet44"
26) "VLAN_MEMBER|Vlan1000|Ethernet12"
admin@sonic-sw:~$ redis-cli -n 4 hgetall "VLAN|Vlan1000"
1) "dhcp_servers@"
2) "192.0.0.1,192.0.0.2,192.0.0.3,192.0.0.4"
3) "vlanid"
4) "1000"

As we can see that config VLAN.Vlan1000 does not have a key with name members. The code of config vlan member del firstly checks whether the interface to be removed is in the members field of VLAN.Vlan1000. If not, then it will fail with error like "Ethernet4 is not a member of Vlan1000".

admin@sonic-sw:~$ sudo config vlan member del 1000 Ethernet4
Usage: config vlan member del [OPTIONS] <vid> <interface_name>

Error: Ethernet4 is not a member of Vlan1000

If I add members field to VLAN.Vlan1000 in configDB:

"VLAN": {
    "Vlan1000": {
        "dhcp_servers": [
            "192.0.0.1", 
            "192.0.0.2", 
            "192.0.0.3", 
            "192.0.0.4"
        ], 
        "vlanid": "1000",
        "members": [
            "Ethernet4", "Ethernet8", "Ethernet12", "Ethernet16", "Ethernet20", "Ethernet24", "Ethernet28", "Ethernet32", "Ethernet36", "Ethernet40", "Ethernet44", "Ethernet48", "Ethernet52", "Ethernet56", "Ethernet60", "Ethernet64", "Ethernet68", "Ethernet72", "Ethernet76", "Ethernet80", "Ethernet84", "Ethernet88", "Ethernet92", "Ethernet96"
        ]
    }
}

Then run config reload -y. After config is reloaded, show vlan config will have different output:

$ show vlan config
Name        VID  Member      Mode
--------  -----  ----------  --------
Vlan1000   1000  Ethernet4   untagged
Vlan1000   1000  Ethernet8   untagged
Vlan1000   1000  Ethernet12  untagged
Vlan1000   1000  Ethernet16  untagged
Vlan1000   1000  Ethernet20  untagged
Vlan1000   1000  Ethernet24  untagged
Vlan1000   1000  Ethernet28  untagged
Vlan1000   1000  Ethernet32  untagged
Vlan1000   1000  Ethernet36  untagged
Vlan1000   1000  Ethernet40  untagged
Vlan1000   1000  Ethernet44  untagged
Vlan1000   1000  Ethernet48  untagged
Vlan1000   1000  Ethernet52  untagged
Vlan1000   1000  Ethernet56  untagged
Vlan1000   1000  Ethernet60  untagged
Vlan1000   1000  Ethernet64  untagged
Vlan1000   1000  Ethernet68  untagged
Vlan1000   1000  Ethernet72  untagged
Vlan1000   1000  Ethernet76  untagged
Vlan1000   1000  Ethernet80  untagged
Vlan1000   1000  Ethernet84  untagged
Vlan1000   1000  Ethernet88  untagged
Vlan1000   1000  Ethernet92  untagged
Vlan1000   1000  Ethernet96  untagged

Then command config vlan member del Ethernet4 will be successful without issue. And the interface can be successfully removed from VLAN.

So, the problem here is that if we load configuration using only minigraph, there is no way to add members field for VLAN interface. The members field of VLAN interface is only supported by configdb, not by minigrah. There is a gap between minigraph and configDB.

Output of show version:

admin@sonic-sw:~$ show version
SONiC Software Version: SONiC.HEAD.911-11c2e9e
Distribution: Debian 9.8
Kernel: 4.9.0-8-2-amd64
Build commit: 11c2e9e
Build date: Tue Mar 12 03:22:13 UTC 2019
Built by: johnar@jenkins-worker-3

Docker images:
REPOSITORY                 TAG                 IMAGE ID            SIZE
docker-orchagent-mlnx      HEAD.911-11c2e9e    0d00301783c4        287MB
docker-orchagent-mlnx      latest              0d00301783c4        287MB
docker-syncd-mlnx          HEAD.911-11c2e9e    f5c6156d05a7        333MB
docker-syncd-mlnx          latest              f5c6156d05a7        333MB
docker-lldp-sv2            HEAD.911-11c2e9e    30731bc2e65c        275MB
docker-lldp-sv2            latest              30731bc2e65c        275MB
docker-router-advertiser   HEAD.911-11c2e9e    f6557718dd98        279MB
docker-router-advertiser   latest              f6557718dd98        279MB
docker-dhcp-relay          HEAD.911-11c2e9e    3dc27191fda4        257MB
docker-dhcp-relay          latest              3dc27191fda4        257MB
docker-database            HEAD.911-11c2e9e    b0a2252d1f05        280MB
docker-database            latest              b0a2252d1f05        280MB
docker-teamd               HEAD.911-11c2e9e    ddffbf76f995        275MB
docker-teamd               latest              ddffbf76f995        275MB
docker-snmp-sv2            HEAD.911-11c2e9e    d89775a6f8f1        295MB
docker-snmp-sv2            latest              d89775a6f8f1        295MB
docker-sonic-telemetry     HEAD.911-11c2e9e    afeb5cf19fe0        300MB
docker-sonic-telemetry     latest              afeb5cf19fe0        300MB
docker-platform-monitor    HEAD.911-11c2e9e    e730d7374a51        288MB
docker-platform-monitor    latest              e730d7374a51        288MB
docker-fpm-quagga          HEAD.911-11c2e9e    26e240a87922        282MB
docker-fpm-quagga          latest              26e240a87922        282MB

Attach debug file sudo generate_dump:

(paste your output here)
@chitra-raghavan
Copy link
Contributor

Evenafter adding the vlan port in config_db and deleting later , upon assigning ip address to the port , It shows Master as Bridge. Only config save and reload helps.

root@sonic-s6100-07:~# config vlan member add  1000 Ethernet6
root@sonic-s6100-07:~#  config vlan member del 1000 Ethernet6
root@sonic-s6100-07:~# config interface ip  add Ethernet6 1.1.1.1/24
root@sonic-s6100-07:~#
root@sonic-s6100-07:~# show ip interfae
Usage: show ip [OPTIONS] COMMAND [ARGS]...

Error: No such command "interfae".
root@sonic-s6100-07:~# show ip interface
Interface        Master    IPv4 address/mask    Admin/Oper    BGP Neighbor    Neighbor IP
---------------  --------  -------------------  ------------  --------------  -------------
Ethernet6        Bridge    1.1.1.1/24           up/up         N/A             N/A  <<<<<<<<<<<<
Loopback0                  10.1.0.32/32         up/up         N/A             N/A
PortChannel0001            10.0.0.0/31          up/up         ARISTA01T1      10.0.0.1
PortChannel0002            10.0.0.4/31          up/up         ARISTA02T1      10.0.0.5

@wangxin
Copy link
Contributor Author

wangxin commented Dec 2, 2021

Possibly fixed in sonic-net/sonic-utilities#1038. Closing this issue since it is too old.

@wangxin wangxin closed this as completed Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triaged this issue has been triaged
Projects
None yet
Development

No branches or pull requests

4 participants