Skip to content

cfgmgr debug CLI for vlan, intf and switch#362

Closed
jipanyang wants to merge 1 commit intosonic-net:masterfrom
jipanyang:cfgmgr_debug_cli
Closed

cfgmgr debug CLI for vlan, intf and switch#362
jipanyang wants to merge 1 commit intosonic-net:masterfrom
jipanyang:cfgmgr_debug_cli

Conversation

@jipanyang
Copy link
Copy Markdown
Contributor

Signed-off-by: Jipan Yang [email protected]

What I did
Debug CLI for configuring vlan, intf and switch to configDB

Why I did it
Verifying VLAN, intf and switch config through configDB

How I verified it
vlan, ip over vlan may be configured via the debug cli and work.
Details if related

@jipanyang
Copy link
Copy Markdown
Contributor Author

Some examples:

root@sonic:~# cfgmgr
Usage: cfgmgr OBJECT { COMMAND | help }
where OBJECT := { vlan | intf | switch }

root@sonic:~# cfgmgr vlan
Invalid option

Usage: cfgmgr vlan { add | del } vlan VLAN_ID [ { down | up } ]
[ mtu MTU ]
[ desc DESCRIPTION]
cfgmgr vlan { add | del } vlan VLAN_ID dev DEV [ untagged ]
cfgmgr vlan show <config | state> [ dev DEV ] [ vlan VLAN_ID ]
root@sonic:#
root@sonic:
#
root@sonic:~# cfgmgr intf
Invalid option

Usage: cfgmgr intf { add | del } PREFIX dev IFNAME

cfgmgr intf show <config | state> [ dev IFNAME ]

root@sonic:#
root@sonic:
#
root@sonic:~# cfgmgr switch
Invalid option

Usage: cfgmgr switch update
[ switch_mac {xx:xx:xx:xx:xx:xx} ]
[ unicast_miss_flood { forward | drop | trap } ]
[ multicast_miss_flood { forward | drop | trap } ]
[ broadcast_flood { forward | drop | trap } ]
cfgmgr switch show <config | state> [ dev DEV ]
root@sonic:#
root@sonic:
# cfgmgr switch update unicast_miss_flood drop broadcast_flood drop multicast_miss_flood trap switch_mac AA:BB:CC:DD:EE:FF
root@sonic:#
root@sonic:
# cfgmgr switch show config
-----Redis ConfigDB data---
SWITCH|SWITCH_ATTR
$fdb_multicast_miss_packet_action=trap
$fdb_broadcast_miss_packet_action=drop
$fdb_unicast_miss_packet_action=drop
$switch_mac=aa:bb:cc:dd:ee:ff

root@sonic:#
root@sonic:
# cfgmgr vlan add vlan 2000 mtu 9100 desc "testing vlan"
root@sonic:# cfgmgr vlan add vlan 2000 dev PortChannel47
root@sonic:
# cfgmgr intf add 172.16.18.190/24 dev Vlan2000
root@sonic:#
root@sonic:
# cfgmgr vlan show config
-----Redis ConfigDB data---
VLAN|Vlan2000
$unicast_miss_flood=true
$description=testing vlan
$mtu=9100
$autostate=disabled
$admin_status=up
$broadcast_flood=true
$multicast_miss_flood=true

VLAN|Vlan1000
$state=up
$vlanid=1000

VLAN_MEMBER|Vlan1000|Ethernet8
$tagging_mode=untagged

VLAN_MEMBER|Vlan1000|Ethernet20
$tagging_mode=untagged

VLAN_MEMBER|Vlan1000|Ethernet16
$tagging_mode=untagged

VLAN_MEMBER|Vlan2000|PortChannel47
$tagging_mode=tagged

VLAN_MEMBER|Vlan1000|Ethernet12
$tagging_mode=untagged

root@sonic:#
root@sonic:
# cfgmgr intf show config
-----Redis ConfigDB data---
MGMT_INTERFACE|Management0|10.34.14.190/24
$prefixlen=24
$gwaddr=10.34.14.1
$addr=10.34.14.190

VLAN_INTERFACE|Vlan2000|172.16.18.190/24
$scope=global
$family=IPv4

LOOPBACK_INTERFACE|Loopback0|100.0.0.37/32
$NULL=NULL

INTERFACE|Ethernet16|0.0.0.0/32
$NULL=NULL

root@sonic:~# cfgmgr intf show state dev Vlan2000
----Linux hostenv data----
748: Vlan2000@Bridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9100 qdisc noqueue state UP group default
link/ether 00:05:64:30:73:c0 brd ff:ff:ff:ff:ff:ff
inet 172.16.18.190/24 scope global Vlan2000
valid_lft forever preferred_lft forever
inet6 fe80::205:64ff:fe30:73c0/64 scope link
valid_lft forever preferred_lft forever

@jipanyang jipanyang force-pushed the cfgmgr_debug_cli branch 2 times, most recently from 4503775 to 2688bd4 Compare October 30, 2017 00:41
@lguohan
Copy link
Copy Markdown
Contributor

lguohan commented Nov 3, 2017

can we do this in sonic-utilities? in show/config commands

@ishidawataru
Copy link
Copy Markdown
Contributor

@JipanYanga Are you still working on this?
If not, I'd like to take over this work.

@lguohan using sonic-py-swsssdk in show / config to interact with configdb sounds reasonable to you?

@jipanyang
Copy link
Copy Markdown
Contributor Author

@ishidawataru I wrote the debug commands in c++ when the python swsssdk support was not there yet. To be consistent with the rest of the system, it is better to implement more official commands in python using sonic-py-swsssdk. The task is in my to-do list, but I have not put much effort on it yet. I appreciate it very much if you take over the work. Thanks!

@ishidawataru
Copy link
Copy Markdown
Contributor

@JipanYanga Got it. I'll work on this.

@ishidawataru
Copy link
Copy Markdown
Contributor

@JipanYanga Just opened a PR for VLAN CLI.

sonic-net/sonic-utilities#151

@lguohan
Copy link
Copy Markdown
Contributor

lguohan commented Dec 7, 2017

addressed in sonic-net/sonic-utilities#151

@lguohan lguohan closed this Dec 7, 2017
EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
jianyuewu pushed a commit to jianyuewu/sonic-swss that referenced this pull request Dec 24, 2025
* Add support for attribute capability query in lua script

* Rename query_response to response
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.

3 participants