feat: add support for RFC5717 <partial-lock> #135
No reviewers
Labels
No labels
breaking-change
bug
dependencies
duplicate
enhancement
go
good first issue
help wanted
invalid
investigation
proposal
proposal-accepted
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nemith/netconf!135
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "brb/push-wyxswsnmpkzs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds the RPC and to suppoirt RFC5717.
Pull request overview
This pull request adds support for RFC 5717 partial-lock operations, enabling fine-grained locking of specific datastore subtrees using XPath expressions. This complements the existing full datastore lock/unlock operations.
PartialLockandPartialUnlockRPC operations with proper XML marshalingReviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@ -21,6 +21,6 @@- [ ] Pool/SessionManager for automatic reconnects, retries, etc.The indentation for the
with-defaultsitem is incorrect. It should be indented at the same level as thePartial Lockitem above it (using two spaces for the sub-item indent).According to RFC 5717, the partial-lock operation requires at least one select element. The MarshalXML method should validate that the Select slice is not empty and return an error if it is, similar to how the Datastore type validates that it's not empty.
The lock-id is required for the partial-unlock operation according to RFC 5717. Consider adding validation in the MarshalXML method to ensure that LockID is not zero (the zero value for uint32), similar to how other required fields are validated in the codebase.
@ -369,0 +391,4 @@XMLName xml.Name `xml:"urn:ietf:params:xml:ns:netconf:partial-lock:1.0 partial-lock"`Select []selectExpr}{Select: selects,The PartialLockReply struct should embed
netconf.RPCReplylike other reply types in the codebase (e.g., OkReply, GetReply). This embedding provides access to standard RPC reply fields including MessageID, Attributes, and RPCErrors, which are important for proper error handling and response validation.@ -414,6 +414,123 @@ func TestUnlock_Exec(t *testing.T) {}The test loop should wrap each test case in a
t.Runcall for better test organization and failure reporting, consistent with other test functions in this file (e.g., TestLock_Exec, TestUnlock_Exec). The pattern should bet.Run(tc.name, func(t *testing.T) { ... }).@ -417,0 +527,4 @@be.Nonzero(t, err)} else {be.NilErr(t, err)}The test loop should wrap each test case in a
t.Runcall for better test organization and failure reporting, consistent with other test functions in this file (e.g., TestLock_Exec, TestUnlock_Exec). The pattern should bet.Run(tc.name, func(t *testing.T) { ... }).Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.