Contents

Introduction

Prerequisites

Requirements

Components Used

Configure

Single Command Example

Deletion of User from the Device

Multiple Commands Example

Crypto Key Generation on Switch

Troubleshoot

Introduction

This document describes how to create user defined CLI templates with single line and multiple line commands.

Prerequisites

Requirements

Cisco recommends that you have knowledge of these topics:

- Prime Infrastructure (PI)

- Template Features

- CLI Commands

Components Used

The information in this document is based on these software and hardware versions:

- PI 3.2.

The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, make sure that you understand the potential impact of any command.

Configure

Single Command Example

Deletion of User from the Device

- To create a user name in the device.

Note: In this example, username inniti will be deleted.

- Go to Configuration > Features & Technologies > My Templates > CLI Templates

Create a template with multi-command:

Example from User Guide

Adding Multi-line Commands

To enter multi-line commands in the CLI Content area, use the this syntax:

<MLTCMD>First Line of Multiline Command

Second Line of Multiline Command

......

......

Last Line of Multiline Command</MLTCMD>

Image 2

<MLTCMD>

no username inniti

y

</MLTCMD>

- Deploy the template.

Note: Select the device and re-check the template accordingly.

- Once you deploy, a Job that corresponds will run in the Background and you can check its status when you click on Job Status as shown:

Verify

- Check the Status in PI as well as in Device:

On PI:

On Device:

Username inniti is deleted.

Go to Configuration >  Features & Technologies > My Templates > CLI Templates

- Create one Template with Interactive Commands

Example from user guide

Adding Interactive Commands

An interactive command contains the input that must be entered following the execution of a command.

To enter an interactive command in the CLI Content area, use the following syntax:

CLI Command<IQ>interactive question 1<R>command response 1 <IQ>interactive question 2<R>command response 2

where <IQ> and <R> tag are case-sensitive and must be entered as uppercase

In the example:

#INTERACTIVE

no username inniti<IQ>confirm<R>y

#ENDS_INTERACTIVE

- Deploy the template.

Verify

- Check the status in PI as well as Device:

Note: For Interactive commands, it is observed that in few examples 'Interactive Question' when copied completely does not run properly. In such a case, you just need to type the last word. For example, when you keep complete sentence it will fail. #INTERACTIVE no username inniti <IQ>This operation will remove all username related configurations with same name. Do you want to continue? [confirm]<R>Y #ENDS_INTERACTIVE.

Multiple Commands Example

Crypto Key Generation on Switch

- How the command looks on device when ran:

BGL14-1.S.04-2900-1(config)#crypto key generate rsa

% You already have RSA keys defined named BGL14-1.S.04-2900-1.cisco.

% Do you really want to replace them? [yes/no]: yes

Choose the size of the key modulus in the range of 360 to 4096 for your

General Purpose Keys. Choosing a key modulus greater than 512 may take

a few minutes.

How many bits in the modulus [512]: 512

% Generating 512 bit RSA keys, keys will be non-exportable...

[OK] (elapsed time was 1 seconds)

- Use of Multi-Commands:

<MLTCMD>

crypto key generate rsa

yes

2048

</MLTCMD>

- Deploy the template.

Verify

- Final status in PI and on device:

- Use of Interactive Command:

#INTERACTIVE

crypto key generate rsa<IQ>yes/no<R>yes<IQ>512<R>2048

#ENDS_INTERACTIVE

- Deploy template.

Verify

- Final status in PI:

Troubleshoot

There is currently no specific troubleshooting information available for this configuration.