ON THIS PAGE
CLI Configlets Overview
CLI Configlets are configuration tools provided by Junos OS that enable you to easily apply a configuration to a device. CLI Configlets contain the Junos OS configuration as formatted ASCII text. Junos Space uses the NETCONF protocol to load and commit the configuration on to devices.
A CLI Configlet is a configuration template that is transformed into a CLI configuration string before being applied to a device. The dynamic elements (strings) in the configuration template are defined using template variables. These variables act as input to the process of transformation to construct a CLI configuration string. These variables can contain the interface name, device name, description text, or any such dynamic values. The value of these variables are obtained from the user or system or given by the context at the time of execution. Velocity templates (VTL) are used to define CLI Configlets.
You can access the CLI Configlets workspace by selecting CLI Configlets from the left pane. From the CLI Configlets workspace, you can perform the following tasks:
View the details and statistics of CLI Configlets in Junos Space Network Management Platform.
Create, modify, clone, or delete a CLI Configlet.
Apply a CLI Configlet to the devices or submit the configuration changes from a CLI Configlet to the change requests that are deployed using the Review/Deploy Configuration workflow from the Devices workspace. Configuration changes for CLI Configlets created for grouped execution are displayed as change requests for the devices to which the CLI Configlets are submitted.
Mark and unmark CLI Configlets as favorites.
Export CLI Configlets from Junos Space Platform.
Import CLI Configlets from a local computer in the XML format. Starting with Junos Space Network Management Platform Release 15.2R1, you can also import CLI Configlets from a local computer in the TAR (containing XML files) format and from an external Git repository. For more information about Git repository management on Junos Space Platform, see Git Repositories in Junos Space Overview.
You can also apply CLI Configlets to devices from the Devices workspace. It can be triggered from the actual elements for which the configuration has to be applied. The context of the element for which the CLI Configlet is being applied is called an execution context.
CLI Configlets are not supported on SSG Series devices, NetScreen Series devices, TCA Series devices, BXOS Series devices, and Junos Content Encore devices.
Configlet Variables
Variables in CLI Configlets include a leading “$”character. CLI Configlets use three kinds of variables: default, user-defined, and predefined.
Default Variables
The value of these variables need not be input by the user; these values are derived from the current execution context. Table 1 lists the default variables.
Variable |
Value |
---|---|
$DEVICE |
Name of the host on which the CLI Configlet is applied |
$INTERFACE |
Name of the interface for which the CLI Configlet is applied |
$UNIT |
Unit number of the logical interface for which the CLI Configlet is being applied |
$CONTEXT |
Context of the element for which the CLI Configlet is applied |
User-Defined Variables
The values for these variables are entered by the user at execution time. Text fields or selection fields are used to obtain data from the user.
Predefined Variables
These are the variables for which the values are predefined when you create the CLI Configlet. These variables are also called invisible parameters because they cannot be modified by the user.
Velocity Templates
Junos Space Network Management Platform enables you to define the device configuration in the form of velocity templates (VTL). These templates are called CLI Configlets. The VTL variable is a reference type, which includes the leading "$" character, followed by a VTL Identifier. CLI Configlets are transformed into a CLI configuration string before they are applied to the device. This transformation is directed by references and directives of VTL.
References are used to embed dynamic contents in the configuration text. Directives allow dynamic manipulation of the contents.
Refer to http://velocity.apache.org/engine/1.7/user-guide.html for detailed information about VTL.
Directives
Directives include an included CLI Configlet’s contents and parameters in the base CLI Configlet and import the metadata information related to the parameters of the included CLI Configlet. You can include CLI Configlets in Junos Space Network Management Platform by using two directives: #include_configlet and #mixin directives.
#include_configlet – This directive includes an included CLI Configlet’s contents and parameters in the base CLI Configlet and imports the metadata information related to the parameters of the included CLI Configlet. If you define a new parameter in the base CLI Configlet by using the #include_configlet directive, the metadata information is fetched and used from the included CLI Configlets. The parameter values updated in the included CLI Configlet after their inclusion into the base CLI Configlet are not updated and available for the base CLI Configlet. If both the base CLI Configlet and included CLI Configlet contain parameters with a common name, the metadata information related to the parameters is ignored.
#mixin – This directive differentiates the parameters of the base CLI Configlet from the parameters of the included CLI Configlet on the Junos Space user interface. The parameter values for the included CLI Configlets can be modified even when you apply the CLI Configlet to the device. You cannot include CLI Configlets that have a period (.) or space in its name.
You include these directives in the base CLI Configlet in the following format:
#include_configlet("<name of the included configlet>")
#mixin("<name of the included configlet>")
Change History Table
Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.