Skip to content

Add sonic-otn-cli-filter package to hide unwanted switch CLI commands - #24

Open
jjin62 wants to merge 15 commits into
otn-devfrom
cli-enhancement
Open

Add sonic-otn-cli-filter package to hide unwanted switch CLI commands#24
jjin62 wants to merge 15 commits into
otn-devfrom
cli-enhancement

Conversation

@jjin62

@jjin62 jjin62 commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

OCS/OTN platforms do not need switch-oriented CLI commands such as VLAN, VXLAN, NAT, BGP, etc. This new package leverages the existing sonic-utilities plugin mechanism to filter them out at runtime.

Key components:

  • sonic_otn_cli_filter.py: core filtering logic that monkey-patches click.Group.list_commands/get_command based on a per-device blacklist
  • zzz_{show,config,clear}platform_filter.py: plugins with zzz prefix to guarantee they load last, after all other plugins register commands
  • cli_unwanted.json: per-device blacklist for the otn-kvm platform
  • debian packaging with postinst/prerm to symlink plugins into the sonic-utilities plugin directories at install time
  • Build integration via rules.mk, rules.dep and one-image.mk

Reference: #22

jjin62 and others added 15 commits March 31, 2026 15:08
Signed-off-by: oplklum <lu.mao@molex.com>
Signed-off-by: oplklum <lu.mao@molex.com>
Signed-off-by: oplklum <lu.mao@molex.com>
Signed-off-by: oplklum <lu.mao@molex.com>
This commit introduces the sonic-yanggen package for the otn-kvm platform.
This package automates the conversion of OpenConfig annotation YANG files
into SONiC YANG models and generates the corresponding CLI commands
at runtime.

Key features:
- Automatically converts annotation YANGs to SONiC YANGs during build.
- Supports configuration via 'yang_auto_cli' file in device directory.
- Provides 'yang_auto_cli.sh' service to register CLI commands on startup.
- Includes logic to avoid conflicts with existing system CLI commands.
add build action for sonic-otn otn-kvm platform
Consolidate OTN submodule pin updates, including repinning sonic-swss to f68c781f for the current build-compatible branch state.

Made-with: Cursor
OCS/OTN platforms do not need switch-oriented CLI commands such as
VLAN, VXLAN, NAT, BGP, etc.  This new package leverages the existing
sonic-utilities plugin mechanism to filter them out at runtime.

Key components:
- sonic_otn_cli_filter.py: core filtering logic that monkey-patches
  click.Group.list_commands/get_command based on a per-device blacklist
- zzz_{show,config,clear}_platform_filter.py: plugins with zzz_ prefix
  to guarantee they load last, after all other plugins register commands
- cli_unwanted.json: per-device blacklist for the otn-kvm platform
- debian packaging with postinst/prerm to symlink plugins into the
  sonic-utilities plugin directories at install time
- Build integration via rules.mk, rules.dep and one-image.mk
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