Skip to content

Commit e312203

Browse files
committed
Simplify edit config code paths
1 parent 5031bc8 commit e312203

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

client.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,18 +1777,9 @@ func (c *Client) executeGetConfig(req *Req) (*response.NetconfResponse, error) {
17771777

17781778
// executeEditConfig executes an edit-config operation.
17791779
func (c *Client) executeEditConfig(req *Req) (*response.NetconfResponse, error) {
1780-
// If advanced edit-config options are set, build custom XML
1781-
if req.DefaultOperation != "" || req.TestOption != "" || req.ErrorOption != "" {
1782-
rpcXML := c.buildEditConfigXML(req)
1783-
return c.driver.RPC(opoptions.WithFilter(rpcXML))
1784-
}
1785-
1786-
// For standard edit-config, ensure config has <config> wrapper
1787-
configContent := req.Config
1788-
if !xmldot.Get(req.Config, "config").Exists() {
1789-
configContent = "<config>" + req.Config + "</config>"
1790-
}
1791-
return c.driver.EditConfig(req.Target, configContent)
1780+
// Build edit-config XML and send via RPC
1781+
rpcXML := c.buildEditConfigXML(req)
1782+
return c.driver.RPC(opoptions.WithFilter(rpcXML))
17921783
}
17931784

17941785
// executeCommit executes a commit operation with optional confirmed commit.

0 commit comments

Comments
 (0)