Support "configure session" #175
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: eAPI doesn't support atomic operations
When we run commands below via eAPI, we'll see an error saying "Address 172.16.0.1 is already assigned to interface Ethernet6" at L7, and L1-L6 are committed.
However, sometimes I'd like to do this as an atomic operation, where abort everything when something goes wrong.
This PR will support that behavior with introducing
Node#configure_session().{ "jsonrpc": "2.0", "method": "runCmds", "params": { "format": "json", "timestamps": false, "autoComplete": false, "expandAliases": false, "cmds": [ "configure", "interface Ethernet6", " no switchport", " ip address 172.16.0.1/30", "interface Ethernet7", " no switchport", " ip address 172.16.0.1/30" ], "version": 1 }, "id": "EapiExplorer-1" }Usage
When there is something invalid:
Note
If
Node#configure_session()isn't called, nothing changed in library behavior.Test result
With vEOS below,
I haven't broken anything hopefully, and I don't see any performance impact here.
developbranch:PR branch: