Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions doc/cli_auto_generation/cli_auto_generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,13 @@ discovered_plugins = {

The SONiC CLI Auto-generation tool is a part of [sonic-package-manager](https://github.com/stepanblyschak/SONiC/blob/sonic-app-ext-3/doc/sonic-application-extention/sonic-application-extention-hld.md#cli-enhancements) utility. A package [installation](https://github.com/stepanblyschak/SONiC/blob/sonic-app-ext-3/doc/sonic-application-extention/sonic-application-extention-hld.md#package-installation) and [upgrade flow](https://github.com/stepanblyschak/SONiC/blob/sonic-app-ext-3/doc/sonic-application-extention/sonic-application-extention-hld.md#package-upgrade) will trigger the `SONiC CLI auto-generation tool` if the YANG model was provided as part of the Application extension docker image.

In order to get the auto-generated CLI - the YANG model should be a part of the Application extension Docker image and placed along with [manifest.json](https://github.com/stepanblyschak/SONiC/blob/sonic-app-ext-3/doc/sonic-application-extention/sonic-application-extention-hld.md#manifest) file. The user should be able to reach the YANG model by using the docker labels.
In order to get the auto-generated CLI - the YANG model should be a part of the Application extension Docker image and placed along with [manifest.json](https://github.com/stepanblyschak/SONiC/blob/sonic-app-ext-3/doc/sonic-application-extention/sonic-application-extention-hld.md#manifest) file. The user should be able to reach the YANG model by using the docker labels. Several YANG modules might be provided by an application extension:
```
com.azure.sonic.yang_model
com.azure.sonic.yang-module.sonic-<xxx>
com.azure.sonic.yang-module.sonic-<yyy>
```
where ```sonic-<xxx>```, ```sonic-<yyy>``` are the names of the modules, e.g (sonic-vlan, sonic-port, etc.) and should match the module name.

###### Figure 2: YANG model location as part of Application extension docker image
<p align=center>
<img src="images/yang_model_location.svg" alt="Figure 2 Yang model location">
Expand All @@ -133,15 +136,23 @@ The [manifest.json](https://github.com/stepanblyschak/SONiC/blob/sonic-app-ext-3

| Path | Type | Mandatory | Description |
| --------------------------------- | ------ | --------- | ------------------------------------------------------------------------- |
| /cli/click-cli-auto-generate-config | boolean| yes | ON/OFF triger for auto-generation of CLI command *config*. Default: false |
| /cli/click-cli-auto-generate-show | boolean| yes | ON/OFF triger for auto-generation of CLI command *show*. Default: false |
| /cli/auto-generate-config | boolean| yes | ON/OFF triger for auto-generation of CLI command *config*. Default: false |
| /cli/auto-generate-show | boolean| yes | ON/OFF triger for auto-generation of CLI command *show*. Default: false |

By default, CLI is autogenerated for all YANG modules provided by the extension. Developer can optionally specify explicitelly which YANG modules to use for auto-generated CLI:

| Path | Type | Mandatory | Description |
| --------------------------------- | ------ | --------- | ------------------------------------------------------------------------- |
| /cli/auto-generate-config-source-yang-modules | list of strings | no | If set, config CLI auto-generation will only apply to specified YANG modules. The YANG module is referenced by the name recorded in labels (which should match the name of the module) |
| /cli/auto-generate-show-source-yang-modules | list of strings | no | If set, config CLI auto-generation will only apply to specified YANG modules. The YANG module is referenced by the name recorded in labels (which should match the name of the module) |

Inside the manifest.json there are [other keys](https://github.com/stepanblyschak/SONiC/blob/sonic-app-ext-3/doc/sonic-application-extention/sonic-application-extention-hld.md#manifest-path-7), that describing a path to a `NOT auto-generated CLI plugins`. For example, there are:

| Path | Type | Mandatory | Description |
| ---------------------- | ------ | --------- | --------------------------------------------------------------- |
| /cli/show-cli-plugin | string | no | A path to a plugin for sonic-utilities show CLI command. |
| /cli/config-cli-plugin | string | no | A path to a plugin for sonic-utilities config CLI command. |
| /cli/show-cli-plugin | list of strings | no | List of paths to plugins for sonic-utilities show CLI command. |
| /cli/config-cli-plugin | list of strings | no | List of paths to plugins for sonic-utilities config CLI command. |
| /cli/clear-cli-plugin | list of strings | no | List of paths to plugins for sonic-utilities sonic-clear CLI command. |

For example, the user can have a `config` CLI auto-generated and the `show` CLI NOT auto-generated.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,11 @@ The value should contain a JSON serialized as a string.
| /processes | list | no | A list defining processes running inside the container. |
| /cli | object | no | CLI plugin information. *NOTE*: Later will deprecated and replaced with a YANG module file path. |
| /cli/mandatory | boolean| no | Wether CLI is a mandatory functionality for the package. Default: False. |
| /cli/show-cli-plugin | string | no | A path to a plugin for sonic-utilities show CLI command. |
| /cli/config-cli-plugin | string | no | A path to a plugin for sonic-utilities config CLI command. |
| /cli/clear-cli-plugin | string | no | A path to a plugin for sonic-utilities sonic-clear CLI command. |

| /cli/show-cli-plugin | list of strings | no | List of paths to plugins for sonic-utilities show CLI command. |
| /cli/config-cli-plugin | list of strings | no | List of paths to plugins for sonic-utilities config CLI command. |
| /cli/clear-cli-plugin | list of strings | no | List of paths to plugins for sonic-utilities sonic-clear CLI command. |
| /cli/auto-generate-config | boolean| yes | ON/OFF triger for auto-generation of CLI command *config*. Default: false |
| /cli/auto-generate-show | boolean| yes | ON/OFF triger for auto-generation of CLI command *show*. Default: false |
| /cli/auto-generate-config-source-yang-modules | list of strings | no | If set, config CLI auto-generation will only apply to specified YANG modules. The YANG module is referenced by the name recorded in labels (which should match the name of the module) |
| /cli/auto-generate-show-source-yang-modules | list of strings | no | If set, config CLI auto-generation will only apply to specified YANG modules. The YANG module is referenced by the name recorded in labels (which should match the name of the module) |

Original file line number Diff line number Diff line change
Expand Up @@ -1130,9 +1130,9 @@ ave to be also auto-generated from YANG in the future.
| Path | Type | Mandatory | Description |
| ---------------------- | ------ | --------- | --------------------------------------------------------------- |
| /cli/mandatory | boolean| no | Wether CLI is a mandatory functionality for the package. Default: False. |
| /cli/show-cli-plugin | string | no | A path to a plugin for sonic-utilities show CLI command. |
| /cli/config-cli-plugin | string | no | A path to a plugin for sonic-utilities config CLI command. |
| /cli/clear-cli-plugin | string | no | A path to a plugin for sonic-utilities sonic-clear CLI command. |
| /cli/show-cli-plugin | list of strings | no | List of paths to plugins for sonic-utilities show CLI command. |
| /cli/config-cli-plugin | list of strings | no | List of paths to plugins for sonic-utilities config CLI command. |
| /cli/clear-cli-plugin | list of strings | no | List of paths to plugins for sonic-utilities sonic-clear CLI command. |

### SONiC Processes and Docker Statistics Telemetry Support

Expand Down