netconf.git
6 days agoRemove redundant non null check in JsonPatchBody 39/116139/11
Peter Suna [Wed, 2 Apr 2025 12:29:49 +0000 (14:29 +0200)]
Remove redundant non null check in JsonPatchBody

Remove the redundant check for a non-null TargetSchemaNode
in JsonPatchBody. Reason:

- The TargetSchemaNode is not used inside this method or under
this if block.
- If the target is not null, then TargetSchemaNode should also
not be null, or it should fail here as an invalid state:
JsonPatchBody.PatchEdit#setTargetSchemaNode()
- The only place where TargetSchemaNode is used is here:
JsonPatchBody#readEditDefinition()
so in this state, it is already checked.

JIRA: NETCONF-1438
Change-Id: Ia08bcbbeb14f425d0b0a430b21257fa6fcf7bffe
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
6 days agoRemove unnecessary subscription lookup 83/116383/2
Oleksandr Zharov [Wed, 30 Apr 2025 11:33:47 +0000 (13:33 +0200)]
Remove unnecessary subscription lookup

Romoved unnecessary lookup for subscription that was already
found few lines above.

Change-Id: Ice0216fafa9ec0c05a46d37c456f0c1c938f21c3
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
9 days agoImprove error messaging in YangPatch 72/115872/26
Peter Suna [Tue, 11 Mar 2025 16:49:07 +0000 (17:49 +0100)]
Improve error messaging in YangPatch

The method readValueNodes returns exception message
"Error parsing input" for several error cases.
Fix this by handling each error case individually with a proper
error message.

Fix ErrorType from PROTOCOL to APLICATION, since this error
is not related to the NETCONF protocol.

Fix ErrorTag from MALFORMED_MESSAGE to MISSING_ELEMENT when 'value'
element is required and missing, and to UNKNOWN_ELEMENT when 'value'
element is provided for DELETE, MOVE and REMOVE operation.

Fix JsonPatchBodyTest target path to throw correct exception.

JIRA: NETCONF-1438
Change-Id: I9226ede2d664c1c8c24db1bccc7f412ab929eb34
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
9 days agoAdd exception message for missing YangPatch nodes 84/115784/25
Peter Suna [Fri, 7 Mar 2025 18:09:47 +0000 (19:09 +0100)]
Add exception message for missing YangPatch nodes

If any required schema node is missing, an NullPointerException
is thrown without additional information.

Use a custom requireNonNullValue check, which throws a checked
RequestException and adds an exception message specifying
the missing field.

JIRA: NETCONF-1438
Change-Id: I528a65f44d09ccf115533f73874c109cdf80c022
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
11 days agoExpand filter tests for RPCs 11/115911/4
Oleksandr Zharov [Tue, 18 Mar 2025 09:28:28 +0000 (10:28 +0100)]
Expand filter tests for RPCs

Added test cases for subscription RPCs with filters.

Change JSON format for filter to XML as we expect better support of
YANG anydata with XML.

JIRA: NETCONF-1436
Change-Id: Ib9dfd5adff40456d027ce80f0aa0a2423019dead
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
11 days agoImplement parseSubtreeFilter 72/116172/28
Ivan Hrasko [Mon, 7 Apr 2025 13:51:49 +0000 (15:51 +0200)]
Implement parseSubtreeFilter

Implemented EventStreamFilter interface for SubtreeFilter.
Added logic to parse SubtreeFilter when establishing and
modifying subscription.

JIRA: NETCONF-714
Change-Id: Ic54351c4ebd85c41ad07303617e20a9e143c54f3
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
11 days agoImplement databind.SubtreeFilterReader 53/116053/62
Oleksandr Zharov [Tue, 25 Mar 2025 01:45:19 +0000 (02:45 +0100)]
Implement databind.SubtreeFilterReader

Implemented SubtreeFilterReader method that processes data from
XMLStreamReader and creates SubtreeFilter structure that
corresponds to EffectiveModelContext.
Added tests to cover RFC examples plus some extra for wildcard
and multiple namespace cases.

JIRA: NETCONF-1454
Change-Id: I4d4a05c818672c12ff42258b41d457eb06ec44f0
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
11 days agoAdapt subscription termination on session closed 81/115781/23
Matej Sramcik [Tue, 15 Apr 2025 12:01:36 +0000 (14:01 +0200)]
Adapt subscription termination on session closed

Logic to remove subscription requires request that initiated removing,
but when subscription remove is invoked by channel being inactive,
there is no request.
Separated method is created for cleaning of subscriptions after the
session is closed. Logic from terminateImpl extracted to separated
method with nullable request, so it can be used for both cases.
Removed sending of subscriptionTerminated as there is no one to send
it to.

JIRA: NETCONF-714
Change-Id: Icc237700900be286cf20134abd52c730ff4a769f
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
12 days agoPopulate subtree filters using DTCL 36/116136/12
Samuel Schneider [Tue, 1 Apr 2025 17:10:22 +0000 (19:10 +0200)]
Populate subtree filters using DTCL

Populate subtree filters using DOMDataTreeChangeListener.
Parse filters as they are put in to datastore.

JIRA: NETCONF-1459
Change-Id: Ib2517417bfd28fdfb14d76dfd8e603e05733ce81
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
12 days agoImplement (databind) SubtreeFilterWriter 24/116124/18
Yaroslav Lastivka [Tue, 1 Apr 2025 08:10:29 +0000 (11:10 +0300)]
Implement (databind) SubtreeFilterWriter

Add support for writing SubtreeFilter to XMLStreamWriter,
including proper prefix handling and namespace declarations.

Include unit tests covering exact and wildcard namespace selections.

Implement a PrettyTree representation for SubtreeFilter that produces
a human-readable, XML-style output with appropriate indentation and
namespace binding information.

JIRA: NETCONF-1455
Change-Id: I064bda642b12f3eada96b8a9930c190befa3640b
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
12 days agoImplement SubtreeMatcher 88/116088/15
Yaroslav Lastivka [Thu, 27 Mar 2025 09:30:05 +0000 (11:30 +0200)]
Implement SubtreeMatcher

Added recursive matching for containment, content, and selection nodes.
Support content matching via a map of QName→expected value.
Handle wildcard selections by iterating over candidate QNames.
Simulate attributes as child leaf nodes.

Added unit tests to cover exact, wildcard, and attribute matching cases.

JIRA: NETCONF-1456
Change-Id: Icc98c00aef663e9a55923af844451453318a8f69
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
13 days agoFix Leaf-list PUT with single value 68/116268/3
Peter Suna [Tue, 15 Apr 2025 09:09:03 +0000 (11:09 +0200)]
Fix Leaf-list PUT with single value

This issue is caused when parsing data from JSON/XML to NormalizedNode.
Similar to the MapNode body parser, it produces a single-entry
LeafSetNode, which creates RequestException with message:
'Payload name ((urn:foo)baz-list) is different from identifier name
((urn:foo)baz-list[delta])'

Fix this by providing LeafSetNode child for PUT requests.

JIRA: NETCONF-1452
Change-Id: Ie119088b8f8db19110c2194cb96641fb9f7b20a1
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
13 days agoFix YANG-PATCH Leaf-list request 69/116369/3
Peter Suna [Thu, 17 Apr 2025 09:08:48 +0000 (11:08 +0200)]
Fix YANG-PATCH Leaf-list request

If a YANG-PATCH request is sent to populate a single Leaf-list element,
we receive an IllegalArgumentException with the following messages
Create operation:
LeafSetEntryNode is not valid for parent
Merge operation:
Invalid nesting of data.

Similar to List use parent path for leaf-list requests
to resolve this issue.

JIRA: NETCONF-1453
Change-Id: I4d16d803f524b9ace86850023ed95afe4dd12c5e
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
2 weeks agoRemove restconf-notifications 73/116373/5
Robert Varga [Sat, 26 Apr 2025 01:17:17 +0000 (03:17 +0200)]
Remove restconf-notifications

Move the two classes we have here to restconf-server and eliminate this
artifact, as it is superfluous.

Change-Id: I2f21da108cc480fc55aebd2dea302ade64e92663
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoIntegrate ContextListener 27/116227/6
Robert Varga [Fri, 11 Apr 2025 00:37:17 +0000 (02:37 +0200)]
Integrate ContextListener

Source routing here is inherent to MdsalRestconfStreamRegistry,
integrate ContextListener there and hide the start method -- it should
only be called by subclasses.

JIRA: CONTROLLER-714
Change-Id: Ifdf74ee9e232d7519f20a872e576bf766834bac3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMigrate CreateDataChangeEventSubscriptionRpcTest 72/116372/1
Robert Varga [Fri, 25 Apr 2025 16:55:09 +0000 (18:55 +0200)]
Migrate CreateDataChangeEventSubscriptionRpcTest

Use a test subclass and do not worry about the actual DataBroker
invocations.

Change-Id: I70044d1ff099a5c2fab9730e6730ba879c312e11
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFix GET for Leaf-list entry 76/116276/3
Peter Suna [Wed, 16 Apr 2025 11:54:32 +0000 (13:54 +0200)]
Fix GET for Leaf-list entry

When a request is sent to get specific leaf-list data, such as:
“yang-ext:mount/foo:foo/baz-list=alpha"

The request fails with a 500 Server Error.

Fix this by wrapping the result in a LeafSetNode to serialize
it properly.

JIRA: NETCONF-1451
Change-Id: Iab704a09c8a17975ab2470facb40eea096560f02
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
3 weeks agoBump upstreams 97/116297/5
Robert Varga [Sun, 20 Apr 2025 06:45:31 +0000 (08:45 +0200)]
Bump upstreams

Adopt:
- odlparent-14.0.9
- infrautils-7.1.3
- yangtools-14.0.13
- mdsal-14.0.12

Change-Id: Ia9ceb5c0eedbdfedcfc7b51bdf1fab56dc0b0903
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoRename restconf-it packages 30/116230/1
Robert Varga [Fri, 11 Apr 2025 09:16:53 +0000 (11:16 +0200)]
Rename restconf-it packages

Use org.opendaylight.restconf.it prefix for all these in order to
prevent potential clashes.

Change-Id: I5680b18df31362e2bb2b994244830069e2b15425
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoClean up abstract tests 29/116229/1
Robert Varga [Fri, 11 Apr 2025 09:01:47 +0000 (11:01 +0200)]
Clean up abstract tests

Do not reference 'Router' services, but rather pick the up from
DOM{Notification,Rpc}Router directly. Also make sure we shut them down
correctly.

Change-Id: I729087829da1f7dbb11b73c0105c5db16865fb50
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoExpand ContentMatchNode values to Map 03/116203/2
Oleksandr Zharov [Wed, 9 Apr 2025 18:35:45 +0000 (20:35 +0200)]
Expand ContentMatchNode values to Map

Since SubtreeFilter supports wildcards in the filter,
there may be to cases when one element can correspond
to multiple nodes in the model context.
This means that wildcard content nodes can also have many
nodes with matching local name. For all these nodes
we should parse and store value separately in the qname
to value map.

JIRA: NETCONF-1454
Change-Id: I681d2ee150392ace2f4d1d9305632a40677e530e
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
4 weeks agoMove session check before acquiring semaphore 29/116129/5
Peter Suna [Tue, 1 Apr 2025 10:24:27 +0000 (12:24 +0200)]
Move session check before acquiring semaphore

If currentSession is null, we decrease semaphore without
restoring its state afterward.

Check if currentSession is not null before acquiring semaphore to
prevent permanent semaphore decrease.

JIRA NETCONF-1462
Change-Id: I8aad89b137720ef7f805bba7f155f37ef1d6558d
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
4 weeks agoMove ContextListener 26/116226/3
Robert Varga [Fri, 11 Apr 2025 00:08:43 +0000 (02:08 +0200)]
Move ContextListener

ContextListener is really providing support to MD-SAL version of
RestconfStream.Registry. Move it along DefaultNotificationSource to
restconf-server-mdsal, adjusting dependencies accordingly.

JIRA: NETCONF-714
Change-Id: I06b978b555b36a096d8ad32d28dcc1b657e3105c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoRemove unneeded locals 24/116224/2
Robert Varga [Thu, 10 Apr 2025 23:19:01 +0000 (01:19 +0200)]
Remove unneeded locals

We are using a fluent builder, hence we can just pass the resulting
object without using a local variable.

Change-Id: Ia375a877d02f83cdc4e771612db3727a19ce47f1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoRemove SubscriptionStateMachine 63/116163/11
Oleksandr Zharov [Fri, 4 Apr 2025 18:06:03 +0000 (20:06 +0200)]
Remove SubscriptionStateMachine

Move SubscriptionState keeping from SubscriptionStateMachine to
each Subscription, forcing the move of SubscriptionState to
server.spi.RestconfStream.

The moveTo() method is split into SubscriptionState.canMoveTo(), which
performs the check and AbstractRestconfStreamSubscription's part, which
does the exception throwing.

JIRA: NETCONF-1461
Change-Id: I052fcf0a6a540ae8d9c5b0a01719edbb718d6011
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoFix deadlock with KeepaliveTask & Session lock 68/116168/4
Ivan Hrasko [Mon, 7 Apr 2025 10:20:53 +0000 (12:20 +0200)]
Fix deadlock with KeepaliveTask & Session lock

KeepaliveTask needs to guard suppressed and suppressedCounter fields
using thread locking only.

To avoid deadlock do not lock external method call:
devRpc#invokeNetconf as it uses its own locking mechanism based
on session lock in NetconfDeviceCommunicator class.

JIRA: NETCONF-1458
Change-Id: Idb9a04f2284fc98e5d1d2aee3d1ffafdd318504e
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
4 weeks agoRemove SubtreeFilterRestconf 65/116165/1
Ivan Hrasko [Mon, 7 Apr 2025 08:24:41 +0000 (10:24 +0200)]
Remove SubtreeFilterRestconf

Remove SubtreeFilterRestconf, this logic will be replaced by
SubtreeMatcher which will provide just boolean test to accept or
reject notification before sending to the client.

JIRA: NETCONF-714
Change-Id: Ia368d6870f68b9bd498733b421233bbeee638684
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
5 weeks agoHandle IllegalStateException for Put & PatchData 56/115956/3
Peter Suna [Wed, 19 Mar 2025 19:40:23 +0000 (20:40 +0100)]
Handle IllegalStateException for Put & PatchData

If the JSON body contains an invalid node while parsing with
JsonParserStream, IllegalStateException is thrown. If this exception
is not caught, it result in a 500 error without additional information.

JIRA: NETCONF-1439
Change-Id: I4c1bf41ad134accc06ebdbffdce4cbdca70c069d
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
5 weeks agoFix typos in filtering and counters tests 41/116141/2
Samuel Schneider [Wed, 2 Apr 2025 16:26:53 +0000 (18:26 +0200)]
Fix typos in filtering and counters tests

Fix some typos left in filtering and counters tests

JIRA: NETCONF-1436
Change-Id: I9eda3e26d1722c9cb02a244dffc63612159931ca
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
5 weeks agoAdapt ModifySubscriptionRpc 61/115761/27
Samuel Schneider [Thu, 6 Mar 2025 16:19:58 +0000 (17:19 +0100)]
Adapt ModifySubscriptionRpc

Adapt ModifySubscriptionRpc to changes in RestconfStream.
Add possibility to modify filter in RestconfStream.Subscription
and propagate this change in to operational datastore.

Now we provide correct response to invoke of this rpc,
in case of error correct error message, after filtering is finished
correctly update datastore, instead of "Not implemented yet".

JIRA: NETCONF-714
Change-Id: If6487621d5a2ff378be7f9f9089351df75a50ff4
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
5 weeks agoAdd test for filtering part of notification 40/115740/17
Samuel Schneider [Tue, 4 Mar 2025 16:26:03 +0000 (17:26 +0100)]
Add test for filtering part of notification

Test is disabled for now as this logic is not
implemented yet.

JIRA: NETCONF-1436
Change-Id: I1adbb702b9d4e17af6dcd0c82bcd80e43ebd289e
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
5 weeks agoAdd test cases for filtering and counters 01/115601/21
Samuel Schneider [Wed, 12 Feb 2025 12:11:11 +0000 (13:11 +0100)]
Add test cases for filtering and counters

Add tests for filtering notifications and tests if
sent event record and excluded event records counters
are updated correctly.

Tests are disabled for now as this logic is not
implemented yet.

JIRA: NETCONF-1436
Change-Id: I6c389bcf4c71880784de660fef7824c1bbf8fc57
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
5 weeks agoChange SubscriptionHolder to only store id 63/116063/3
Samuel Schneider [Tue, 25 Mar 2025 08:14:59 +0000 (09:14 +0100)]
Change SubscriptionHolder to only store id

Change SubscriptionHolder to only store id, and use
streamRegistry to look up subscription when needed.

We want to keep subscriptions immutable, with this
change there will be no need to update or create new
SubscriptionHolder when subscription is modified.

JIRA: NETCONF-714
Change-Id: Iea68917f5a17bcde7376aa0c381aaba500ca75a2
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
6 weeks agoSeparate createLegacyStream in StreamRegistry 73/116073/3
Samuel Schneider [Wed, 26 Mar 2025 16:22:51 +0000 (17:22 +0100)]
Separate createLegacyStream in StreamRegistry

Create separate method for creating legacy streams, which will
not close after last subscriber is removed.

JIRA: NETCONF-714
Change-Id: Id3ca9675475247481fec4a1a26c40290d779e269
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
6 weeks agoFix SubtreeFilter wildcard text example 97/116097/3
Oleksandr Zharov [Thu, 27 Mar 2025 12:01:13 +0000 (13:01 +0100)]
Fix SubtreeFilter wildcard text example

Fixed example xml used for testing wildcard filter node in
SubtreeFilterFromElementTest.

JIRA: NETCONF-1445
Change-Id: I2e256f960e69ebb1d9ced4348971ba92fcb339fb
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
6 weeks agoUse OnCommitFuture in subscription termination 93/116093/6
Matej Sramcik [Thu, 27 Mar 2025 10:07:13 +0000 (11:07 +0100)]
Use OnCommitFuture in subscription termination

Use OnCommitFutureCallback instead of FutureCallback in subscription
termination, so in case of failure we get Exception instead of
Throwable.

JIRA: NETCONF-714
Change-Id: I147c6a3c3a068d0e4bc47a9d5926f74c3a343f17
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
6 weeks agoFinish up the SubtreeFilterPrettyTree 86/115886/21
Oleksandr Zharov [Thu, 13 Mar 2025 12:53:11 +0000 (13:53 +0100)]
Finish up the SubtreeFilterPrettyTree

Finished recursion logic in SubtreeFilterPrettyTree that generates
pretty tree from filter and addressed FIXMEs.
Added test to cover this logic.

JIRA: NETCONF-1445
Change-Id: Ib02d3eab83fc1038796d45571d09c451cfc79b42
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
6 weeks agoImplement SubtreeFilter#writeTo 59/115759/34
Oleksandr Zharov [Wed, 5 Mar 2025 17:18:21 +0000 (18:18 +0100)]
Implement SubtreeFilter#writeTo

Implemented SubtreeFilter method to write filter to an Element.
Added test that covers examples from RFC6241.

JIRA: NETCONF-1445
Change-Id: Idb4c4ef6556457e81454cae65d348c4ba1dde311
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
6 weeks agoStore correct Subscription in StreamRegistry 39/116039/2
Samuel Schneider [Mon, 24 Mar 2025 14:09:26 +0000 (15:09 +0100)]
Store correct Subscription in StreamRegistry

Currently, we are loosing result of createSubscription(subscription)
and storing only SubscriptionImpl in subscriptions map inside
StreamRegistry. This leads to lookupSubscription() returning only
SubscriptionImpl and for example termination() is only invoked on
SubscriptionImpl and MdsalRestconfStreamSubscription is never
terminated as we don't have access to it, this leads to subscription
not being deleted from datastore.

JIRA: NETCONF-714
Change-Id: I4bb59db9cb432e851f7dd5f372685f708e1b03ff
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
6 weeks agoAdd sent-event-records counter 38/115738/23
Yaroslav Lastivka [Tue, 4 Mar 2025 14:58:49 +0000 (16:58 +0200)]
Add sent-event-records counter

Added updateReceiver() method to MdsalRestconfStreamRegistry to update
per-receiver counters in the operational datastore.
Added ReceiverHolder to encapsulate receiver identification
(subscriptionId, receiverName) and provide access to local counter
values. Added ChannelSenderSubscription class to handle HTTP/1
event streaming and update per-receiver counters via the Registry.

JIRA: NETCONF-1449
Change-Id: Ifa9f101d6d27b13ef74bf5e03084bddbb83af66b
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
6 weeks agoCreate notification listening test 74/115374/44
Matej Sramcik [Wed, 12 Feb 2025 09:42:22 +0000 (10:42 +0100)]
Create notification listening test

Create test which invoke notification and listen for it on stream and
test if modified, deleted, and killed notification are received after
interaction with subscription.

JIRA: NETCONF-714
Change-Id: Ide8d3603c68cb326d8c382593dccf41f243c2b33
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
6 weeks agoAdd Stream client for tests 98/115298/32
Matej Sramcik [Tue, 11 Feb 2025 13:47:36 +0000 (14:47 +0100)]
Add Stream client for tests

Added creation of sse stream and listener to subscription stream.

JIRA: NETCONF-714
Change-Id: I4e719ea7e08254e4170eab34e1958e1e62194d7b
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
6 weeks agoFix termination RPCs requests not being completed 58/115758/3
Samuel Schneider [Wed, 5 Mar 2025 13:21:18 +0000 (14:21 +0100)]
Fix termination RPCs requests not being completed

Fix problem with DeleteSubscriptionRpc and KillSubscriptionRpc
requests are not being completed.

JIRA: NETCONF-714
Change-Id: Ieea7e8354a5077d7654c077e309756533c7b4066
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
6 weeks agoRemove stop-time form ModifySubscriptionRpc 10/115910/2
Samuel Schneider [Tue, 18 Mar 2025 08:28:09 +0000 (09:28 +0100)]
Remove stop-time form ModifySubscriptionRpc

Remove stop-time as it won't be supported.

JIRA: NETCONF-714
Change-Id: Ia5c32af028c8f2d69c66a3f278dc78d27c427c32
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
7 weeks agoThrow RequestException in case of multiple value 73/115873/8
Peter Suna [Tue, 11 Mar 2025 18:27:06 +0000 (19:27 +0100)]
Throw RequestException in case of multiple value

If provided JSON body contains multiple "value" leafs,
throw RequestException instead of IllegalArgumentException.

JIRA: NETCONF-1438
Change-Id: I8a61623b9260a6a27c7c2de70bc6b780b9cfa7a9
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
7 weeks agoRemove maven-bundle-plugin override 31/115931/1
Robert Varga [Wed, 19 Mar 2025 22:28:26 +0000 (23:28 +0100)]
Remove maven-bundle-plugin override

We have a workaround for KARAF-7927, hence we can remove the version
override.

Change-Id: I8c913187c1ae8781e94ef3a89ee9a3fc45271324
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 weeks agoDisable KillSubscriptionRpc 75/115875/1
Samuel Schneider [Wed, 12 Mar 2025 11:24:25 +0000 (12:24 +0100)]
Disable KillSubscriptionRpc

Disable KillSubscriptionRpc until we get NACM integrated,
as otherwise anybody can kill everybody's subscription.

JIRA: NETCONF-714
Change-Id: I0f628bc145a60c02fd36c55e65f6cee179d028b6
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
2 months agoImplement SubtreeFilter#readFrom 41/115741/21
Oleksandr Zharov [Tue, 4 Mar 2025 12:49:32 +0000 (13:49 +0100)]
Implement SubtreeFilter#readFrom

Implemented SubtreeFilter method to read filter from an Element.
Added more test to cover examples from RFC6241.

JIRA: NETCONF-1445
Change-Id: I6debd0eb7984734b268729ef04b68a3378b01a93
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
2 months agoBump upstreams 10/115810/1
Robert Varga [Sat, 8 Mar 2025 16:13:35 +0000 (17:13 +0100)]
Bump upstreams

Adopt:
- odlparent-14.0.8
- yangtools-14.0.11
- mdsal-14.0.11

Change-Id: I4559bd855a53d6f613d27b088852ebed17798b8d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoInitialize default NETCONF stream 35/115735/8
Ivan Hrasko [Tue, 4 Mar 2025 12:53:32 +0000 (13:53 +0100)]
Initialize default NETCONF stream

Expose start method in AbstractRestconfStreamRegistry to be able to
start predefined NETCONF stream with its current Source.

JIRA: NETCONF-714
Change-Id: I549eafa141638f9026cfbe222e98151a4d14b4fe
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
2 months agoMove context listener to MDSAL plugins 34/115734/6
Ivan Hrasko [Tue, 4 Mar 2025 12:17:18 +0000 (13:17 +0100)]
Move context listener to MDSAL plugins

Move MDSAL based context listener to MDSAL based plugins.

In addition, we can remove NetconfStream class and directly initialize
ContextListener as component instead.

JIRA: NETCONF-714
Change-Id: I7217ba99076df936c892e6341925d0a5ba878526
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
2 months agoBump mina-sshd to 2.15.0 50/115750/1
Robert Varga [Wed, 5 Mar 2025 12:27:50 +0000 (13:27 +0100)]
Bump mina-sshd to 2.15.0

https://github.com/apache/mina-sshd/releases/tag/sshd-2.15.0

Change-Id: Iac2cc0ed6f29767af029ffd7211a20829ba130da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoAdd netconf.databind.Subtree 45/115645/4
Robert Varga [Tue, 25 Feb 2025 19:29:14 +0000 (20:29 +0100)]
Add netconf.databind.Subtree

This adds the basic structure of a netconf subtree filter bound to a
DatabindContext.

JIRA: NETCONF-1446
Change-Id: Ic2d952522b9bccc4c1d4353cd7255d915c511c39
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRemove deprecated constructors 37/115737/1
Robert Varga [Tue, 4 Mar 2025 13:00:21 +0000 (14:00 +0100)]
Remove deprecated constructors

ApiPath.ApiIdentifier and ApiPath.Step have deprecated constructors,
remove them.

Change-Id: Iac1841ef985738877febc4def36724e41c698088
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRemove EffectiveOperation methods 36/115736/1
Robert Varga [Tue, 4 Mar 2025 12:56:10 +0000 (13:56 +0100)]
Remove EffectiveOperation methods

isAsDefaultPermitted() and isOnElementPermitted() have been deprecated
for a long time, remove them now.

Change-Id: Id81a8b0da96fad7c03a51ea58144ee8288b0d9a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRemove unnecessary method 31/115731/1
Robert Varga [Tue, 4 Mar 2025 11:51:06 +0000 (12:51 +0100)]
Remove unnecessary method

ContentMatchNode is a record, hence we do not need the accessor method.

JIRA: NETCONF-1445
Change-Id: Ia5883905956eb46bd0ba5e44f61619ac2ab015f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoEliminate netconf/tools/ 26/115726/1
Robert Varga [Mon, 3 Mar 2025 13:07:56 +0000 (14:07 +0100)]
Eliminate netconf/tools/

Move the two utilities we have into usecase/, as these really are
specific use cases.

Change-Id: Ibc39da22da86de48c4741a7819515f2018934c57
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoBe more defensive when converting subscription id 25/115725/1
Robert Varga [Mon, 3 Mar 2025 13:05:23 +0000 (14:05 +0100)]
Be more defensive when converting subscription id

Uint32.valueOf() can throw an IAE, make sure we intercept it.

JIRA: NETCONF-714
Change-Id: I49da217e3139e2ff53d620a274c81e545a807c11
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoImplement lookupSubscription() 02/115702/1
Robert Varga [Mon, 3 Mar 2025 10:57:52 +0000 (11:57 +0100)]
Implement lookupSubscription()

This is similar to what we are doing for streams: populate on estabish,
remove when the subscription is terminated.

JIRA: NETCONF-714
Change-Id: I97641150218953dac0ef01a68aee6aab02eb0edf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoAdd AbstractRequest.principal() 97/115697/1
Robert Varga [Sun, 2 Mar 2025 21:44:49 +0000 (22:44 +0100)]
Add AbstractRequest.principal()

Require the principal to be passed down as an invariant. This codifies
what JAX-RS needs to do and what Netty has as an invariant in the
attached structure.

Change-Id: I74020f0a0824583ce604a9c9fd5665986d3f880d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoFactor out netconf.databind.Request 96/115696/1
Robert Varga [Sun, 2 Mar 2025 20:50:29 +0000 (21:50 +0100)]
Factor out netconf.databind.Request

This is the counterpart to yang.common.RpcRequest, except having a nice
tie in with RequestException as the error reporting tool.

Change-Id: Ic6c3df7351fe4c7fd3e33509d1fc5af208cc6c59
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoPromote restconf.server.api.ServerException 95/115695/2
Robert Varga [Sun, 2 Mar 2025 16:16:47 +0000 (17:16 +0100)]
Promote restconf.server.api.ServerException

Move this construct to netconf.binding.RequestException, so it can be
used outside of RESTCONF server.

Change-Id: I3e58668b83c9c70c2222385ceddb0980191a4547
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoIntroduce netconf.databind.RequestError 94/115694/1
Robert Varga [Sun, 2 Mar 2025 12:01:03 +0000 (13:01 +0100)]
Introduce netconf.databind.RequestError

Promote restconf.server.api.ServerError for reuse by all components that
use netconf.databind.

Change-Id: I631219aff53b24c31acb5ab29844493266feef05
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoMerge RestconfStreamRegistry implementations 59/115559/19
Robert Varga [Fri, 21 Feb 2025 02:18:36 +0000 (03:18 +0100)]
Merge RestconfStreamRegistry implementations

Move code around so that the RPC implements ends up calling down to
RestconfStream.Registry, which does the book-keeping.

Operational store maintenance is done via registration mechanics in
MdsalRestconfStreamRegistry.

ModifySubscriptionRpc is neutered for now, as are some tests which need
more work around assertions and setup.

JIRA: NETCONF-714
Change-Id: I665e20f9d12bb5800b3749ada0cf009a7c3b4423
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoDisconnect netconf-common-mdsal from netconf-api 92/115692/1
Robert Varga [Sun, 2 Mar 2025 07:45:09 +0000 (08:45 +0100)]
Disconnect netconf-common-mdsal from netconf-api

The only user of NormalizedDataUtil is netconf-client-mdsal, so we move
that class and all of its supports there.

This allows us to disconnect from netconf-api, improving the dependency
graph.

Change-Id: I8151460ef01439249a8ea7018c93c3af75140e18
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoFix sal-remote-impl dependencies 91/115691/1
Robert Varga [Sun, 2 Mar 2025 07:51:26 +0000 (08:51 +0100)]
Fix sal-remote-impl dependencies

We do not need netconf-dom-api, do not import it.

Change-Id: I17ef125736da011d8fa44545042248b13ac3546e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoDisconnect netconf-{common,server}-mdsal 18/115618/7
Robert Varga [Sun, 2 Mar 2025 07:31:56 +0000 (08:31 +0100)]
Disconnect netconf-{common,server}-mdsal

The only reason for netconf-server-mdsal's use of netconf-common-mdsal
is a simple ContainerNode writeout. Inline the callout and drop
the dependency.

Change-Id: I7628e17a6048b2a524c42875681d687f169ebe9f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoBump upstreams 62/115662/1
Robert Varga [Thu, 27 Feb 2025 08:37:51 +0000 (09:37 +0100)]
Bump upstreams

Use mdsal-14.0.10.

Change-Id: I999a5e337410fced0e77d2c1a14f6b962ff5fc11
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoAdd netconf.api.subtree.SubtreeFilter 96/115596/7
Robert Varga [Sun, 23 Feb 2025 02:05:28 +0000 (03:05 +0100)]
Add netconf.api.subtree.SubtreeFilter

SubtreeFilter is the object model of a RFC6241 Subtree Filter. It can be
read from and written to a org.w3c.dom.Element.

JIRA: NETCONF-1445
Change-Id: I86d471cf3eb064ef980f79af91858dfa6d247a25
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoNotify channel on KeyEstablished exception 91/115491/11
Peter Suna [Tue, 18 Feb 2025 11:16:31 +0000 (12:16 +0100)]
Notify channel on KeyEstablished exception

Call notifyTransportChannelFailed method when SshClient
failed on KeyEstablished with the IOException.

If IOException close the session and TransportChannel
is not ready, then it is necessary to call
notifyTransportChannelFailed which triggers the reconnection process.

JIRA: NETCONF-1423
Change-Id: I5aa4714a3d941b7ba6b1a26d95ea10b7af83840a
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
2 months agoNotify channel if authentication throw exception 90/115490/11
Peter Suna [Mon, 17 Feb 2025 08:16:50 +0000 (09:16 +0100)]
Notify channel if authentication throw exception

Call notifyTransportChannelFailed method when SshClient
or SshServer invokes IOException. Propagate this exception and
notifyTransportChannelFailed, which triggers the
reconnection process.

JIRA: NETCONF-1423
Change-Id: I52c775634df61e2ce1a85cdd10e6e10de4e0c695
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
2 months agoNotify transport channel on session disconnect 35/115035/7
Peter Suna [Mon, 17 Feb 2025 08:28:34 +0000 (09:28 +0100)]
Notify transport channel on session disconnect

Call notifyTransportChannelFailed method when SshClient
or SshServer invokes sessionDisconnect.
This state call the session close. If TransportChannel
is not ready, then it is necessary to call
notifyTransportChannelFailed which triggers the reconnection process.

JIRA: NETCONF-1423
Change-Id: I1b96f36e8bd6d15865a8b1a9718bb45e401898e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
2 months agoNotify transport channel on session exception 13/114513/12
Robert Varga [Fri, 22 Nov 2024 19:44:39 +0000 (20:44 +0100)]
Notify transport channel on session exception

Call notifyTransportChannelFailed method when SshClient
or SshServer invokes sessionException. Propagate exception
from the parameter and notifyTransportChannelFailed which
triggers the reconnection process.

JIRA: NETCONF-1423
Change-Id: Id4ab70c0b1f37c5a8f52c5447cefb77f4b708265
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
2 months agoNotify transport channel on session close 54/114354/32
Peter Suna [Tue, 5 Nov 2024 12:25:18 +0000 (13:25 +0100)]
Notify transport channel on session close

Call notifyTransportChannelFailed method when SshClient
or SshServer invokes sessionClosed.
If ChannelInactive close the session and TransportChannel
is not ready, then it is necessary to call
notifyTransportChannelFailed which triggers the reconnection process.

This needs to be handled here, because the NetconfClientSession
lifecycle has not started yet. The NetconfClientSession is created
in NetconfNodeHandler only when ClientTransportChannelListener is
successful. If ClientTransportChannelListener is successful and session
is closed, then ConnectingTask will never finish nor provide any
additional information.

JIRA: NETCONF-1423
Change-Id: Ief230b2d28a747628488d0dba3700fbb552d163d
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
2 months agoModernize ApiPathParser 46/115646/1
Robert Varga [Tue, 25 Feb 2025 23:24:41 +0000 (00:24 +0100)]
Modernize ApiPathParser

Two things to do here:
- use arrow switches
- eliminate the need to suppress checkstyle

Change-Id: I533f03a20d089c1e9a71033801d119cbe5d4731b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoFix subscription state notifications 04/115404/18
Samuel Schneider [Thu, 13 Feb 2025 16:09:07 +0000 (17:09 +0100)]
Fix subscription state notifications

Fix NodeIdentifiers for subscription state notifications
currently have wrong NodeIdentifier which is not recognized
by registered listener.
Also fix node structure as is not correct and EventFormatter
is not able to processes them when we are trying to publish.

JIRA: NETCONF-714
Change-Id: I41f67e76be7933c4cb65973a4e26730f2c4004bd
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
2 months agoUse "xc" instead of "op" 16/115616/9
Robert Varga [Tue, 25 Feb 2025 00:39:21 +0000 (01:39 +0100)]
Use "xc" instead of "op"

We are using a made-up prefix here, use the prefix RFC4741 uses.

Change-Id: I2442dbf6fed9fb56f3b4bd1048878d1b3b172ac3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoEncapsulate NormalizedDataUtil.XML_FACTORY 15/115615/9
Robert Varga [Tue, 25 Feb 2025 00:09:42 +0000 (01:09 +0100)]
Encapsulate NormalizedDataUtil.XML_FACTORY

NormalizedDataUtil is performing some namespace plumbing with
XMLStreamWriter. Document what is going on and why, moving the entire
chunk into XMLSupport.

Change-Id: Ifec14bfa2e04bf7c7a66bfc29c022ca38b25f7f5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoAdd netconf.api.xml.XMLSupport 14/115614/8
Robert Varga [Mon, 24 Feb 2025 22:06:37 +0000 (23:06 +0100)]
Add netconf.api.xml.XMLSupport

netconf-common-mdsal is interfacing with java.xml side of things here.
Encapsulate these in a netconf-api class.

Change-Id: I9bbc0fe736148a3455fc6c19a25441f033c8cbbe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoStrip message-id from rpc-reply 13/115613/7
Robert Varga [Tue, 25 Feb 2025 00:08:31 +0000 (01:08 +0100)]
Strip message-id from rpc-reply

We are the final processor of a NetconfMessage containg a rpc-reply:
strip message-id from it, as does not belong to YANG world.

JIRA: NETCONF-856
Change-Id: Ib8e7b9922682343a3bb28d84ce40179fe7c4dc42
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoPropagate DatabindContext to NetconfBaseOps 10/115610/7
Robert Varga [Mon, 24 Feb 2025 20:32:30 +0000 (21:32 +0100)]
Propagate DatabindContext to NetconfBaseOps

This is where Rpcs and DatabindContext meet for the first time,
providing the core anchor point where things need to be consistent.

JIRA: NETCONF-1352
Change-Id: I035c134c2c37d8c559402322a6ff9dc1d80affeb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoExpose DatabindContext.builderFactory() 11/115611/5
Robert Varga [Mon, 24 Feb 2025 20:44:59 +0000 (21:44 +0100)]
Expose DatabindContext.builderFactory()

NormalizedNode.BuilderFactory is the interface for modular injection of
builders. Expose it from the databind, showing off its versatility.

Change-Id: I82ecf1306f429433ecd5aa6aa14f1c273bfaa40e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoMock NetconfTimer 17/115617/4
Robert Varga [Tue, 25 Feb 2025 01:49:35 +0000 (02:49 +0100)]
Mock NetconfTimer

We are already mocking a ton of things here, another mock does not
matter.

Change-Id: I0d89389fbc75add2b86383cbff6359d21dbf8995
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoDo not instantiate Inference 12/115612/5
Robert Varga [Mon, 24 Feb 2025 23:49:46 +0000 (00:49 +0100)]
Do not instantiate Inference

XMLStreamWriter can resolve SchemaNodeIdentifiers, so just pass
outputPath down.

Change-Id: I9c304ed580b06ba0d6b32b30ad3fa315da724db5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoImprove DatabindContext reuse 09/115609/3
Robert Varga [Mon, 24 Feb 2025 19:50:59 +0000 (20:50 +0100)]
Improve DatabindContext reuse

Carry the DatabindContext through discovery, so when there is nothing
to do we just return it as is.

JIRA: NETCONF-1352
Change-Id: I5a9ac0254f88cc071f5bc29eb3b6aa08cda8d340
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoUse NetconfDeviceSchema in NetconfDeviceSchema 08/115608/3
Robert Varga [Mon, 24 Feb 2025 19:00:44 +0000 (20:00 +0100)]
Use NetconfDeviceSchema in NetconfDeviceSchema

We have a MountPointContext, from which we invariably end up creating a
DatabindContext. Replace it with DatabindContext an equivalent
DatabindContext.

JIRA: NETCONF-1352
Change-Id: I461d40bf4a87e5e8bca0f9595731791885c433d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoUse databind in NetconfMessageTransformer 07/115607/2
Robert Varga [Mon, 24 Feb 2025 18:50:11 +0000 (19:50 +0100)]
Use databind in NetconfMessageTransformer

Take a databind instead of a mount context, which is an indirection, but
allows us to reuse xmlCodecs across operations.

JIRA: NETCONF-1352
Change-Id: I5baa0c951b3fb92688414ee734df475031752d5c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoExpose DatabindContext from BaseNetconfSchema 06/115606/2
Robert Varga [Mon, 24 Feb 2025 18:28:20 +0000 (19:28 +0100)]
Expose DatabindContext from BaseNetconfSchema

This is the first place that comes into contact with the
EffectiveModelContext. Attach a DatabindContext to it so we can
propagate it further.

JIRA: NETCONF-1352
Change-Id: I20bfaf23847761480f265e701828a93299c28e6b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoImprove check in schemaless transformer 05/115605/2
Robert Varga [Mon, 24 Feb 2025 18:25:35 +0000 (19:25 +0100)]
Improve check in schemaless transformer

We can use an instanceof pattern to remove a cast. Throw an IAE instead
of a NPE when the payload is null.

Change-Id: I63fbd4baa0633c02b582d83f8334787d95c42fde
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoUse DatabindContext in NetconfBaseOps 04/115604/2
Robert Varga [Mon, 24 Feb 2025 17:23:15 +0000 (18:23 +0100)]
Use DatabindContext in NetconfBaseOps

Converting the entirety of netconf-client-mdsal to use DatabindContext
is going to take some time. This patch takes the first step, with many
more to follow.

JIRA: NETCONF-1352
Change-Id: I6b43ad4ec256483afced3cd695db1c1b64227fd5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoIntegrate netconf-common-mdsal with databind 00/115600/3
Robert Varga [Mon, 24 Feb 2025 16:01:13 +0000 (17:01 +0100)]
Integrate netconf-common-mdsal with databind

We have a few methods which take an EffectiveModelContext. Allow the
class to be instantiated with a DatabindContext to take the model
context from there.

JIRA: NETCONF-1352
Change-Id: Ifeec32c15ff828c6299eec28a10cb7d7966bc854
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoAdd DatabindContext.mountContext() 03/115603/1
Robert Varga [Mon, 24 Feb 2025 17:08:35 +0000 (18:08 +0100)]
Add DatabindContext.mountContext()

There are users who would like to get the backing MountPointContext,
expose it.

JIRA: NETCONF-1352
Change-Id: Ib37ffd06fd44af207a1c6d99e4e6f5019cdc8910
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoDo not use deprecate URL constructor 02/115602/1
Robert Varga [Mon, 24 Feb 2025 16:46:00 +0000 (17:46 +0100)]
Do not use deprecate URL constructor

Migrate to going through URI.toURL().

Change-Id: I7d0afbd24f9e48639cc7ef70212b764ce36b3045
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoClean up NormalizedDataUtil 99/115599/2
Robert Varga [Mon, 24 Feb 2025 15:57:51 +0000 (16:57 +0100)]
Clean up NormalizedDataUtil

Encapsulate most methods, so we do not shortcut to them. These will be
helpful when we integrate databind.

Change-Id: I3bda313849ea5c7788a9d16773dd800acc4b7328
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoIntroduce notification DatabindPaths 95/115595/3
Robert Varga [Mon, 24 Feb 2025 09:55:26 +0000 (10:55 +0100)]
Introduce notification DatabindPaths

DatabindPath needs to cover also RFC6020 and RFC7950 notifications, so
we can efficiently reuse all the mechanics we have around it.

JIRA: NETCONF-714
Change-Id: Ic243b4fe248f2fca116ded8d3e3b32d3880ac664
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoFixup DatabindContext javadoc warnings 98/115598/2
Robert Varga [Mon, 24 Feb 2025 14:48:47 +0000 (15:48 +0100)]
Fixup DatabindContext javadoc warnings

Add missing javadocs to silence the warnings.

Change-Id: Ifb3a92d1d89611b143d4a9cc6b09b46f90fd1c2c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoUse ChoiceNode in EstablishSubscriptionRpc 67/115567/8
Robert Varga [Fri, 21 Feb 2025 13:13:35 +0000 (14:13 +0100)]
Use ChoiceNode in EstablishSubscriptionRpc

The data coming in has been validated and therefore we can rely on
things being ChoiceNode rather than a generic DataNodeContainer.

This flushes out the fact the UT data does not actually match the
expected models, hence we fix that up.

JIRA: NETCONF-714
Change-Id: I62195d70b3720d368912ef0e41a4a652671c33d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRemove redundant String#format call 94/115594/3
Ivan Hrasko [Mon, 24 Feb 2025 12:07:11 +0000 (13:07 +0100)]
Remove redundant String#format call

Remove redundant calls of String#format method
in NotificationSubscriptionTest class.

Fix formatting of inputs to use 2 spaces as indent as well.

JIRA: NETCONF-714
Change-Id: I7aa5a92bbe208b1356925adf568d7d3cb1d8776f
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
2 months agoPromote ServerErrorInfo 85/115585/4
Robert Varga [Mon, 24 Feb 2025 00:13:56 +0000 (01:13 +0100)]
Promote ServerErrorInfo

This needs further co-evolution with its netconf-api counterpart, move
it to databind for proper definition, now called
netconf.databind.ErrorInfo.

Change-Id: I750c71882127e4763ac446fc2e11acbda130ca07
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoCreate Subscribed-notifications tests 46/114946/42
Yaroslav Lastivka [Mon, 20 Jan 2025 15:10:14 +0000 (17:10 +0200)]
Create Subscribed-notifications tests

Added tests for establishing, modifying, deleting,
and killing subscriptions.Included validation tests
for missing fields and invalid inputs.

JIRA: NETCONF-714
Change-Id: Ie4cc6d27f39dcca3f61bdd5e47613c29a56a6533
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>