Posted on September 14, 2015 9:31 pm
 |  Asked by Alessandro Carpi
 |  1339 views
RESOLVED
0
0
Print Friendly, PDF & Email

Hi,

I am wondering if there is a way to run the “configure replace” command using eApi. I can run other configure commands which are run from the config prompt, but “configure replace” runs out of the config mode. Any help is appreciated.

Thanks

0
Posted by Alessandro Carpi
Answered on September 14, 2015 9:40 pm

I got this working. In the runCmd, I have to just give the complete ”config replace flash:XXX-config force” command. Sorry for the noise.

1
Posted by Alexis Dacquay
Answered on September 14, 2015 9:57 pm

Hi Allessandro,

 

Thanks for updating on your findings.

 

Few comments about ”I can run other configure commands which are run from the config prompt, but ”configure replace” runs out of the config mode

Note that any/most Exec (non-config) commands can be ran in config mode. Below are examples of few Exec-only commands that run fine in Config mode. The CLI will automatically find where to execute then from.

 

vEOS1__21:46:02(config)#int e1
vEOS1__21:46:04(config-if-Et1)#term monitor
vEOS1__21:46:22(config-if-Et1)#show ver | i Soft
Software image version: 4.15.0F
vEOS1__21:46:27(config-if-Et1)#reload ?
 at Perform reload at specified time
 cancel Cancel the existing reload command
 in Perform the reload after specified delay
 now Perform action immediately without prompting
 power Power-cycle the system
 <cr>
vEOS1__21:46:27(config-if-Et1)#configure replace ?
 boot-extensions Copy boot extensions configuration
 certificate: Source file path
 clean-config Copy from clean, default, configuration
 extension: Source file path
 file: Source file path
 flash: Source file path
 [...]
vEOS1__21:46:27(config-if-Et1)#configure replace flash:test.cfg

 

eAPI can run any Config or non-Config (Exec) commands you want.

 

About the command ”configure replace” specifically, you could run it from config mode, but in your eAPI code you would not need to go in config mode for that.

 

Switch(config-if-Et1)#diff run start
Switch(config-if-Et1)#configure replace flash:startup-config ?
 ignore-errors Replace config, ignoring any errors in loading the config
 <cr>

 

Note that the above keywords might be slightly different in your version, the mandatory ”force” is now deprecated, with instead an optional ”ignore-errors”. I would recommend you upgrade EOS to account for the newest features available and most up to date syntax. The syntax should normally not change, it was an exception for a new feature being developed as part of the config session features.

 

Best regards,

Alexis

0
Posted by Alessandro Carpi
Answered on September 14, 2015 10:35 pm

Great, thanks for your help!

Post your Answer

You must be logged in to post an answer.