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

[sonic-cli-gen] first phase implementation of the SONiC CLI Auto-generation tool #1644

Merged
merged 83 commits into from
Nov 17, 2021

Commits on Apr 28, 2021

  1. Worked version

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Apr 28, 2021
    Configuration menu
    Copy the full SHA
    548896a View commit details
    Browse the repository at this point in the history
  2. added stub for function to determine static or dynamic YANG

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Apr 28, 2021
    Configuration menu
    Copy the full SHA
    3350f27 View commit details
    Browse the repository at this point in the history
  3. _find_index_of_yang_model()

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Apr 28, 2021
    Configuration menu
    Copy the full SHA
    1d1643a View commit details
    Browse the repository at this point in the history
  4. added function to init list's for module, top, tables

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Apr 28, 2021
    Configuration menu
    Copy the full SHA
    cd31f0d View commit details
    Browse the repository at this point in the history
  5. Added func to determine - static or list, +comments

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Apr 28, 2021
    Configuration menu
    Copy the full SHA
    81b803d View commit details
    Browse the repository at this point in the history
  6. Added auto compleation file

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Apr 28, 2021
    Configuration menu
    Copy the full SHA
    ecdf8b6 View commit details
    Browse the repository at this point in the history
  7. Add CLI Jinja templates

    Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
    stepanblyschak committed Apr 28, 2021
    Configuration menu
    Copy the full SHA
    42779c7 View commit details
    Browse the repository at this point in the history
  8. Fix the generated function name is incorrect

    Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
    stepanblyschak committed Apr 28, 2021
    Configuration menu
    Copy the full SHA
    12bf0b2 View commit details
    Browse the repository at this point in the history

Commits on Apr 29, 2021

  1. update and enhance templates with multiple lists in container

    Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
    stepanblyschak committed Apr 29, 2021
    Configuration menu
    Copy the full SHA
    c8eaa66 View commit details
    Browse the repository at this point in the history
  2. fix cli templates

    Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
    stepanblyschak committed Apr 29, 2021
    Configuration menu
    Copy the full SHA
    dd29e33 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0b0a0c1 View commit details
    Browse the repository at this point in the history

Commits on Apr 30, 2021

  1. add clear list command

    Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
    stepanblyschak committed Apr 30, 2021
    Configuration menu
    Copy the full SHA
    16857c4 View commit details
    Browse the repository at this point in the history
  2. Parsing for static YANG models - sonic-flex_counter.yang, sonic-devic…

    …e_metadata.yang DONE
    
    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Apr 30, 2021
    Configuration menu
    Copy the full SHA
    dfa3ccc View commit details
    Browse the repository at this point in the history

Commits on May 6, 2021

  1. Done refactoring for parsing 'static' YANG models

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 6, 2021
    Configuration menu
    Copy the full SHA
    6b75f4b View commit details
    Browse the repository at this point in the history

Commits on May 11, 2021

  1. Added parsing for 'dynamic' YANG models, done refactoring of whole code

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 11, 2021
    Configuration menu
    Copy the full SHA
    d2be52b View commit details
    Browse the repository at this point in the history

Commits on May 12, 2021

  1. Done parser for 'grouping' BUT need to deeply test it, added function…

    …s - get_leafs(), get_leaf_lists(), get_choices(), get_uses_grouping()
    
    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 12, 2021
    Configuration menu
    Copy the full SHA
    73a3b12 View commit details
    Browse the repository at this point in the history
  2. align with implementation

    Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>
    Stepan Blyschak committed May 12, 2021
    Configuration menu
    Copy the full SHA
    718f8ab View commit details
    Browse the repository at this point in the history
  3. Merge branch 'sonic-cli-gen' of github.com:vadymhlushko-mlnx/sonic-ut…

    …ilities into sonic-cli-gen
    Stepan Blyschak committed May 12, 2021
    Configuration menu
    Copy the full SHA
    647537c View commit details
    Browse the repository at this point in the history
  4. generate cli from templates

    Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>
    Stepan Blyschak committed May 12, 2021
    Configuration menu
    Copy the full SHA
    fa6299c View commit details
    Browse the repository at this point in the history
  5. Table can only have 'static-objects' OR 'dynamic-objects'

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 12, 2021
    Configuration menu
    Copy the full SHA
    9d9f66b View commit details
    Browse the repository at this point in the history
  6. add missing " in help for option

    Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>
    Stepan Blyschak committed May 12, 2021
    Configuration menu
    Copy the full SHA
    38f4365 View commit details
    Browse the repository at this point in the history
  7. Merge branch 'sonic-cli-gen' of github.com:vadymhlushko-mlnx/sonic-ut…

    …ilities into sonic-cli-gen
    Stepan Blyschak committed May 12, 2021
    Configuration menu
    Copy the full SHA
    591aced View commit details
    Browse the repository at this point in the history
  8. Added remove_keys(), get_mandatory()

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 12, 2021
    Configuration menu
    Copy the full SHA
    0826ac5 View commit details
    Browse the repository at this point in the history
  9. fix issues

    Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>
    Stepan Blyschak committed May 12, 2021
    Configuration menu
    Copy the full SHA
    069000f View commit details
    Browse the repository at this point in the history
  10. Merge branch 'sonic-cli-gen' of github.com:vadymhlushko-mlnx/sonic-ut…

    …ilities into sonic-cli-gen
    Stepan Blyschak committed May 12, 2021
    Configuration menu
    Copy the full SHA
    594acce View commit details
    Browse the repository at this point in the history

Commits on May 13, 2021

  1. Refactored generator.py: generate_cli_plugin(), get_cli_plugin_path()

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 13, 2021
    Configuration menu
    Copy the full SHA
    1723f0f View commit details
    Browse the repository at this point in the history
  2. Removed arguments from constructor of class CliGenerator, added funct…

    …ion comments
    
    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 13, 2021
    Configuration menu
    Copy the full SHA
    0a78e19 View commit details
    Browse the repository at this point in the history

Commits on May 14, 2021

  1. Added sceleton for UT, added additional check for yang_parser.py, cha…

    …nged constructor for YangParser
    
    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 14, 2021
    Configuration menu
    Copy the full SHA
    30d2cb9 View commit details
    Browse the repository at this point in the history
  2. Refactored _init_yang_module_and_containers()

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 14, 2021
    Configuration menu
    Copy the full SHA
    0d371de View commit details
    Browse the repository at this point in the history
  3. added 2 test cases

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 14, 2021
    Configuration menu
    Copy the full SHA
    1593039 View commit details
    Browse the repository at this point in the history

Commits on May 17, 2021

  1. [sonic-cli-gen] put autogenerated plugins into plugins.auto

    Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
    stepanblyschak committed May 17, 2021
    Configuration menu
    Copy the full SHA
    9004c1c View commit details
    Browse the repository at this point in the history
  2. [sonic-cli-gen] fix show.py.j2 template

    Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
    stepanblyschak committed May 17, 2021
    Configuration menu
    Copy the full SHA
    32e27a2 View commit details
    Browse the repository at this point in the history
  3. [sonic-cli-gen] add remove plugin method

    Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
    stepanblyschak committed May 17, 2021
    Configuration menu
    Copy the full SHA
    02e6d27 View commit details
    Browse the repository at this point in the history
  4. refactored past test cases, added new

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 17, 2021
    Configuration menu
    Copy the full SHA
    cb7fa06 View commit details
    Browse the repository at this point in the history
  5. added test_dynamic_object_complex

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 17, 2021
    Configuration menu
    Copy the full SHA
    5737f5f View commit details
    Browse the repository at this point in the history

Commits on May 18, 2021

  1. [sonic-cli-gen] implement grouping in show template

    Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
    stepanblyschak committed May 18, 2021
    Configuration menu
    Copy the full SHA
    7b167a6 View commit details
    Browse the repository at this point in the history
  2. Reworked 'grouping' parser

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 18, 2021
    Configuration menu
    Copy the full SHA
    16e0cca View commit details
    Browse the repository at this point in the history
  3. Added 'group' to 'attrs'

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 18, 2021
    Configuration menu
    Copy the full SHA
    b0fb3a9 View commit details
    Browse the repository at this point in the history

Commits on May 19, 2021

  1. Fixed 'grouping' parsing

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 19, 2021
    Configuration menu
    Copy the full SHA
    e2acf73 View commit details
    Browse the repository at this point in the history
  2. DONE. ALL UT PASSED

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 19, 2021
    Configuration menu
    Copy the full SHA
    3305faa View commit details
    Browse the repository at this point in the history
  3. Refactored UT

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 19, 2021
    Configuration menu
    Copy the full SHA
    30e8ac9 View commit details
    Browse the repository at this point in the history
  4. Added docstrings, fixed names of variables

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 19, 2021
    Configuration menu
    Copy the full SHA
    15aeb8c View commit details
    Browse the repository at this point in the history
  5. Added test_grouping_complex to the execution pipeline

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 19, 2021
    Configuration menu
    Copy the full SHA
    ea2c838 View commit details
    Browse the repository at this point in the history

Commits on May 20, 2021

  1. Configuration menu
    Copy the full SHA
    f7a7ed2 View commit details
    Browse the repository at this point in the history
  2. Removed unused test YANG model

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 20, 2021
    Configuration menu
    Copy the full SHA
    e18c888 View commit details
    Browse the repository at this point in the history

Commits on May 21, 2021

  1. Fixed indentation

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 21, 2021
    Configuration menu
    Copy the full SHA
    7bd3ec9 View commit details
    Browse the repository at this point in the history
  2. Added sonic-cli-gen remove cmd, reworked private initializer functions

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 21, 2021
    Configuration menu
    Copy the full SHA
    d5dea7f View commit details
    Browse the repository at this point in the history

Commits on May 24, 2021

  1. Added new lines, fixed some docstrings

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 24, 2021
    Configuration menu
    Copy the full SHA
    aa4af1c View commit details
    Browse the repository at this point in the history
  2. removed type from docstring

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 24, 2021
    Configuration menu
    Copy the full SHA
    718a431 View commit details
    Browse the repository at this point in the history
  3. Added list_handler()

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 24, 2021
    Configuration menu
    Copy the full SHA
    2907523 View commit details
    Browse the repository at this point in the history
  4. [sonic-cli-gen] address review comments

    Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
    stepanblyschak committed May 24, 2021
    Configuration menu
    Copy the full SHA
    a005d6d View commit details
    Browse the repository at this point in the history
  5. [sonic-cli-gen] fix review comments

    Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
    stepanblyschak committed May 24, 2021
    Configuration menu
    Copy the full SHA
    aa00b61 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    fd931ad View commit details
    Browse the repository at this point in the history
  7. Fixed comments, added list_handler() where needed

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 24, 2021
    Configuration menu
    Copy the full SHA
    5c4e219 View commit details
    Browse the repository at this point in the history
  8. Added logger to CliGenerator class constructor

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 24, 2021
    Configuration menu
    Copy the full SHA
    6de672c View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    2a2f9f2 View commit details
    Browse the repository at this point in the history

Commits on May 25, 2021

  1. pep8 for generator.py

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 25, 2021
    Configuration menu
    Copy the full SHA
    1584fe3 View commit details
    Browse the repository at this point in the history
  2. pep8 for the rest of files

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 25, 2021
    Configuration menu
    Copy the full SHA
    8f27d03 View commit details
    Browse the repository at this point in the history
  3. pep8 for tests files, added comments to YANG models

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 25, 2021
    Configuration menu
    Copy the full SHA
    aa6f806 View commit details
    Browse the repository at this point in the history
  4. Added handler for 1 'choice' 'case'

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 25, 2021
    Configuration menu
    Copy the full SHA
    83ce9ee View commit details
    Browse the repository at this point in the history
  5. Code style

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 25, 2021
    Configuration menu
    Copy the full SHA
    702be74 View commit details
    Browse the repository at this point in the history

Commits on May 26, 2021

  1. Fixed review comments

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed May 26, 2021
    Configuration menu
    Copy the full SHA
    c433a4c View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2021

  1. Changed tabs to spaces

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Aug 30, 2021
    Configuration menu
    Copy the full SHA
    94cde8e View commit details
    Browse the repository at this point in the history

Commits on Aug 31, 2021

  1. Removed unnecessary config_db.json file

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Aug 31, 2021
    Configuration menu
    Copy the full SHA
    5fec4a7 View commit details
    Browse the repository at this point in the history

Commits on Sep 7, 2021

  1. Added test case, added support for UT for sonic-cli-gen implementation

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    3cd8ad9 View commit details
    Browse the repository at this point in the history
  2. Added registering of plugins to UT

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    607b254 View commit details
    Browse the repository at this point in the history
  3. Fixed name

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    6816903 View commit details
    Browse the repository at this point in the history

Commits on Sep 8, 2021

  1. Added helper.load_and_register_plugins()

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Sep 8, 2021
    Configuration menu
    Copy the full SHA
    2aee883 View commit details
    Browse the repository at this point in the history

Commits on Sep 9, 2021

  1. Added test cases for sonic-device_metadata

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Sep 9, 2021
    Configuration menu
    Copy the full SHA
    9fea6db View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2021

  1. Added cli_autogen_common.py, added separate dir for each cli_autogen …

    …test
    
    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Sep 10, 2021
    Configuration menu
    Copy the full SHA
    69926ed View commit details
    Browse the repository at this point in the history
  2. Added backup and restore func for yang models

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Sep 10, 2021
    Configuration menu
    Copy the full SHA
    dd7ec5e View commit details
    Browse the repository at this point in the history
  3. Removed if-else UT login from generator.py

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Sep 10, 2021
    Configuration menu
    Copy the full SHA
    eb85200 View commit details
    Browse the repository at this point in the history

Commits on Sep 13, 2021

  1. Added couple UT for device-neighbor

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Sep 13, 2021
    Configuration menu
    Copy the full SHA
    5ccefa6 View commit details
    Browse the repository at this point in the history

Commits on Sep 14, 2021

  1. Added UT for update flow

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    37ac0b7 View commit details
    Browse the repository at this point in the history
  2. Fixed codestyle

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    4402203 View commit details
    Browse the repository at this point in the history
  3. Fixed codestyle

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    9d07092 View commit details
    Browse the repository at this point in the history
  4. Fixed test path variables

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    5b6a8aa View commit details
    Browse the repository at this point in the history

Commits on Oct 21, 2021

  1. [sonic-cli-gen] add docstrings

    Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
    stepanblyschak committed Oct 21, 2021
    Configuration menu
    Copy the full SHA
    df1d329 View commit details
    Browse the repository at this point in the history

Commits on Nov 1, 2021

  1. use dict.pop() with default value

    Signed-off-by: Stepan Blyshchak <stepanb@nvidia.com>
    stepanblyschak committed Nov 1, 2021
    Configuration menu
    Copy the full SHA
    9e1854f View commit details
    Browse the repository at this point in the history
  2. if no data ion update_entry_validated() abort

    Signed-off-by: Stepan Blyshchak <stepanb@nvidia.com>
    stepanblyschak committed Nov 1, 2021
    Configuration menu
    Copy the full SHA
    f2677a1 View commit details
    Browse the repository at this point in the history

Commits on Nov 2, 2021

  1. if entry config did not change avoid calling set_entry()

    Signed-off-by: Stepan Blyshchak <stepanb@nvidia.com>
    stepanblyschak committed Nov 2, 2021
    Configuration menu
    Copy the full SHA
    4e0ac3e View commit details
    Browse the repository at this point in the history

Commits on Nov 4, 2021

  1. pass a copy of cfg to FormatConverter.to_serialized() as it modifies …

    …original cfg
    
    Signed-off-by: Stepan Blyshchak <stepanb@nvidia.com>
    stepanblyschak committed Nov 4, 2021
    Configuration menu
    Copy the full SHA
    6a7d7fa View commit details
    Browse the repository at this point in the history

Commits on Nov 16, 2021

  1. Added exception handling for j2 templates

    Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
    vadymhlushko-mlnx committed Nov 16, 2021
    Configuration menu
    Copy the full SHA
    afc4afb View commit details
    Browse the repository at this point in the history