Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sonic-cli-gen] first phase implementation of the SONiC CLI Auto-gene…
…ration tool (#1644) What I did Implemented the sonic-cli-gen according to the SONiC CLI Auto-generation HLD How I did it How the sonic-cli-gen works: Parse provided YANG model to the intermediate representation - python dictionary (you can find the structure in the sonic_cli_gen/yang_parser.py file). Pass the python dictionary to the appropriate j2 template (config or show) and generate the CLI plugin. Put the auto-generated CLI plugin to an appropriate location, where it can be discovered by SONiC CLI. How to verify it Check the file with unit tests - tests/cli_autogen_yang_parser_test.py Command output admin@sonic: sonic-cli-gen generate config sonic-acl Loaded below Yang Models ['sonic-acl', 'sonic-breakout_cfg', 'sonic-crm', 'sonic-device_metadata', 'sonic-device_neighbor', 'sonic-extension', 'sonic-flex_counter', 'sonic-interface', 'sonic-loopback-interface', 'sonic-port', 'sonic-portchannel', 'sonic-types', 'sonic-versions', 'sonic-vlan', 'sonic-vrf'] Note: Below table(s) have no YANG models: COPP_GROUP, COPP_TRAP, FEATURE, KDUMP, MGMT_INTERFACE, SNMP, SNMP_COMMUNITY, WJH, WJH_CHANNEL, INFO:sonic-cli-gen: Auto-generation successful! Location: /usr/local/lib/python3.7/dist-packages/config/plugins/auto/sonic-acl_yang.py admin@sonic: sonic-cli-gen remove config sonic-acl /usr/local/lib/python3.7/dist-packages/config/plugins/auto/sonic-acl_yang.py was removed.
- Loading branch information