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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Oleksandr Zharov [Thu, 16 Jan 2025 09:42:38 +0000 (10:42 +0100)]
Setup infrastructure for E2E subscription tests
Added abstract base for subscription notifications tests.
Here we make a setup for controller and client used during
followup subscriptions testing.
JIRA: NETCONF-714
Change-Id: I9e022be40af56315e665616b73918236def62893
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Robert Varga [Sun, 23 Feb 2025 18:15:30 +0000 (19:15 +0100)]
Introduce NetconfServerStrategy
Now that we have DatabindContext available, we can make it the base of
our data binding state to an EffectiveModelContext.
A NetconfServerStrategy is a combination of DatabindContext and
capabilities derived from its EffectiveModelContext -- resulting in
proper caching of computed capabilities and better code locality.
All users of CurrentSchemaContext.getCurrentContext() can be migrated to
DatabindProvider.currentDatabind(), so we do that as well, improving
modularity.
This leads to lower need to mock and allows us to move the extension
wiring to be something internal to CurrentSchemaContext.
Change-Id: Ie43fd18e9ba8432627423d0c0adc4f0d551daf55
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 23 Feb 2025 15:11:13 +0000 (16:11 +0100)]
Split out protocol/databind
Placing DatabindContext in netconf-common ties it to netconf-api, which
is not something we want.
Split it out into a separate artifact, adjusting users and tidying up
documentation a bit.
While we are at it, remove netconf.common.util, as it hosts just one
utility class.
Change-Id: Idfb0f68838e3992be070883a010e07d52baa31c4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 23 Feb 2025 03:04:25 +0000 (04:04 +0100)]
Promote DatabindPath/ServerErrorPath
DatabindPath is a very useful construct, as it provides the context in
which a YANG databind operation is performed. Promote it to
netconf-common for wider reuse.
ServerErrorPath is a common modeling construct similar to ErrorMessage:
it is shared between NETCONF and RESTCONF as the value of error-path
element. Promote it as o.o.netconf.common.ErrorPath.
Change-Id: I279ef4b64f471d43f573e1825dbc38a37fe81f87
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 23 Feb 2025 02:45:20 +0000 (03:45 +0100)]
Promote Databind{Context,Provider}
DatabindContext provides a number of YANG/NormalizedNode conveniences
which we could use across the project. Move it to netconf-common for
wider accessibility.
DatabindProvider is a simplistic interface, which we take along for the
ride from restconf-server-spi.
Change-Id: I47dfc6b3ca681ddcdd649ac732b9f56adcc39663
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 23 Feb 2025 12:12:30 +0000 (13:12 +0100)]
Convert sal-remote-impl to JPMS module
Make sure the model has an Automatic-Module-Name and convert the
implementation to a JPMS module, based on bnd-parent.
Change-Id: I9c4cf503e3c046aea169f0d8aca5413b1ed8672b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 23 Feb 2025 02:17:06 +0000 (03:17 +0100)]
Promote ErrorMessage to o.o.netconf.common
This is a construct shared between both NETCONF and RESTCONF. Move it to
a common place.
Change-Id: Ifec1b31d2bb45c342ef021af44ff4fa20e3a03ff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 23 Feb 2025 04:46:32 +0000 (05:46 +0100)]
Clean up netconf-common
Convert to bnd-parent and clean up exports.
Change-Id: Idbe5713cfd180e5cc6e19476a5a104245ef17393
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 23 Feb 2025 02:32:36 +0000 (03:32 +0100)]
Disconnect DatabindContext from ServerException
There is a single utility method which is throwing ServerException. Move
the method to RequestBody and adjust it to work on DatabindPath.
Change-Id: I871ef13474a130c31da00895229da7feed50b88b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 23 Feb 2025 03:14:07 +0000 (04:14 +0100)]
Fix restconf-notifications-mdsal dependencies
javax.inject should be optional, always.
Change-Id: I092deb36ca71c74f01fa0fd125ae312b964330ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 23 Feb 2025 02:10:38 +0000 (03:10 +0100)]
Do not use java.net.URI in restconf.api.query
We are using URI for capability constants, which are not used. Remove
them.
Change-Id: I635729065b06e6f1a471435df81d80d6f1aa72e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 21 Feb 2025 17:28:38 +0000 (18:28 +0100)]
Eliminate restconf-server-spi test-jar
The test-jar is doing bad things with JPMS, move the single class and
its resources to restconf-server-api-testlib.
Change-Id: I599ca2b80147fb03d0893acd0ab16ffe1691bcbe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 21 Feb 2025 06:20:57 +0000 (07:20 +0100)]
Improve SubscriptionStateMachine
Internal map may be accessed concurrently, so this patch switches to
ConcurrentHashMap, in order to avoid CMEs.
We dust off SessionStatePair and turn it into a useful object,
expressing state transition rules via switch expressions -- which allow
us to explicitly document all of them. This also fixes a NPE, if one
were trying to move from END to something else.
We also make moveTo() an atomic transition via Map.computeIfPresent()
calls to SessionStatePair.withNewState(), which improves performance by
performing only a single lookup.
Finally we from the 'get' prefix in favor of lookup(), documenting the
fact these methods can legally return null.
JIRA: NETCONF-714
Change-Id: I202d16086b8ba3b2a5ad2aad07d991c5f09026f3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>