Skip to main content

Route Prefix List

Route prefix lists filter routes based on IP prefixes with optional length matching, used with BGP and OSPF route maps. The scm CLI provides commands to create, update, delete, and load route prefix lists.

Overview​

The route-prefix-list commands allow you to:

  • Create route prefix lists with prefix matching and length constraints
  • Update existing route prefix list configurations
  • Delete route prefix lists that are no longer needed
  • Bulk import route prefix lists from YAML files
  • Export route prefix lists for backup or migration

Set Route Prefix List​

Create or update a route prefix list.

Syntax​

scm set network route-prefix-list NAME [OPTIONS]

Arguments​

ArgumentDescriptionRequired
NAMEName of the route prefix listYes

Options​

OptionDescriptionRequired
--folder TEXTFolder locationYes*
--snippet TEXTSnippet locationYes*
--device TEXTDevice locationYes*
--description TEXTDescriptionNo
--ipv4-json TEXTIPv4 prefix list config as JSONNo

* Exactly one of --folder, --snippet, or --device is required.

Examples​

Create a Prefix List with Length Matching​

$ scm set network route-prefix-list my-prefix-list \
--folder Texas \
--ipv4-json '[{"name": "rule1", "prefix": "10.0.0.0/8", "action": "permit", "ge": 16, "le": 24}]'
---> 100%
Created route prefix list: my-prefix-list in folder Texas

Create a Simple Prefix List​

$ scm set network route-prefix-list default-only \
--folder Texas \
--ipv4-json '[{"name": "rule1", "prefix": "0.0.0.0/0", "action": "permit"}]'
---> 100%
Created route prefix list: default-only in folder Texas

Delete Route Prefix List​

Delete a route prefix list from SCM.

Syntax​

scm delete network route-prefix-list NAME [OPTIONS]

Arguments​

ArgumentDescriptionRequired
NAMEName of the route prefix list to deleteYes

Options​

OptionDescriptionRequired
--folder TEXTFolder locationYes*
--snippet TEXTSnippet locationYes*
--device TEXTDevice locationYes*
--forceSkip confirmation promptNo

* Exactly one of --folder, --snippet, or --device is required.

Example​

$ scm delete network route-prefix-list my-prefix-list --folder Texas --force
---> 100%
Deleted route prefix list: my-prefix-list from folder Texas

Load Route Prefix List​

Load multiple route prefix lists from a YAML file.

Syntax​

scm load network route-prefix-list [OPTIONS]

Options​

OptionDescriptionRequired
--file TEXTPath to YAML fileYes
--folder TEXTOverride folder location for all objectsNo
--snippet TEXTOverride snippet location for all objectsNo
--device TEXTOverride device location for all objectsNo
--dry-runPreview changes without applyingNo

YAML File Format​

---
route_prefix_lists:
- name: internal-prefixes
folder: Texas
ipv4:
- name: "rule1"
prefix: "10.0.0.0/8"
action: permit
ge: 16
le: 24

- name: default-route
folder: Texas
ipv4:
- name: "rule1"
prefix: "0.0.0.0/0"
action: permit

Examples​

Load with Original Locations​

$ scm load network route-prefix-list --file prefix-lists.yml
---> 100%
✓ Loaded route prefix list: internal-prefixes
✓ Loaded route prefix list: default-route

Successfully loaded 2 out of 2 route prefix lists from 'prefix-lists.yml'

Load with Folder Override​

$ scm load network route-prefix-list --file prefix-lists.yml --folder Austin
---> 100%
✓ Loaded route prefix list: internal-prefixes
✓ Loaded route prefix list: default-route

Successfully loaded 2 out of 2 route prefix lists from 'prefix-lists.yml'
note

When using container override options (--folder, --snippet, --device), all route prefix lists will be loaded into the specified container, ignoring the container specified in the YAML file.

Show Route Prefix List​

Display route prefix list objects.

Syntax​

scm show network route-prefix-list [NAME] [OPTIONS]

Arguments​

ArgumentDescriptionRequired
NAMEName of the route prefix list to show; omit to list allNo

Options​

OptionDescriptionRequired
--folder TEXTFolder locationYes*
--snippet TEXTSnippet locationYes*
--device TEXTDevice locationYes*
--max-results INTEGERMaximum number of results to displayNo
--output [table|json|yaml]Output format (default: table)No

* Exactly one of --folder, --snippet, or --device is required.

note

When no NAME argument is provided, all items are listed by default.

Examples​

Show Specific Route Prefix List​

$ scm show network route-prefix-list my-prefix-list --folder Texas
---> 100%
Route Prefix List: my-prefix-list
Location: Folder 'Texas'
Entries:
rule1: 10.0.0.0/8 (permit, ge: 16, le: 24)

List All Route Prefix Lists (Default Behavior)​

$ scm show network route-prefix-list --folder Texas
---> 100%
Route prefix lists in folder 'Texas':
------------------------------------------------------------
Name: internal-prefixes
Entries: 1
------------------------------------------------------------
Name: default-route
Entries: 1
------------------------------------------------------------

Backup Route Prefix Lists​

Backup all route prefix list objects from a specified location to a YAML file.

Syntax​

scm backup network route-prefix-list [OPTIONS]

Options​

OptionDescriptionRequired
--folder TEXTFolder locationNo*
--snippet TEXTSnippet locationNo*
--device TEXTDevice locationNo*
--file TEXTCustom output filenameNo

* One of --folder, --snippet, or --device is required.

Examples​

Backup from Folder​

$ scm backup network route-prefix-list --folder Texas
---> 100%
Successfully backed up 4 route prefix lists to route_prefix_list_folder_texas_20240115_120530.yaml

Backup with Custom Filename​

$ scm backup network route-prefix-list --folder Texas --file texas-prefix-lists.yaml
---> 100%
Successfully backed up 4 route prefix lists to texas-prefix-lists.yaml

Best Practices​

  1. Use ge/le for Flexibility: Use greater-than-or-equal (ge) and less-than-or-equal (le) modifiers to match a range of prefix lengths.
  2. Order Rules Carefully: Prefix list entries are evaluated in order; place more specific matches first.
  3. Document Prefix Purposes: Use descriptive names that indicate what prefixes the list matches.
  4. Test with Dry Run: Use --dry-run when loading configurations to preview changes before applying.
  5. Backup Before Changes: Always backup existing prefix lists before making bulk modifications.