SYSREPOCFG(1)

NAME
sysrepocfg - configuration tool for Sysrepo datastore

SYNOPSIS
sysrepocfg [--editor=EDITOR] [--datastore=DATASTORE] [--format=FORMAT] [--permanent] [--keep] [--level=NUM] MODULE
sysrepocfg --import[=FILE] [--datastore=DATASTORE] [--format=FORMAT] [--permanent] [--level=NUM] MODULE
sysrepocfg --export[=FILE] [--datastore=DATASTORE] [--format=FORMAT] [--level=NUM] MODULE
sysrepocfg --help
sysrepocfg --version

DESCRIPTION
sysrepocfg is a command-line tool for editing, importing and exporting configuration stored in Sysrepo datastore. It allows the user to edit startup or running configuration of specified module in preferred text editor and to propagate the perfomed changes into the datastore transparently for all subscribed applications. Moreover, the user can export the current configuration into a file or get it printed to the standard output and, similarly, an already prepared configuration can be imported from a file or read from the standard input.
In the background, sysrepocfg uses Sysrepo client library for any data manipulation rather than directly accessing configuration data files, thus effectively inheriting all main features of Sysrepo, such as YANG-based data validation, full transaction and concurrency support, and, perhaps most importantly, subscribed applications are notified about the changes made using sysrepocfg and can immediately take the new configuration into account.
The editing process itself consists internally of the following steps:

•   sysrepocfg connect to Sysrepo and starts a new session associated with the selected datastore.

•   sysrepocfg sends request to Sysrepo to get the full configuration of the selected module. The obtained data are then printed to a temporary file and presented to the user in his preferred text editor.

•   Once the editor is closed, sysrepocfg updates its view of the current datastore content and compares it against the user edited configuration. If no changes are detected, the program stops immediately, otherwise it proceeds with the data validation.

•   In case the edited configuration cannot be parsed or violates defined YANG-based constraints, all validation errors are printed to stderr and the user is asked for the next action: either to re-open the configuration in the text editor, or to copy the temporary file with the edited configuration to a user-selected path or to discard the changes altogether.

•   Once the new configuration is proven to be valid, sysrepocfg will attempt to propagate it to Sysrepo datastore one change at a time, but sends request to commit all modifications only after everything was applied successfully, thus conforming to ACID properties of database transactions.

OPTIONS

-h, --help
    Output a usage message and exit.

-v, --version
    Output the version number of sysrepocfg and exit.

-d DATASTORE, --datastore=DATASTORE
    Datastore to be operated on. Select either running or startup. If this option is ommited, running datastore is used.

-f FORMAT, --format=FORMAT
    Data format to be used for configuration editing/importing/exporting. Currently supported formats are xml and json. By default, xml is assumed.

-e EDITOR, --editor=EDITOR
    Text editor to be used for editing datastore data. By default, sysrepocfg will try to determine the preffered text editor based on the values of environment variables VISUAL and EDITOR in this order. When no editor is specified via argument or environment variables, sysrepocfg will print an error message and return an exit status indicating abnormal termination.

-i [FILE], --import[=FILE]
    Import entire configuration from a supplied file into the specified datastore. Specify format of the input file using the option --format. If the file path is empty or if the file “-” is given, sysrepocfg will read the configuration from standard input.

-x [FILE], --export[=FILE]
    Export data of a specified module and datastore to a file at the defined path. The output file is created if it does not exist yet, otherwise its previous content is overwritten. Specify format of the output file using the option --format. If the file path is empty or if the file “-” is given, sysrepocfg will print the configuration to the standard output.

-k, --keep
    Keep datastore of the selected module locked while it is being edited inside the text editor. Other users and applications will not be able to access the same module and datastore for the duration of editing, therefore use with caution.

-p, --permanent
    Make all changes made in the running datastore permanent by copying the new configuration to the startup datastore after the commit.

-l NUM, --level=NUM
    Set verbosity level of logging:

    0   all logging turned off

    1   (default) log only error messages

    2   log error and warning messages

    3   log error, warning and informational messages

    4   log everything, including development debug messages

EXAMPLE

•   Edit ietf-interfaces module's running config in xml format via default editor:
        sysrepocf ietf-interfaces

•   Edit ietf-interfaces module's running config in xml format via vim:
        sysrepocfg --editor=vim ietf-interfaces

•   Edit ietf-interfaces module's running config in xml format via vim and make changes permanent:
        sysrepocfg --editor=vim --permanent ietf-interfaces

•   Edit ietf-interfaces module's startup config in json format via default editor:
        sysrepocfg --format=json --datastore=startup ietf-interfaces

•   Export ietf-interfaces module's startup config in json format into /tmp/backup.json file:
        sysrepocfg --export=/tmp/backup.json --format=json --datastore=startup ietf-interfaces

•   Import ietf-interfaces module's running config content from /tmp/backup.json file in json format:
        sysrepocfg --import=/tmp/backup.json --format=json ietf-interfaces

SEE ALSO
sysrepoctl(1)
http://www.sysrepo.org (Sysrepo homepage)
https://github.com/sysrepo/sysrepo (the GitHub base for Sysrepo)

AUTHORS
Rastislav Szabo <raszabo@cisco.com>, Lukas Macko <lmacko@cisco.com>, Milan Lenco <milan.lenco@pantheon.tech>

COPYRIGHT
Copyright © 2016 Cisco Systems, Inc.