ON THIS PAGE
CLI Configlets Overview
CLI Configlets are configuration tools provided by Junos OS that enables you to apply a configuration to a device by reducing configuration complexity. CLI Configlets contain the Junos OS configuration as a formatted ASCII text. Junos Space uses the NETCONF protocol to load and commit the configuration on 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 configuration templates are defined using template variables. These variables act as an input to the process of transformation to construct the 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 the 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:
Viewing the statistics of CLI Configlets in Junos Space Network Management Platform
Creating, modifying, cloning, applying, or deleting a CLI Configlet
Marking and unmarking CLI Configlets as favorites
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.
Variables in CLI Configlets include a leading “$”. CLI Configlets use three kinds of variables: default, user-defined, and predefined.
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.
Table 1: Default Variables
Name of the host on which the CLI Configlet is applied
Name of the interface for which the CLI Configlet is applied
Unit number of the logical interface for which the CLI Configlet is being applied
Context of the element for which the CLI Configlet is applied
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.
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.
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/releases/velocity-1.4/user-guide.html for detailed information about VTL.
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 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>”)