The load command loads the contents of a local or remote file into the candidate configuration. The command can only be executed at the top of the configure region when the MD-CLI session is in private, exclusive, or global configuration mode and does not result in a context change. The command can be issued regardless of whether uncommitted changes are present in the candidate configuration datastore.
The syntax of the load command is as follows:
load [mode] [full-replace | merge] [url] filename
The full-replace option replaces the current candidate configuration with the specified file.
The merge option merges the contents of the specified file into the candidate configuration. If there are conflicts, the configuration statements in the specified file override the existing configuration statements.
The file to be loaded is not a CLI script to be executed and cannot include:
MD-CLI commands such as commit, delete, or tools
navigation commands such as exit, back, or top
See Executing Commands from a File to perform such actions from a file.
If the loaded file encounters errors, parsing terminates at the first error. Statements before the error are loaded into the candidate configuration. Configuration statements in the loaded file are also subject to AAA command authorization. An authorization check failure also terminates the execution of further statements in the file.
The plain text output from the info full-context or info commands can be copied and pasted into a load file. Both the full-replace and merge options support this type of content.
The following shows the output from the info full-context command. This output can be copied and pasted into a file; for example, cf3:\testbgp.cfg.
*[ro:/configure router "Base" bgp]
A:admin@node-2# info full-context
/configure router "Base" bgp group "external" { }
/configure router "Base" bgp neighbor "192.168.89.8" group "external"
/configure router "Base" bgp neighbor "192.168.89.8" prefix-limit ipv4 maximum 200
/configure router "Base" bgp neighbor "192.168.89.8" prefix-limit ipv4 log-only true
/configure router "Base" bgp neighbor "192.168.89.8" prefix-limit ipv4 threshold 80
A:admin@node-2# info full-context > cf3:testbgp.cfg
[/]
A:admin@node-2# file list
Volume in drive cf3 on slot A is .
Volume in drive cf3 on slot A is formatted as FAT32
Directory of cf3:\
10/24/2019 04:02a <DIR> .ssh/
01/01/1980 12:00a 170 NVRAM.DAT
01/01/1980 12:00a 679 bof.cfg
10/24/2019 04:02a 314 nvsys.info
10/24/2019 04:02a 1 restcntr.txt
10/27/2019 02:57p 257 testbgp.cfg
5 File(s) 1421 bytes.
1 Dir(s) 0 bytes free.
From the MD-CLI, the file show command displays the contents of the file:
[/]
A:admin@node-2# file show cf3:testbgp.cfg
File: testbgp.cfg
-------------------------------------------------------------------------------
/configure router "Base" bgp group "external" { }
/configure router "Base" bgp neighbor "192.168.89.8" group "external"
/configure router "Base" bgp neighbor "192.168.89.8" prefix-limit ipv4 maximum 200
/configure router "Base" bgp neighbor "192.168.89.8" prefix-limit ipv4 log-only true
/configure router "Base" bgp neighbor "192.168.89.8" prefix-limit ipv4 threshold 80
===============================================================================
The load merge command can be used to merge the contents of the file into the candidate configuration. The following example shows no current candidate configuration changes for BGP before the command is executed. The compare command shows the candidate configuration changes after the file is merged.
[ex:/configure]
A:admin@node-2# load merge cf3:testbgp.cfg
Loaded 5 lines in 0.0 seconds from file cf3:\testbgp.cfg
*[ex:/configure]
A:admin@node-2# compare
router "Base" {
bgp {
+ group "external" {
+ }
+ neighbor "192.168.89.8" {
+ group "external"
+ prefix-limit ipv4 {
+ maximum 200
+ log-only true
+ threshold 80
+ }
+ }
}
}
The output from the info flat command can also be copied into a file.
*[ro:/configure router "Base" bgp]
A:admin@node-2# info flat
group "external" { }
neighbor "192.168.89.8" group "external"
neighbor "192.168.89.8" prefix-limit ipv4 maximum 200
neighbor "192.168.89.8" prefix-limit ipv4 log-only true
neighbor "192.168.89.8" prefix-limit ipv4 threshold 80
*[ro:/configure router "Base" bgp]
A:admin@node-2# info flat > cf3:testbgp.cfg
*[ro:/configure router "Base" bgp]
A:admin@node-2# /file show cf3:testbgp.cfg
File: testbgp.cfg
-------------------------------------------------------------------------------
group "external" { }
neighbor "192.168.89.8" group "external"
neighbor "192.168.89.8" prefix-limit ipv4 maximum 200
neighbor "192.168.89.8" prefix-limit ipv4 log-only true
neighbor "192.168.89.8" prefix-limit ipv4 threshold 80
===============================================================================
An additional context line is added, through a manual edit, to specify the context /configure router ‟Base” bgp, as shown in the file display:
*[ro:/configure router "Base" bgp]
A:admin@node-2# /file show cf3:testbgp.cfg
File: testbgp.cfg
-------------------------------------------------------------------------------
/configure router bgp
group "external" { }
neighbor "192.168.89.8" group "external"
neighbor "192.168.89.8" prefix-limit ipv4 maximum 200
neighbor "192.168.89.8" prefix-limit ipv4 log-only true
neighbor "192.168.89.8" prefix-limit ipv4 threshold 80
===============================================================================
The file is merged and the compare command shows the resulting candidate configuration changes.
[ex:/configure router "Base" bgp]
A:admin@node-2# info
[ex:/configure router "Base" bgp]
A:admin@node-2# top
[ex:/configure]
A:admin@node-2# load merge cf3:testbgp.cfg
Loaded 6 lines in 0.0 seconds from file cf3:\testbgp.cfg
*[ex:/configure]
A:admin@node-2# compare
router "Base" {
bgp {
+ group "external" {
+ }
+ neighbor "192.168.89.8" {
+ group "external"
+ prefix-limit ipv4 {
+ maximum 200
+ log-only true
+ threshold 80
+ }
+ }
}
}
The following shows the output from the info command. To use the output in a load file, the context must be added through a manual edit, similar to the edit of file testbgp.cfg in the preceding example, or use the output from the info full-context command.
*[ro:/configure router "Base" bgp]
A:admin@node-2# info
group "external" {
}
neighbor "192.168.89.8" {
group "external"
prefix-limit ipv4 {
maximum 200
log-only true
threshold 80
}
}
The contents of the load file with the info output include the following:
/configure router "Base" bgp
group "external" {
}
neighbor "192.168.89.8" {
group "external"
prefix-limit ipv4 {
maximum 200
log-only true
threshold 80
}
}