-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Description
In JunOS, one has to commit the configuration after EditConfig(). That method isn't available in the library though, nor I found an alternative to reuse. I haven't tested that on other brands yet, but in case they don't have the "commit" call, perhaps an alternative for the library could be to add a more generic method, that could be used for simple RPC messages.
The XML structure of the commit call (for JunOS, documented here) is:
<rpc>
<commit/>
</rpc>What I came up with to solve my use case is:
type basicReq struct {
XMLName xml.Name
}
func (s *Session) Commit(ctx context.Context) error {
req := basicReq{
XMLName: xml.Name{Local: "commit"},
}
var resp OKResp
return s.Call(ctx, &req, &resp)
}Clearly that Commit() method could be changed to take "commit" as input parameter and use it in the req constructor:
func (s *Session) Commit(ctx context.Context, message string) error {
req := basicReq{
XMLName: xml.Name{Local: message},
}
...
}Metadata
Metadata
Assignees
Labels
No labels