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
| Argument | Description | Required |
|---|---|---|
NAME | Name of the route prefix list | Yes |
Options
| Option | Description | Required |
|---|---|---|
--folder TEXT | Folder location | Yes* |
--snippet TEXT | Snippet location | Yes* |
--device TEXT | Device location | Yes* |
--description TEXT | Description | No |
--ipv4-json TEXT | IPv4 prefix list config as JSON | No |
* 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
| Argument | Description | Required |
|---|---|---|
NAME | Name of the route prefix list to delete | Yes |
Options
| Option | Description | Required |
|---|---|---|
--folder TEXT | Folder location | Yes* |
--snippet TEXT | Snippet location | Yes* |
--device TEXT | Device location | Yes* |
--force | Skip confirmation prompt | No |
* 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
| Option | Description | Required |
|---|---|---|
--file TEXT | Path to YAML file | Yes |
--folder TEXT | Override folder location for all objects | No |
--snippet TEXT | Override snippet location for all objects | No |
--device TEXT | Override device location for all objects | No |
--dry-run | Preview changes without applying | No |
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'
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
| Argument | Description | Required |
|---|---|---|
NAME | Name of the route prefix list to show; omit to list all | No |
Options
| Option | Description | Required |
|---|---|---|
--folder TEXT | Folder location | Yes* |
--snippet TEXT | Snippet location | Yes* |
--device TEXT | Device location | Yes* |
--max-results INTEGER | Maximum number of results to display | No |
--output [table|json|yaml] | Output format (default: table) | No |
* Exactly one of --folder, --snippet, or --device is required.
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
| Option | Description | Required |
|---|---|---|
--folder TEXT | Folder location | No* |
--snippet TEXT | Snippet location | No* |
--device TEXT | Device location | No* |
--file TEXT | Custom output filename | No |
* 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
- 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.
- Order Rules Carefully: Prefix list entries are evaluated in order; place more specific matches first.
- Document Prefix Purposes: Use descriptive names that indicate what prefixes the list matches.
- Test with Dry Run: Use
--dry-runwhen loading configurations to preview changes before applying. - Backup Before Changes: Always backup existing prefix lists before making bulk modifications.