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>
Robert Varga [Fri, 21 Feb 2025 12:27:58 +0000 (13:27 +0100)]
Split out restconf-server-api-testlib
The use of test-jar is rather ugly, as we cannot control package a
proper module-info specific to tests. This leads to server.api being
exposed from its module, but also from the unnamed-module.
Split out the small library we have into a separate artifact, which
solves these problems.
Change-Id: I59d21cd779a216911418807e0d9c31bf0558032f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 21 Feb 2025 12:30:41 +0000 (13:30 +0100)]
Fix a raw type
We have a needlessly-raw mock here. Fix it up.
Change-Id: Ibd94f4fd99a40556595e4635e0a33c1c2338a7cf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Yaroslav Lastivka [Fri, 14 Feb 2025 13:38:34 +0000 (15:38 +0200)]
Solve parsing issue in EstablishSubscriptionRpc
The encoding and stop time are no longer set in the
subscriptionBuilder as they will not be used in the future.
Retrieves `stop-time` as a `String` instead of
`DateAndTime`, avoiding unnecessary type conversion.
Retrieves `encoding` as a `Qname` instead of `Encoding`.
JIRA: NETCONF-714
Change-Id: If0c1bdb39e1bdb82599e7725901aed1423ac3e0a
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Yaroslav Lastivka [Tue, 11 Feb 2025 09:10:04 +0000 (11:10 +0200)]
Improve stream existence check
Replace use of MdsalNotificationService#exist with
RestconfStreamRegistry#lookupStream which works faster
as it cheks the registered stream in a Map.
JIRA: NETCONF-1437
Change-Id: I2d71de7c06fba5623b890f90002d33926e92047c
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Robert Varga [Tue, 18 Feb 2025 17:25:24 +0000 (18:25 +0100)]
Document subscriptionIdCounter
The counter has non-obvious initial value. Document why and add a FIXME
to move the allocate elsewhere.
This also fixes a problem where the counter would overflow and all
requests would start throwing IAE.
JIRA: NETCONF-714
Change-Id: If6427508ac708c1d4c8f8575d9e6ad059512a5e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 19 Feb 2025 10:23:23 +0000 (11:23 +0100)]
Intern {ID,REASON}_NODEID
Intern derived QName, so we not have duplicates.
JIRA: NETCONF-714
Change-Id: Ib45eec26e5bb6d83831f1ca50985d798fead32ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 19 Feb 2025 03:32:00 +0000 (04:32 +0100)]
Clean up restconf-subscription
This should be a proper JPMS module, packaged via bnd-plugin. Also hide
tests, so they do not interfere.
JIRA: NETCONF-714
Change-Id: Ie987c3221e86a86c2a1b0724b4f6433ac6ff90eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 18 Feb 2025 17:28:45 +0000 (18:28 +0100)]
Access session/principal only once
Be nice to static analysis: we check this for null, hence we should have
it in a local variable.
JIRA: NETCONF-714
Change-Id: I8032ed8d075146392cbf0b10db9085376ec0cf6d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 18 Feb 2025 17:32:13 +0000 (18:32 +0100)]
Correct builder flow
Do not split static method invocation and properly format builder fluent
flow.
JIRA: NETCONF-714
Change-Id: I0eb2e13bdf333d0f0bfc0cf8a2913a98cff58ae8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 19 Feb 2025 02:27:27 +0000 (03:27 +0100)]
Clean up SubscriptionStateService
SubscriptionStateService should be referencing YANG-modeled entities and
generally operate with NormalizedNode/DOMNotification assumptions.
Depend on the rfc8650 model and pick up the constructs we need from
there.
JIRA: NETCONF-714
Change-Id: Id61f0c3aac7e4b77a3f2c867721f7d956c1c27e4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 19 Feb 2025 00:39:05 +0000 (01:39 +0100)]
Clean up features
Factoring things out has moved our dependencies a bit, making
odl-netconf-util and odl-netconf-ssh dead features.
This renames odl-netconf-util to odl-netconf-mdsal-common, carrying a
dependency on mdsal-dom-api. We package netconf-mdsal-common and
netconf-dom-api here.
We then drop netconf-auth from odl-netconf-api, as it really is a thing
specific to the auth plugin.
JIRA: NETCONF-714
Change-Id: I3267a73ee8e8f8c32a9764a6a642aa17264b6fa0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 18 Feb 2025 23:37:10 +0000 (00:37 +0100)]
Add netconf.common.mdsal.DOMNotificationEvent
The contract of NetconfMessageTransformer.NetconfDeviceNotification is
useful across plugins/*.
Promote it as DOMNotificationEvent, coming in two flavors:
- Rfc6020, i.e. top-level notifications
- Rfc7950, i.e. instance notifications
JIRA: NETCONF-714
Change-Id: I5ef7163bddc8c3b959d8299a0c0f2378f7f50494
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 18 Feb 2025 23:15:07 +0000 (00:15 +0100)]
Clean up DefaultSslContextFactoryProviderTest
SecurityHelper.decodeCertificate() is a static method, use it as such.
Change-Id: Iad41f9e9ad41e156607f4c82cc4704417eeb7ae3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 18 Feb 2025 23:13:58 +0000 (00:13 +0100)]
Remove unneeded suppression
This @SuppressWarnings is flagged as unnecessary, remove it.
Change-Id: I652cd68a6534dfc7d0505ea2babecec124f476c4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 18 Feb 2025 22:15:59 +0000 (23:15 +0100)]
Modernize netconf-common-mdsal
Turn this into a bnd-based JPMS module, improving the contract and
usability.
Change-Id: I4d182b8116d338f1db9d3387865e87598dd6a029
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 18 Feb 2025 15:15:33 +0000 (16:15 +0100)]
Enforce dependencies for all bnd-parent users
Default to enforcing dependecies, so that modern bundles have always
up-to-date dependencies by default.
Change-Id: Idb156b4c869efffad6335b860405a0e0077df238
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Peter Suna [Thu, 13 Feb 2025 11:49:30 +0000 (12:49 +0100)]
Fix exception handling order in decodeException
The order of exception checks was reversed, causing
NetconfDocumentedException to be caught by the parent
DocumentedException handler.
This commit swaps the order to ensure NetconfDocumentedException
is handled when it occurs.
JIRA: NETCONF-1197
Change-Id: I292f6285a513a9211cc5fb35019489e57e6de628
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Ivan Hrasko [Mon, 4 Nov 2024 13:54:42 +0000 (14:54 +0100)]
Add subscription resource
Add web resource providing possibility to stream
subscribed notifications over SSE at:
<server>:<port>/subscriptions/<subscription-id>
JIRA: NETCONF-714
Change-Id: I8667266afae97e7efa6e08ea888a681d60eee769
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Oleksandr Zharov [Thu, 13 Feb 2025 08:49:46 +0000 (09:49 +0100)]
Split StateMachine test
Split StateMachine test into two - positive and negative.
JIRA: NETCONF-714
Change-Id: Iee42e848380998c49b178e1390fb40d4068b0699
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Oleksandr Zharov [Thu, 13 Feb 2025 08:38:38 +0000 (09:38 +0100)]
Get subscription without dealing with exceptions
Refactored get methods for subscription state and session
to not throw exceptions if subscription wasn't found.
JIRA: NETCONF-714
Change-Id: I82fd63c41716a6729d2e8bb28ebe7476c13d0cfc
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Oleksandr Zharov [Thu, 13 Feb 2025 08:21:01 +0000 (09:21 +0100)]
Fix String#format usage
Fixed wrong usage of String#format.
JIRA: NETCONF-714
Change-Id: I2926ffd15297d56352fc02c7e1b503c1bff12c33
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Yaroslav Lastivka [Fri, 14 Feb 2025 08:09:23 +0000 (10:09 +0200)]
Update user-guide for notification subscriptions
Aligned the user guide with the current YANG notification subscription
logic, updating steps and examples for accuracy.
JIRA: NETCONF-714
Change-Id: I7c05e6bfa0c23a5bb02a5298b44db3ec8ab604cc
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Yaroslav Lastivka [Tue, 11 Feb 2025 20:18:22 +0000 (22:18 +0200)]
Replace File(String) with Paths.get(String)
Updated BenchmarkOpenApiIT and MountPointE2ETest
to use Paths.get(String).toFile() instead of new File(String),
aligning with modern Java NIO best practices.
Change-Id: I1be86eacd2392ae52f01286fe742e1e88df96cfa
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Robert Varga [Tue, 11 Feb 2025 23:12:32 +0000 (00:12 +0100)]
Bump infrautils to 7.1.1
Pick up improvements from upstream.
Change-Id: Ib88e770872bf17fa94ffb21efcaaddc6d2924bb7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Ivan Hrasko [Tue, 11 Feb 2025 12:26:14 +0000 (13:26 +0100)]
Revert "Fix testtool request failure to netty endpoint"
The issue NETCONF-1378 has been fixed. Now we can remove workaround
introduced in NETCONF-1376.
This reverts commit
760ac1687d5467fa05d739e3c5221ced376a518c.
Change-Id: I27686166a14feca3cab9e8dd15f33d5fe05e809b
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Robert Varga [Tue, 11 Feb 2025 10:31:20 +0000 (11:31 +0100)]
Use odl-codegen-extensions
yang-ext has a number of different extensions. Use
odl-codegen-extensions, which is focused on just codegen support.
Change-Id: I72a2b70acab4aeb509d4e126abfdf8cade10e42c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 10 Feb 2025 17:26:44 +0000 (18:26 +0100)]
Modernize netconf-testtool
- Runtime.exec(String) is deprected since Java 18, migrate ScaleUtil
and mark a FIXME for follow-up cleanup
- use HashMap.newHashMap(int) instead Maps
- use Path.of() for path manipulation
- ditch Preconditions.checkState() in favor of a simple check and throws
Change-Id: Id0dde8dcb0bf06271d7f896e1df8925d85d3a575
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 10 Feb 2025 16:43:38 +0000 (17:43 +0100)]
Use Path.of() in MountPointEndToEndTest
This is the sole violation reported by modernizer: fix it.
Change-Id: Idef9e644cefc402961156ea374bc0b4eebe90b1c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 10 Feb 2025 16:38:32 +0000 (17:38 +0100)]
Eliminate TestUtils
Inline methods into their sole user. Duplicate TEST_ENTRIES, as they are
very simple.
Change-Id: I1c6311809ddc21568577c2add85844a40ad4b9eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 10 Feb 2025 16:34:25 +0000 (17:34 +0100)]
Modernize keystore-plaintext-localfile
Use java.nio.file.Path instead of File, fixing modernizer warnings.
Change-Id: Ia17d4d5abcac6a78b8e52d300b2a5aff1dad4136
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 10 Feb 2025 16:18:55 +0000 (17:18 +0100)]
Modernize netconf-client-mdsal
Use HashMap.newHashMap() and Path.of(), as noted by modernizer.
Change-Id: I596876103dcd5eb2157b9be0cb1b6ea8f0c1afc0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 10 Feb 2025 16:04:16 +0000 (17:04 +0100)]
Modernize keystore-legacy
Use HashMap.newHashMap() instead of Maps.newHashMapWithExpectedSize.
Change-Id: Ib6ad7a3c678e7ed0bddcc429da677fa9b769acf9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 10 Feb 2025 13:39:38 +0000 (14:39 +0100)]
Fix odl-restconf-notification
This feature ends up pulling in an MD-SAL bundle, use the proper feature
for that.
JIRA: NETCONF-714
Change-Id: Ieb5caa2f7d52036bdf845c1705ddaf6994cae17a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Ivan Hrasko [Mon, 10 Feb 2025 10:30:20 +0000 (11:30 +0100)]
Refactor RestconfStream.Registry usage
- remove redundant parameters of RestconfStream.Registry
- remove redundant fields which are only hiding local parameter usage
- improve nullability checks
JIRA: NETCONF-714
Change-Id: I113ee3d0f730ea536c5ad43a59106e837e0a47b2
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Robert Varga [Mon, 10 Feb 2025 13:44:00 +0000 (14:44 +0100)]
Use odl-mdsal-model-rfc7407-ietf-x509-cert-to-name
We are using a raw bundle in odl-netconf-impl. Fix that by referencing
odl-mdsal-model-rfc7407-ietf-x509-cert-to-name, which is its upstream
packaging.
Change-Id: I62a5497c68719b83e4d4450bba7326c660ddc31e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 10 Feb 2025 10:59:50 +0000 (11:59 +0100)]
Modernize netconf-server-mdsal
Use Path.of() instead of Paths.get() and similar conversions.
Change-Id: I490e0565973e0be7c165572cb9c2b983395bd8b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 10 Feb 2025 10:54:46 +0000 (11:54 +0100)]
Modernize NetconfCapabilityMonitoringService
Use HashMap.newHashMap() to allocate the map.
Change-Id: Ideb22393f639c69a0da591435ea5932278f66378
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 10 Feb 2025 10:52:05 +0000 (11:52 +0100)]
Modernize PathNode
Use LinkedHashMap.newLinkedHashMap().
Change-Id: I62230d947f38486b0842a49db464d79292620c71
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 10 Feb 2025 10:44:13 +0000 (11:44 +0100)]
Modernize NetconfMessageFactoryTest
Use nio for resolve paths.
Change-Id: Idbf903da7bb379e320aa6e38559142d6e012e52e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 10 Feb 2025 10:39:23 +0000 (11:39 +0100)]
Modernize XmlUtil
Add readXmlToElement(Path) and use NIO Files.newInputStream().
Change-Id: I8175aedafb601954370dd8665a93c851f10b39bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 10 Feb 2025 07:42:27 +0000 (08:42 +0100)]
Bump upstreams
Adopt:
- odlparent-14.0.7
- infrautils-7.1.0
- yangtools-14.0.9
- mdsal-14.0.9
Change-Id: I09074ce7ce91c80c13e197fdd929c29bd1fefa15
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 10 Feb 2025 11:15:29 +0000 (12:15 +0100)]
Add modernizer suppressions
We have some plugin crosstalk from upstreams, let's disable modernizer
where needed.
Change-Id: I48138bffff7de1a92bb08e6c2436bf579608c110
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Samuel Schneider [Mon, 27 Jan 2025 08:14:09 +0000 (09:14 +0100)]
Create Listener to Sender interface
Fully switch to refactored restconf-server SSE support.
Remove old unused logic.
For this create SSEResponse to manage SSE connection.
JIRA: NETCONF-714
Change-Id: I287bee2b2863837ea94e54d1b14e9ac9f813401b
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Matej Sramcik [Wed, 22 Jan 2025 11:06:46 +0000 (12:06 +0100)]
Complete ChannelSender
Finish FIXMEs in Channel Sender to allow HTTP1.
JIRA: NETCONF-714
Change-Id: I80574f08e47ecc9d71c48732bb34ab41662f8c6b
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
Ivan Hrasko [Wed, 20 Nov 2024 14:27:45 +0000 (15:27 +0100)]
Add StreamsResource
Instead of registering ServerSseHandler into Netty's pipeline
as handler of all "text/event-stream" GET requests create
dedicated resource to server /streams path.
JIRA: NETCONF-714
Change-Id: I7218062a105516fa5fab71f9219159be14971701
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Robert Varga [Sun, 9 Feb 2025 02:31:16 +0000 (03:31 +0100)]
Split out usecases/
We have two packaging use cases, for which we want to test. The library
of tests is yet to be defined. Use cases may also expand.
The idea of this directory the cartesian product of (packaging x IT),
such that we have a broad integration test coverage.
Change-Id: Iafc0f3a834e7786f23b3fcba31b12b3086b41118
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Matej Sramcik [Wed, 29 Jan 2025 14:00:54 +0000 (15:00 +0100)]
Rework SubscriptionStateServiceTest
SubscriptionStateServiceTest class improved by making it parametrized
to reduce duplicate code.
JIRA: NETCONF-714
Change-Id: Id5eb5124e4f0db6fab770da5983d00b9458fbfa9
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>