Commit action in Cisco IOS XR #182
-
I'm trying to figure out if there is any built in function for commiting configuration in IOS XR? Currently, sending config with d.SendConfigs(cmds) will just "hang" if I also dont include a 'commit' in the end of my commands. For reference; p, err := platform.NewPlatform(
"cisco_iosxr",
host,
options.WithAuthNoStrictKey(),
options.WithAuthUsername(settings.Username),
options.WithAuthPassword(settings.Password),
)
if err != nil {
return err
}
d, err := p.GetNetworkDriver()
if err != nil {
return err
}
err = d.Open()
if err != nil {
return err
}
defer d.Close()
cmds := []string{"interface Loopback0", "description Configured by Go", "commit"}
_, err = d.SendConfigs(cmds)
if err != nil {
return err
}
return nil |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
nope, you're not missing anything. scrapli(go) doesn't care about this basically -- its up to you. scrapli(go)cfg does this for you though. if you want to just have the commit things handled by itself so you can see errors related to that only, you could just send another sendconfigs after you send all the config lines. scrapli wont leave config mode till you ask it to do a "command" or otherwise acquire a different privilege level. |
Beta Was this translation helpful? Give feedback.
-
I see, thank you for the clarification. |
Beta Was this translation helpful? Give feedback.
nope, you're not missing anything. scrapli(go) doesn't care about this basically -- its up to you. scrapli(go)cfg does this for you though.
if you want to just have the commit things handled by itself so you can see errors related to that only, you could just send another sendconfigs after you send all the config lines. scrapli wont leave config mode till you ask it to do a "command" or otherwise acquire a different privilege level.