Skip to main content

 

 

Cisco Defense Orchestrator

Create a CLI Macro

About CLI Macros

CLI macros are templates of CLI commands. You turn parts of the command into parameters that you modify each time you run the command. 

For example, if you want to find a particular user on one of your ASAs, you could run this command:

show running-config | grep username

When you run the command, you would replace username with the username of the user you are searching for. To make a macro out of this command, use the same command and put curly braces around username.

cli_macro_show_run_user_example.png

You can name your parameters anything you want. You can also create the same macro with this parameter name:

cli_macro_show_run_user_example_long.png

The parameter name can be descriptive and must use alphanumeric characters and underlines. The command syntax, in this case the show running-config | grep part of the command, must use proper ASA CLI syntax.

Create a CLI Macro from a New Command

  1. Before you create a CLI macro, test the command in CDO's Command Line Interface to make sure the command syntax is correct and it returns reliable results. For information about ASA CLI syntax, see ASA Command Line Interface Documentation.
  2. In the Devices & Services page, select an online and synced ASA. 
  3. Click Command Line Interface cli_button.png.
  4. Click the CLI macro favorites star cli_star.png to see what macros already exist.
  5. Click the the plus button cli_create_plus.png.
  6. Give the macro a unique name. Provide a description and notes for the CLI macro if you wish.
  7. Enter the full command in the Command field. 
  8. Replace the parts of the command that you would want to modify, when you run the command, with a parameter name surrounded by curly braces.
  9. Click Create. The macro you create is available for use on all ASAs not just the one you initially specified.

To run the command see, Running CLI Macros on your ASAs.

Create a CLI Macro from CLI History or from an Existing CLI Macro

In this procedure, you are going to create a user-defined macro from a command you have already run, another user-defined macro, or from a system-defined macro. 

  1. In the Devices & Services page, select an online and synced ASA. 

Note: If you want to create a user-defined macro from CLI history, select the ASA on which you ran the command. CLI macros are shared across devices on the same account but not CLI history.

  1. Click Command Line Interface cli_button.png.
  2. Find the command you want to make a CLI macro from and select it. Use one of these methods:
  • Click the clock clock.png to view the commands you have run on that ASA. Select the one you want to turn into a macro and the command appears in the command pane.
  • Click the CLI macro favorites star cli_star.png to see what macros already exist. Select the user-defined or system-defined CLI macro you want to change. The command appears in the command pane.
  1. With the command in the command pane, click the CLI macro gold star cli_macro_gold_star.png. The command is now the basis for a new CLI macro.
  2. Give the macro a unique name. Provide a description and notes for the CLI macro if you wish.
  3. Review the command in the Command field and make the changes you want. 
  4. Replace the parts of the command that you would want to modify, when you run the command, with a parameter name surrounded by curly braces.
  5. Click Create. The macro you create is available for use on all ASAs not just the one you initially specified.

To run the command see, Running CLI Macros on your ASAs.

  • Was this article helpful?