BGP Route Map
BGP route maps define match conditions and set actions for BGP route policy processing. The scm CLI provides commands to create, update, delete, and load BGP route maps.
Overview
The bgp-route-map commands allow you to:
- Create BGP route maps with match and set actions
- Update existing route map configurations
- Delete route maps that are no longer needed
- Bulk import route maps from YAML files
- Export route maps for backup or migration
Set BGP Route Map
Create or update a BGP route map.
Syntax
scm set network bgp-route-map NAME [OPTIONS]
Arguments
| Argument | Description | Required |
|---|---|---|
NAME | Name of the BGP route map | Yes |
Options
| Option | Description | Required |
|---|---|---|
--folder TEXT | Folder location | Yes* |
--snippet TEXT | Snippet location | Yes* |
--device TEXT | Device location | Yes* |
--route-map-json TEXT | Route map entries as JSON | No |
* Exactly one of --folder, --snippet, or --device is required.
Examples
Create a Route Map with Permit Action
$ scm set network bgp-route-map my-route-map \
--folder Texas \
--route-map-json '[{"name": "rule1", "action": "permit", "match": {"as_path": "my-as-path"}}]'
---> 100%
Created BGP route map: my-route-map in folder Texas
Create a Route Map with Deny Action
$ scm set network bgp-route-map deny-map \
--folder Texas \
--route-map-json '[{"name": "rule1", "action": "deny", "match": {"community": "no-export"}}]'
---> 100%
Created BGP route map: deny-map in folder Texas
Delete BGP Route Map
Delete a BGP route map from SCM.
Syntax
scm delete network bgp-route-map NAME [OPTIONS]
Arguments
| Argument | Description | Required |
|---|---|---|
NAME | Name of the BGP route map 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 bgp-route-map my-route-map --folder Texas --force
---> 100%
Deleted BGP route map: my-route-map from folder Texas
Load BGP Route Map
Load multiple BGP route maps from a YAML file.
Syntax
scm load network bgp-route-map [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
---
bgp_route_maps:
- name: permit-map
folder: Texas
route_map:
- name: "rule1"
action: permit
match:
as_path: "my-as-path"
- name: deny-map
folder: Texas
route_map:
- name: "rule1"
action: deny
match:
community: "no-export"
Examples
Load with Original Locations
$ scm load network bgp-route-map --file route-maps.yml
---> 100%
✓ Loaded BGP route map: permit-map
✓ Loaded BGP route map: deny-map
Successfully loaded 2 out of 2 BGP route maps from 'route-maps.yml'
Load with Folder Override
$ scm load network bgp-route-map --file route-maps.yml --folder Austin
---> 100%
✓ Loaded BGP route map: permit-map
✓ Loaded BGP route map: deny-map
Successfully loaded 2 out of 2 BGP route maps from 'route-maps.yml'
When using container override options (--folder, --snippet, --device), all BGP route maps will be loaded into the specified container, ignoring the container specified in the YAML file.
Show BGP Route Map
Display BGP route map objects.
Syntax
scm show network bgp-route-map [NAME] [OPTIONS]
Arguments
| Argument | Description | Required |
|---|---|---|
NAME | Name of the BGP route map 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 BGP Route Map
$ scm show network bgp-route-map my-route-map --folder Texas
---> 100%
BGP Route Map: my-route-map
Location: Folder 'Texas'
Rules:
rule1: permit (match AS path: my-as-path)
List All BGP Route Maps (Default Behavior)
$ scm show network bgp-route-map --folder Texas
---> 100%
BGP route maps in folder 'Texas':
------------------------------------------------------------
Name: permit-map
Rules: 1
------------------------------------------------------------
Name: deny-map
Rules: 1
------------------------------------------------------------
Backup BGP Route Maps
Backup all BGP route map objects from a specified location to a YAML file.
Syntax
scm backup network bgp-route-map [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 bgp-route-map --folder Texas
---> 100%
Successfully backed up 6 BGP route maps to bgp_route_map_folder_texas_20240115_120530.yaml
Backup with Custom Filename
$ scm backup network bgp-route-map --folder Texas --file texas-route-maps.yaml
---> 100%
Successfully backed up 6 BGP route maps to texas-route-maps.yaml
Best Practices
- Order Rules Carefully: Route map rules are evaluated in order; place more specific matches first.
- Use Explicit Deny: End route maps with an explicit deny rule to make the policy intent clear.
- Test with Dry Run: Use
--dry-runwhen loading configurations to preview changes before applying. - Backup Before Changes: Always backup existing route maps before making bulk modifications.
- Document Match Criteria: Use descriptive rule names that indicate what each match condition does.