Routing Configuration Guide for Cisco 8000 Series Routers, Cisco IOS XR Releases

PDF

Edit routing policy configuration elements

Want to summarize with AI?

Log in

Teaches you how to update RPL statements and set content by using the CLI or supported editors while controlling whether changes are committed or discarded.


Editing routing policy configuration elements is the process of changing RPL policy content that

  • treats policies as statement-based, where new lines act only as separators inside the begin-end policy structure

  • lets you add or delete route policy statements by using the CLI, and

  • lets you edit policy content between the begin-end brackets by using supported text editors such as Nano and Emacs.


Edit routing policy configuration elements using CLI

Add, delete, or discard route policy statements by using the CLI.

Procedure

1.

Enter the routing policy configuration mode for the policy or set you want to edit.

2.

Enter route policy statements to add content, or delete existing statements as needed.

3.

Complete the configuration block using one of these commands.

  • end-policy or end-set
  • exit
4.

To discard your changes, use the abort command to exit configuration mode without applying changes.

The system updates the policy or set when you complete the configuration block, or discards your changes when you use abort .


Edit routing policy configuration elements using Emacs editor

Edit your route policy in Emacs text editor and commit the changes from the editor.

Before you begin

Follow these steps to edit a routing policy by using Emacs editor:

Procedure

1.

In EXEC mode, enter edit route-policy <name> .

Example:

Router# edit route-policy policy_A

The system copies your route policy to a temporary file and launches the editor.

2.

In the editor, update your policy text as needed.

3.

After editing, save your changes and remain in the editor, or save your changes and exit the editor.

  • To save the changes and remain in the editor, press Ctrl-X , and then Ctrl-S .
  • To save the changes and exit the editor, press Ctrl-X , then Ctrl-C .
4.

If the system prompts Continue editing? [no]: because of parse errors, you can::

  • Enter yes to correct the text.
  • Enter no to end your session without changing the running configuration.

Example:

Edit and commit a policy with no parse errors
Router# edit route-policy policy_A

== MicroEMACS 3.8b () == rpl_edit.139281 ==
  if destination in (2001::/8) then
    drop
  endif
end-policy
!


== MicroEMACS 3.8b () == rpl_edit.139281 ==
Parsing.
83 bytes parsed in 1 sec (82)bytes/sec
Committing.
1 items committed in 1 sec (0)items/sec
Updating.
Updated Commit database in 1 sec

Example:

Handle parse errors
Router# edit route-policy policy_B
== MicroEMACS 3.8b () == rpl_edit.141738
route-policy policy_B
  set metric-type type_1
  if destination in (2001::/8) then
    drop
  endif
end-policy
!
== MicroEMACS 3.8b () == rpl_edit.141738 ==
Parsing.
105 bytes parsed in 1 sec (103)bytes/sec


% Syntax/Authorization errors in one or more commands.!! 
CONFIGURATION FAILED DUE TO SYNTAX/AUTHORIZATION ERRORS
  set metric-type type_1
  if destination in (2001::/8) then
    drop
  endif
end-policy
!


Continue editing? [no]:

If your policy has no parse errors, the system commits your updated policy. If you exit and do not continue after correcting parse errors, the system does not change the running configuration.


Edit routing policy configuration elements using Vim editor

Edit a routing policy by using the Vim editor.

Procedure

1.

Open the routing policy in Vim.

Example:

Router# edit route-policy test vim
2.

Edit the policy content as needed.

3.

When you complete changing the policy content, you can:

  • Save your changes and exit Vim by using :wq, :x, or ZZ.
  • Quit Vim editor by using :q. The system prompts whether to save the changed configuration.
  • Quit Vim without saving changes by using :q!.

The system uses the saved edits when you exit after saving. The system discards the edits when you quit without saving.

What to do next

For more information, see http://www.vim.org/.


Edit routing policy configuration elements using Nano editor

Edit a route policy in the Nano editor.

Procedure

1.

In EXEC mode, enter the edit route-policy <name> nano command.

Example:

Router# edit route-policy test nano

The system launches the Nano editor.

2.

In the Nano editor, edit the policy content as needed.

3.

Press Ctrl-X to save the file and exit the editor.

The system commits the saved changes to the route policy.

What to do next

For more information, see http://www.nano-editor.org/.

Note

The system does not support all Nano editor features.


Edit routing policy language set elements using XML

Before you begin

Follow these steps to edit set elements by using XML:

Procedure

1.

Open the XML representation for the set you want to update.

2.

Append entries to add items to the end of the set.

3.

Prepend entries to add items to the beginning of the set.

4.

Delete entries to remove items from the set.

5.

Commit the XML changes.

The existing set is updated with new or removed entries without replacing the entire set.