Customize your network management client to your specifications
yp-client allows you to create your own network management applications and tools and customize them to suit your network and devices. yp-client has the following features:
- C++ YANG client library
- NETCONF and RESTCONF client support
- Provides session classes to create, save and load session information
- Support for multiple sessions to multiple servers at once
- Provides device classes to create, save, and load device information
- Provides a user class to create, save, and load user information
- Includes a C wrapper to enable application creation with other languages
- Robust handling of errors
- Session notification monitoring
- Convenience functions that allow sending the server a request, capturing and displaying the response, and dealing with any errors
- Utilizes the proven yangcli-pro client libraries
For more information, check out the yp-client user manual.
Powered by YANG
All CLI Commands are Data-Driven
- All local commands are derived from YANG rpc statements found in yangcli-pro.yang. These are converted from YANG and used directly by the command interpreter.
- All remote commands are derived from the YANG rpc statements in the YANG modules advertised by the NETCONF server. These are converted to
messages sent to the NETCONF server for processing. - All command processing is automated, so no special configuration is needed to use any NETCONF operation on any NETCONF server that supports YANG.
YANG on the fly
The ‘Correct’ YANG Objects For Each Session
- When a NETCONF session is started, both the client and the server send a
message. The client uses this message to determine the exact set of YANG modules supported by the server. - The YANG features (representing optional features) are applied so unsupported objects are removed from the session.
- The YANG deviations (representing platform-specific differences in particular YANG objects) are also applied as patches to the YANG modules used for the session. This allows the yangcli-pro program to automatically customize the CLI for each NETCONF session.
- The YANG annotations (extension statements) allow the CLI engine to handle special program behavior than cannot be expressed in standard YANG statements.
- If the yangcli-pro program cannot find a YANG module advertised by the server in its YANG library, it will try to get it from the server. If a server (such as netconfd-pro) supports the
operation, then the module will be retrieved and used for the session.
Complete CLI
Easy To Use Command Line Interface
Each user has their own CLI interface environment, allowing the yangcli-pro program to be customized and utilized independently.
- The command line history feature allows commands to be saved across sessions and used each time the yangcli-proprogram is run
- The aliases file allows customized commands to be created by the user, and these aliases can be saved across sessions and used each time the yangcli-pro program is run
- The uservars file allows global user variables to be saved across sessions and used each time the yangcli-pro program is run
- The YANG definitions for each command are used to provide several forms of command help, including context-sensitive help during database editing. The ? (question mark) character can be used to get help for the current expected parameter or possible parameter completions
- The YANG definitions for each command are used to extensive command validation, which automatically checks parameter syntax and missing mandatory parameters, for both local and remote commands
- There are several command recall features, allowing previous commands to be edited and reused. The recall command and !(bang) character are used to search backwards through the command history. The command editing keys (up and down) are used to scroll through the command history
- The command completion feature simplifies typing and provides context-sensitive scoping of parameters. The tab character can be used to get a list of possible command, command parameter, or command parameter value completion strings. The YANG object definitions, current context, and current command line position are used to determine the best possible set of completions
Config mode
Simplified Database Editing
- YANG data node names become the command keywords
- Containers start new CLI sub-modes
- Lists start new CLI sub-modes, using the required key leafs to select a specific entry
- Leafs can be entered 1 at a time within a sub-mode or all together on 1 line
Session Management
Simplified NETCONF Server Management
- The named sessions are saved in the sessions configuration file with the session-cfg command. Named session configurations can be recalled for easy reuse. The session name is also used to switch between sessions when many are active at once.
- The capability manager analyzes the
list from the NETCONF server message and adjusts the remote operations accordingly. The server target database (candidate or running) is determined from these capabilities as well. - The get-locks, release-locks and save commands can be used to simplify NETCONF operation regardless of server profile. The session manager adjusts these procedures based on the databases supported by the NETCONF server.
- The
handler processes the replies from the NETCONF server and dispatches it to the appropriate sub-systems for inspection and further processing. - The config shadow feature allows the CLI command interpreter to customize the command completion and other behavior, based on the contents of the
configuration for the NETCONF server. - The notification handler automatically starts monitoring notifications from the NETCONF server if supported. Standard events such as netconf-config-change can be monitored to help keep the session state up to date.
- The NETCONF converter automatically converts CLI commands to the most appropriate NETCONF operations for the session. For example, the ‘remove’ operation attribute value is used only if the server supports it. The protocol version (base:1.0 or base:1.1) and other capabilities are used to automatically construct the best message to use for each server.
Variables and Scripts
User Variables and Scripts Help Automate NM Tasks
- Simple script files can be saved and edited with any text editor. Comments and multi-line commands are supported, and any local or remote commands (including running other scripts) are allowed. The script search path can be controlled independently for each user. Scripts can be passed up to 10 parameters (P1 to P10) and each script can have its own local variables.
- Powerful user variables allow simple or complex YANG data structures to be saved for reuse. Variables can be set to simple values or the data returned from a NETCONF
message. - The system variables are derived from environment variables and CLI parameters. They allow users to inspect all parameter values and change CLI settings at runtime.
- The runstack manager maintains command and variable contexts for the scripts running within the current session. It allows scripts to be called from the currently running script. Recursion is allowed if called from within a conditional statement.
- The XPath processor allows simple or complex XPath expressions to be used to control ‘while’ loops and ‘if’ statements. Variables can also be assigned the result of an XPath expression. All system and user variables are visible within the XPath interpreter, along with all standard and some custom XPath functions.
- The loop manager keeps track of interactive or script loop contexts and automatically records and replays the enclosed commands until the loop exit condition is met.
- The conditional manager processes conditional command blocks entered with the if, elif, and else commands. These commands can be nested and conditions are specified with XPath expressions.
Test Suites
Automated NETCONF Regression Testing
- Reusable test template files can be saved and edited with any text editor. They can also be saved automatically with the record-test command.
- The record-test handler allows regression tests to be recorded interactively. Test recordings can be saved, paused, resumed, or canceled. Each test suite can have multiple tests and each test can have multiple steps.
- The run-test handler is used to run the test-suite command using data from recorded tests and the tests file. It saves and reports results. Test pre-requisites can be specified, allowing some tests to be skipped unless the dependency tests have been run and passed.
- The setup and cleanup features allow CLI command blocks to be used to automatically initialize a test suite when it is started and cleanup when it terminates for any reason.
- The response handler analyzes local command results or
contents from remote commands and determines if the correct response has been received. Either ok, data, or error responses can be checked, based on the test template. Data can be saved with record-test and compared against responses received during a test. Specific error-tag and error-app-tagvalues can be checked for negative test cases.
yangcli-pro Features
NETCONF Sessions
- Concurrent Sessions
Multiple NETCONF sessions can be active at once, allowing interactive, user script, and test suite access to multiple servers at once. - Named Saved Sessions
Session configuration can be saved as named sessions. These saved sessions can be loaded manually or automatically, greatly simplifying the connect command. - YANG-Driven Command Interpreter
Any YANG module can be loaded into yangcli-pro and used right away. All rpc statements are automatically available as commands. All data statements are automatically available as database content or monitoring data.
Automation
- Compile YANG Modules on the Fly
When a NETCONF session is started, the serverstatements can be used to compile the YANG modules exactly as that server is using them, so yangcli-pro can tailor the user interface independently for each session. - Configuration Shadowing
When a NETCONF session is started, a copy of the server’s running configuration can be automatically cached for CLI tab completion and other operations. - Notification Monitoring
When a NETCONF session is started, notification monitoring can be started automatically. Various notifications are monitored, such as configuration change events to force shadow configuration caches to be properly updated. - Lock Handling
The high-level get-locks and release-locks commands allow all configuration locks for a NETCONF session to be managed automatically.
Programmability
- Aliases
Unix-style command aliases allow user command short-cuts to be defined to save typing. - Data Variables
Powerful system variables can be used to change CLI parameters at run-time and user variables can be used to save almost any kind of data for reuse in commands, scripts, and tests. - File Variables
Data can be read and stored in XML or text files instead of data variables, allowing off-line tools to generate data for tests. - Scripts
Commands can be stored in text files and run automatically as scripts. Parameters can be passed to scripts. Scripts can call other scripts. Aliases, data variables and file variables can be used. - XPath based conditional statements
The if and while commands use XPath to allow customized conditional commands to be programmed into scripts. All data variables are available as XPath variables in these expressions.
Regression Testing
- Test suites
The test-suite feature allows text test-suite configuration files to be used to control automated server regression testing. A test suite contains 0 or more tests with 0 or more steps. Test dependencies can be defined to prune tests that cannot be run on the test server. - Negative Testing
If a test step send an operation to a NETCONF server, any type of reply can be expected, including. Specific error fields can also be checked. - Data Testing
If a test step send an operation to a NETCONF server, a data reply can be expected. These data replies can be checked against a saved control response. - Multiple Sessions
Tests can contain command for multiple sessions to test locking scenarios, editing collisions, etc. - Test Reporting
Formatted test results can be generated and saved to a special log file.
Command Line Interface
- YANG-based Help
The help command provides context-sensitive, user-friendly help text derived directly from YANG modules. - Smart Tab Completion
Pressing the tab key during interactive command line editing will cause a context-sensitive list of word completions to be displayed. List key values are fetched from the shadow configuration if available. Variable names and many other new tab completion features are supported. - Order Independent Parameters
Command and data parameters can be entered in any order. However, YANG lists and leaf-lists that are ordered-by usershould be entered in the desired order. - Automatic Parameter Checking
Commands and data that are entered in interactive mode will be checked for any missing mandatory parameters. If so, the user will be prompted to fill in any missing parameter values, 1 at a time. - Command Validation
Any conditional YANG constructs like if-feature or when statements are automatically checked when a command is invoked so unsupported fields are not shown to the user.
New Commands
- config
Enter new configuration mode similar to router CLI interfaces, allowing configuration data to be edited directly. - exit
Exit configuration mode. - record-test
Manage automatic recording of regression tests for replay with the test-suite command. - session
Change the current session when multiple concurrent sessions are active. - session-cfg
Manage the specified named session configuration. - sessions-cfg
Manage the named session configuration files. - start-rpc-timing
Start simplified recording of RPC timing statistics. - start-session
Start a named session. - stop-rpc-timing
Stop simplified recording of RPC timing statistics and save the data in a gnuplot compatible file. - stop-session
Gracefully terminate a named session. - test-suite
Manage the regression test suite feature. - update-config
Update the shadow configuration for the current session.