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

Exposing config-check logic to CLI #291

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Jul 31, 2018

  1. Exposing config-check logic to CLI

    I'm simply extending the new config verification logic to our current CLI commands so that a config-check is implicitly done whenever user executes 'config load/reload' commands. See some examples below...
    
    As part of this PR i'm also adding a new CLI command to allow users to explicitly validate their json-file configuration.
    
    <-- Running 'config load' with invalid configuration:
    
        admin@lnos-x1-a-csw02:~$ sudo config load ~/config_db.json
        Reload all config? [y/N]: y
        Running command: sonic-cfggen -j /home/admin/config_db.json --check-json
        DEVICE_NEIGHBOR port Ethernet5 not found in PORT table.
    
        Invalid configuration detected. No configuration changes processed. Exiting...
    
    <-- Running 'config reload' with invalid configuration:
    
        admin@lnos-x1-a-csw02:~$ sudo config reload ~/config_db.json
        Clear current and reload all config? [y/N]: y
        Running command: sonic-cfggen -j /home/admin/config_db.json --check-json
        DEVICE_NEIGHBOR port Ethernet5 not found in PORT table.
    
        Invalid configuration detected. No configuration changes processed. Exiting...
    
    <-- Running 'config check' with invalid configuration:
    
        admin@lnos-x1-a-csw02:~$ sudo config check ~/config_db.json
        Running command: sonic-cfggen -j /home/admin/config_db.json --check-json
        DEVICE_NEIGHBOR port Ethernet5 not found in PORT table.
    
        Invalid configuration detected. No configuration changes processed. Exiting...
    
    <-- Running 'config check' with valid configuration:
    
        admin@lnos-x1-a-csw02:~$ sudo config check /etc/sonic/config_db.json
        Running command: sonic-cfggen -j /etc/sonic/config_db.json --check-json
        Valid configuration found in /etc/sonic/config_db.json file
    
    Signed-off-by: Rodny Molina <rmolina@linkedin.com>
    Rodny Molina committed Jul 31, 2018
    Configuration menu
    Copy the full SHA
    d92afa1 View commit details
    Browse the repository at this point in the history