netconf.git
7 months agoMove AbstractNetconfDispatcher 06/108606/4
Robert Varga [Mon, 23 Oct 2023 22:18:30 +0000 (00:18 +0200)]
Move AbstractNetconfDispatcher

We no longer have a NetconfServerDispatcher, hence this abstract
base class is purely a client-side thing.

JIRA: NETCONF-1106
Change-Id: I6c7c5bfaa15ee88339ab1c98535e566a5e4ca440
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoEliminate ServerChannelInitializer 02/108602/8
Robert Varga [Mon, 23 Oct 2023 18:36:21 +0000 (20:36 +0200)]
Eliminate ServerChannelInitializer

We are always wrapping ServerChannelInitializer in a
ServerTransportInitializer. The server-side of NETCONF protocol has been
completely converted to transport-api and we can therefore simplify
things by inlining initialization logic into ServerTransportInitializer.

JIRA: NETCONF-1106
Change-Id: I848eb3d66aff2988ca6a0df840f5904f13916036
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDitch unused netconf-nb dependency 99/108599/9
Robert Varga [Mon, 23 Oct 2023 16:49:40 +0000 (18:49 +0200)]
Ditch unused netconf-nb dependency

We do not need the entire netconf-nb, as we are not using anything from
it. Ditch the dependency.

JIRA: NETCONF-1106
Change-Id: Id9ea79af282f6bd0bca8070eb17e5c063bdbba21
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDo not use NetconfServerFactory in NetconfDeviceSimulator 98/108598/9
Robert Varga [Mon, 23 Oct 2023 16:40:31 +0000 (18:40 +0200)]
Do not use NetconfServerFactory in NetconfDeviceSimulator

NetconfServerFactory provides only a trivial wrapper around
transport-{tcp,ssh}. Bypassing it allows us to share one instance of
ServerTransportInitializer, improving efficiency and reducing
indirections.

JIRA: NETCONF-1106
Change-Id: I653654b3392ca63473c8cd3a1278317c69af8d96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRemove NetconfSessionNegotiatorFactory 03/108603/7
Robert Varga [Mon, 23 Oct 2023 18:48:30 +0000 (20:48 +0200)]
Remove NetconfSessionNegotiatorFactory

This interface is a useless abstraction, as the server-side completely
ignores one of its arguments. Eliminate it, allowing both sides to do
precisely what suites them.

JIRA: NETCONF-590
Change-Id: I9fc2674a13622f3de7951463c462496b23cb3f4f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoUse ConcurrentHashMap in TesttoolNegotiationFactory 04/108604/2
Robert Varga [Mon, 23 Oct 2023 19:26:41 +0000 (21:26 +0200)]
Use ConcurrentHashMap in TesttoolNegotiationFactory

TesttoolNegotiationFactory is used by a shared initializer, hence it
could be called from multiple threads concurrently. Use ConcurrentMap to
populate operation caches.

Change-Id: I44292dcd3635c1e508058caa988a99f94d83bdc7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoCentralize NETCONF over SSH subsystem name 00/108600/4
Robert Varga [Mon, 23 Oct 2023 17:12:24 +0000 (19:12 +0200)]
Centralize NETCONF over SSH subsystem name

We have quite a few places which hard-code the "netconf" string.
Centralize them in TransportConstants along with pointer to where it is
defined.

JIRA: NETCONF-1106
JIRA: NETCONF-1108
Change-Id: Ifc273c084a59f52c37c7d123de7256f682d5a0d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoOpenApi: Fix 'min-elements' for XML Leaf-List 94/108394/7
lubos-cicut [Fri, 13 Oct 2023 12:21:56 +0000 (14:21 +0200)]
OpenApi: Fix 'min-elements' for XML Leaf-List

Manually set examples with the expected number of elements in the
leaf-list, rather than relying on OpenAPI to duplicate them for us.

JIRA: NETCONF-1171
Change-Id: I883c92a396f88c610067861dc1e31bdd8dfcceb3
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoRefactor FramingMechanismHandlerFactory 01/108601/4
Robert Varga [Mon, 23 Oct 2023 18:00:01 +0000 (20:00 +0200)]
Refactor FramingMechanismHandlerFactory

Rename FramingMechanismHandlerFactory to FramingMechanismEncoder and
make it act as abstract superclass to encoders. Also rename
createHandler() to simple of().

Furthermore update users to directly pick encoders, as these are always
compile-time constants.

Change-Id: Idc54c4ccbb3e3706a5f283f966826c5a4997e95d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up validateBaseCapabilities() a bit 97/108597/3
Robert Varga [Mon, 23 Oct 2023 16:09:56 +0000 (18:09 +0200)]
Clean up validateBaseCapabilities() a bit

Use builder fluently and use local variable type inference.

JIRA: NETCONF-1106
Change-Id: Ifae0e83171d89a20735c080103c2e0fb80b10820
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoInline getListener() 96/108596/2
Robert Varga [Mon, 23 Oct 2023 16:07:03 +0000 (18:07 +0200)]
Inline getListener()

This should be called newListener(), as that is what it does, but since
it has only a single caller, inline it there.

JIRA: NETCONF-1106
Change-Id: I02166cf3b5ee7278f3b24dd0dfd1edf9295e2e1d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoFix module's root POST request payload 06/108306/6
Oleksandr Zharov [Tue, 10 Oct 2023 10:24:18 +0000 (12:24 +0200)]
Fix module's root POST request payload

Removed “processModule” method from DefinitionGenerator class.
This method is invoked only when a specific single model is requested
directly and generated POST request had an incorrect payload.

Fixed “addRootPostLink” method to correct POST payload containing
the first container/list child.
Adapted affected unit tests.

JIRA: NETCONF-1179
Change-Id: Ic10280770cfceedc2c9c5099cdbdab14cdc28ad6
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoSkip POST for nodes without container/list child 75/108275/8
Samuel Schneider [Fri, 6 Oct 2023 15:23:43 +0000 (17:23 +0200)]
Skip POST for nodes without container/list child

Remove generation of post operations for nodes that does
not have at least one container/list child.

Current implementation generates the wrong payload for JSON
and XML POST requests with leafs or leaf-list in the payload.

With this solution, we can avoid the need to check how many
leaves are in the container and what to do if more of them
are mandatory.

JIRA: NETCONF-1164, NETCONF-1165
Change-Id: I6268ab118fd0cb5092d4b959660855035394e436
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoClean up RestconfError 78/108578/3
Robert Varga [Fri, 20 Oct 2023 17:42:25 +0000 (19:42 +0200)]
Clean up RestconfError

Update documentation and clean up conversion bits from RpcError.

JIRA: NETCONF-1188
Change-Id: I446dd8e4c14473241838c95b5220aa7ec2253efd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRemove RestconfDocumentedException.throwIf() 38/108538/6
Robert Varga [Fri, 20 Oct 2023 13:07:46 +0000 (15:07 +0200)]
Remove RestconfDocumentedException.throwIf()

These convenience methods are not overly convenient, as they are used
only in a few places. Replace them with explicit throws in our quest to
simplify RestconfDocumentedException.

JIRA: NETCONF-1188
Change-Id: I6fe188a134887e4e387800e2abecbaf4a10da502
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMove ErrorTags 37/108537/3
Robert Varga [Fri, 20 Oct 2023 12:44:02 +0000 (14:44 +0200)]
Move ErrorTags

ErrorTags is primarily a JAX-RS mapping utility, move it to restconf-nb
to hide it from the outside world.

JIRA: NETCONF-773
Change-Id: I3fc5f4022da40a8fc536a7e9d6ec965344c1223f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRemove RestconfDocumentedException.decodeAndThrow() 35/108535/3
Robert Varga [Fri, 20 Oct 2023 12:16:05 +0000 (14:16 +0200)]
Remove RestconfDocumentedException.decodeAndThrow()

This method is not used anywhere, remove it as it binds strongly to
ErrorTags, which are a JAX-RS mapping thing (mostly).

JIRA: NETCONF-1188
Change-Id: I08f0faa8858f4835f843b3b5b4f80de1bb10fa3c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMove JAX-RS patch providers 40/107840/5
Robert Varga [Tue, 12 Sep 2023 17:12:43 +0000 (19:12 +0200)]
Move JAX-RS patch providers

The package structure here is ugly -- just use the baseline package.

JIRA: NETCONF-773
Change-Id: Idfef7854ec523f5c3e0035cfe56bce5a8c7c13b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRemove RestconfDocumentedException.status 34/108534/1
Robert Varga [Fri, 20 Oct 2023 10:44:40 +0000 (12:44 +0200)]
Remove RestconfDocumentedException.status

The actual status is derived from the errors reported, which now have to
have at least one element. RestconfDocumentedExceptionMapper is taught
to just infer the status.

JIRA: NETCONF-1188
Change-Id: I90b367a8fa1bf995e3d47d8b9f581a29f76eb2f2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRestconfDocumentException is a RuntimeException 14/108514/2
Robert Varga [Thu, 19 Oct 2023 09:31:45 +0000 (11:31 +0200)]
RestconfDocumentException is a RuntimeException

Disconnect from WebApplicationException to reduce dependencies on
JAX-RS.

JIRA: NETCONF-1188
Change-Id: I6c7e7cd7c390ad2502e1aa79ed0496b37d68d315
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoPartially revert "Fix incorrect operational state of device configuration" 07/108507/3
Robert Varga [Wed, 18 Oct 2023 17:19:15 +0000 (19:19 +0200)]
Partially revert "Fix incorrect operational state of device configuration"

NetconfNodeHandler must always have a correct configuration. Users must
be prepared with the fallout of supplying incorrect configuration.

This restores previous behaviour and documents existing behaviour,
repurposing tests introduced in the reverted patch.

JIRA: NETCONF-1114
Change-Id: Iccb501321957a41cac115d70c0da9799fe62d1bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRemove synchronization locking 08/105808/7
Samuel Schneider [Wed, 18 Oct 2023 12:16:43 +0000 (14:16 +0200)]
Remove synchronization locking

All sal-restconf-docgen API methods were synchronized
due to bug causing thread access to the SchemaContext
be not synchronized properly. The bug should be no longer
present as SchemaContext is declared to be safe for usage
in multi threaded environment.

JIRA: NETCONF-1049
Change-Id: I86818ee3c93f68f4a5f5bbd8d8fb6e8f6a8ee21c
Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
7 months agoUpdate port in NETCONF user guide 15/108515/2
Matej Sramcik [Wed, 18 Oct 2023 12:16:16 +0000 (14:16 +0200)]
Update port in NETCONF user guide

Update NETCONF user guide call-home section with
currently being used listening port 4334.

JIRA: NETCONF-1184
Change-Id: If3390aab4e028fd6e18c377d668692807828024d
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
7 months agoReplace whitelist with allowlist 16/108516/2
Matej Sramcik [Thu, 19 Oct 2023 08:08:12 +0000 (10:08 +0200)]
Replace whitelist with allowlist

Replaced all usages of whitelist as its considered non-technical term
with allowlist.

JIRA: NETCONF-1185
Change-Id: Id6f827ae1b1fb4c2c3e52e69ec2c60ab3c19b25d
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
7 months agoDeprecate CallHomeMountDispatcher.createClient() 10/108510/2
Robert Varga [Wed, 18 Oct 2023 21:42:46 +0000 (23:42 +0200)]
Deprecate CallHomeMountDispatcher.createClient()

This an override of a deprecated method, mark it as such to highlight
explicit references.

JIRA: NETCONF-1108
Change-Id: I6aeda7f5303186c80fb99f0319c2d8281e39d5a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up NetconfTopologyImpl(Test) 09/108509/5
Robert Varga [Wed, 18 Oct 2023 21:26:31 +0000 (23:26 +0200)]
Clean up NetconfTopologyImpl(Test)

Improve dispatch of changes and eliminate useless mucking with
yang-binding internals.

We also migrate to JUnit and simplify mocking, eliminating a number
of warnings in the process of doing so.

Change-Id: I0357cf2f728e456918b036ff384da9cd226b6291
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRefactor BaseNetconfSchemas 11/108511/2
Robert Varga [Wed, 18 Oct 2023 22:51:48 +0000 (00:51 +0200)]
Refactor BaseNetconfSchemas

Make the interface record-friendly and make the default implementation a
record. Also clean up surrounding test code.

Change-Id: Ib6c1bbc5e3bbcd0d2da6b6f84fc645a75de16a34
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoAdd option to get device context in ExceptionMapper 74/107874/13
Peter Suna [Mon, 11 Sep 2023 13:54:21 +0000 (15:54 +0200)]
Add option to get device context in ExceptionMapper

To correctly emit device error-path, it is required
to have the device context in the mapper provided by
RestconfDocumentedException.

JIRA: NETCONF-1130
Change-Id: I0050391f349485e5909359e2f23df46111d92546
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMigrate SchemalessRpcStructureTransformerTest to xmlunit-core 97/108497/1
Robert Varga [Wed, 18 Oct 2023 10:04:05 +0000 (12:04 +0200)]
Migrate SchemalessRpcStructureTransformerTest to xmlunit-core

This test has simple assertions, reduce our reliability on legacy
components.

Change-Id: I9e22e917b03934609cb63e38e8b6c9f5e5c93654
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMigrate FieldsSchemalessRpcStructureTransformerTest 96/108496/1
Robert Varga [Wed, 18 Oct 2023 09:51:52 +0000 (11:51 +0200)]
Migrate FieldsSchemalessRpcStructureTransformerTest

Migrate tu xmlunit-code and JUnit5.

Change-Id: I2f7ebbf7644e5d8b27a2e3d19588f792031bf535
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMigrate NC881Test to xmlunit-core/JUnit5 95/108495/1
Robert Varga [Wed, 18 Oct 2023 09:28:06 +0000 (11:28 +0200)]
Migrate NC881Test to xmlunit-core/JUnit5

Reduce our dependencies on legacy components a bit.

Change-Id: Idc2f3a788c932c77884c30b5becd4dc56a36e69b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRemove identity from OpenAPI Schemas 99/107899/13
Samuel Schneider [Tue, 10 Oct 2023 10:45:41 +0000 (12:45 +0200)]
Remove identity from OpenAPI Schemas

Removes creation of schemas for identity. Use string
value instead of reference on this schema.

Adds test for new behavior.

JIRA: NETCONF-1145
Change-Id: Ic1118bdb90649aa123caa642f06cd00e966e808d
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
7 months agoMake LoggingRemoteDevice a singleton 72/108472/1
Robert Varga [Tue, 17 Oct 2023 08:52:48 +0000 (10:52 +0200)]
Make LoggingRemoteDevice a singleton

There is no point in creating multiple instances of this class, just
squash them to a single instance.

Change-Id: Icb501b176577e2c18df565a7d7aeda01e047ca09
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoYangResource should be a record 71/108471/1
Robert Varga [Tue, 17 Oct 2023 08:41:32 +0000 (10:41 +0200)]
YangResource should be a record

This is a trivial data holder, convert it to a record.

Change-Id: If98bc2f8865ea8658aca707d01b6eae3b275331e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up StressClient a bit 70/108470/1
Robert Varga [Mon, 16 Oct 2023 18:06:02 +0000 (20:06 +0200)]
Clean up StressClient a bit

Move @SuppressFBWarnings on top the sole caller and justify the
suppression.

Use local variable type inference throughout.

Change-Id: I84e65aceb89dbcb2c528aab02d978f7df866dc08
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoUse SettableFuture instead of Promise 68/108468/3
Robert Varga [Mon, 16 Oct 2023 18:34:33 +0000 (20:34 +0200)]
Use SettableFuture instead of Promise

Perform correct bridging when we have a channel handy -- that allows us
to reuse the channel's thread.

JIRA: NETCONF-1108
Change-Id: Icdc1437f9ed9e0f560773185b2ba1f6124b0845b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoUse Files.readString() 63/108463/1
Robert Varga [Mon, 16 Oct 2023 17:34:13 +0000 (19:34 +0200)]
Use Files.readString()

Since Java 11 we have a simple convenience method to read the contents
of a UTF-8-encoded file. Use that instead of going through a CharSource.

Change-Id: I1ddf210a7d5fb0d78296fbc897593e395e75ae63
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoUse text blocks in StressClient 62/108462/1
Robert Varga [Mon, 16 Oct 2023 17:28:52 +0000 (19:28 +0200)]
Use text blocks in StressClient

We have inline XML documents here. Make sure they are as crisp as
possible.

Change-Id: I2d56361b5b7ad78ea596b46196436ab486b53c2f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up CryptHashPasswordAuthenticator 61/108461/1
Robert Varga [Mon, 16 Oct 2023 17:12:53 +0000 (19:12 +0200)]
Clean up CryptHashPasswordAuthenticator

Use simple record for CryptHashValidator, inlining its isValid() method
into its sole caller. Also extract validation logic into the
the authenticator construction loop.

Change-Id: I6a26b36786b7d5f1f9c6b12e0e01e3c3304fe1ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoModernize NetconfDeviceCommunicator 60/108460/1
Robert Varga [Mon, 16 Oct 2023 16:40:35 +0000 (18:40 +0200)]
Modernize NetconfDeviceCommunicator

- use local variable type inference
- use a VarHandle instead of a AtomicIntegerFieldUpdater
- reduce the number of callsites for future.set()
- Request is a record with non-null fields
- guard message logging with .isXyzEnabled()

Change-Id: I9ab92b9184cf1e3045260d384bdc2a0f3091a045
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoUpdate BufferedWriter 59/108459/3
Robert Varga [Mon, 16 Oct 2023 15:18:53 +0000 (17:18 +0200)]
Update BufferedWriter

Clarify why this class is still present, as its primary motivation has
been removed in Java 9.

Also use String.formatted() and drop the use of checkArgument().

Change-Id: I3312cc6690dd6fda9d6a28c7915c9f23f6f4b260
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDelete unused SshProxy artifacts for netconf server 98/108198/11
Ruslan Kashapov [Mon, 3 Jul 2023 14:51:49 +0000 (17:51 +0300)]
Delete unused SshProxy artifacts for netconf server

Ssh proxy served as a bridge to local tcp netconf server.
New ssh transport implementation does not require a proxy.

JIRA: NETCONF-1106
Change-Id: I1b5aee1f6128b4e98918176e35f6e80f1b2c7527
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
7 months agoRefactor ConcurrentClientsTest using new transport 02/108202/24
Ruslan Kashapov [Mon, 3 Jul 2023 14:51:49 +0000 (17:51 +0300)]
Refactor ConcurrentClientsTest using new transport

ConcurrentClientsTest is the last user of NetconfServerDispatcher.
Migrate it to use transport-api and remove obsolete code.

JIRA: NETCONF-1106
Change-Id: Id1e7a9148ee2ad8177eb25443a7b184acbd92064
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoUpdate netconf device simulator to use new transport 17/108117/23
Ruslan Kashapov [Mon, 2 Oct 2023 10:41:53 +0000 (13:41 +0300)]
Update netconf device simulator to use new transport

Drop use of netconf.northbound.ssh as well as NetconfServerDispatcher,
establishing a proper end-to-end integration test of the
netconf/trasport integration.

JIRA: NETCONF-1106
Change-Id: I3429b28f8a31bfb8af995d25b79b17110823f638
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
7 months agoFix ssh server subsystem initialization sequence. 55/108455/4
Ruslan Kashapov [Mon, 16 Oct 2023 10:27:53 +0000 (13:27 +0300)]
Fix ssh server subsystem initialization sequence.

The start() triggering run() method is executed on very
first client request within an open subsystem channel.
Initializing netconf handlers within run() method causes
hello message reaching the end of pipeline before netconf
negotiation handlers are properly set. This results
hello message from client being dropped and server side
netconf session never established.

Moved channel initialization trigger (future.set)
to dedicated method invoked after ChannelSession#prepareChannelCommand()
during subsystem open request processing.

JIRA: NETCONF-1106
Change-Id: I6ecfacfedba01045644c4d926d9a20a3941dfe1c
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoIssue channelActive event in transport-ssh 51/108451/4
Robert Varga [Sun, 15 Oct 2023 17:49:50 +0000 (19:49 +0200)]
Issue channelActive event in transport-ssh

Channel behaviour in SSH is subtly different to TCP and TLS transports:
in SSH the transport channel pipeline is established lazily and
signalled after channel.pipeline().fireChannelActive(), thus missing
this event.

JIRA: NETCONF-1106
JIRA: NETCONF-1108
Change-Id: I42af65a8b3bbbd0b3674b333c174701aa5c0ed62
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoImprove SSH{Client,Server} logging 47/108447/4
Robert Varga [Sun, 15 Oct 2023 16:38:36 +0000 (18:38 +0200)]
Improve SSH{Client,Server} logging

Improve consistency with surrounding messages mentioning subsystem.

JIRA: NETCONET-1108
Change-Id: I279962885d17a413f4625602a86a8d3d2840d932
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoLog hello message as confidential 52/108452/5
Robert Varga [Sun, 15 Oct 2023 18:34:17 +0000 (20:34 +0200)]
Log hello message as confidential

Just as with any on-wire message, we have no idea whether or not it
contains confidential information.

Mark log output as condidential and clean up surrounding code a bit.

Change-Id: I15e85449ecd7795a4a01b1267a46e4909d1049e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDeprecate legacy SSH integration 26/108426/3
Robert Varga [Sat, 14 Oct 2023 02:51:27 +0000 (04:51 +0200)]
Deprecate legacy SSH integration

transport-api allows for both connect and listen channels, which renders
quite a bit of netconf-netty-util/callhome-protocol obsolete.

Deprecate classes which are used only in legacy wiring, so that clean up
can be focused.

JIRA: NETCONF-1108
Change-Id: I6cd6d351c986b42f6fbb3a0769e8305dc5440704
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRemove a trailing comment 25/108425/1
Robert Varga [Sat, 14 Oct 2023 02:23:42 +0000 (04:23 +0200)]
Remove a trailing comment

Sonar is picky here, and rightfully so. Do not use a trailing comment.

Change-Id: I624e7ec542703a0a468e6efca66e49178e6b0297
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoSwitch netconf-client to transport-api 31/107431/34
Ruslan Kashapov [Mon, 3 Jul 2023 14:51:49 +0000 (17:51 +0300)]
Switch netconf-client to transport-api

Expand NetconfClientFactory as the alternative to
NetconfClientDispatcher. The entire stack is adjusted to work on
transport-api.

Clients are now required to provide transport-level settings, paving the
way to callhome-protocol integration.

JIRA: NETCONF-1108
Change-Id: I403f9809e366fa004eda49dc63ba569b99206407
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoExternal service integration support for TLS transport 45/108245/22
Ruslan Kashapov [Thu, 5 Oct 2023 09:40:02 +0000 (12:40 +0300)]
External service integration support for TLS transport

Netconf-topology uses own service to build SslHandler based on
certificates/keys data retrieved from datastore.

JIRA: NETCONF-1106
Change-Id: I7f60e7510852054b214c8aa0cc0198e9423d4954
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up SSH server subsystem handling 04/108404/9
Robert Varga [Fri, 13 Oct 2023 21:12:03 +0000 (23:12 +0200)]
Clean up SSH server subsystem handling

SSH transport should not report a connection until it has established
the expected transport channel.

This patch reworks the API to instantiation and internal wiring, so that
we invoke TransportChannelListener only once the subsystem has been
allocated.

This has the nice side-effect of reducing shaded.ssh package
proliferation, as things just end up being better encapsualted.

JIRA: NETCONF-1106
Change-Id: Ifcfc3a99d1fa323b105c87724c34f9bba018b78a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRequire a subsystem for client connections 96/108396/8
Robert Varga [Fri, 13 Oct 2023 12:13:50 +0000 (14:13 +0200)]
Require a subsystem for client connections

SSHClient does not really operate on the raw session, hence we should
not report it as set up after authentication.

Each client is connected to a particular SSH subsystem, and hence we
require the desired name (for example "netconf", but can be anything).

Once we complete authentication, we request the specified subsystem.
When the subsystem is open, we attach it to the Netty channel and only
then do we report the SSHClient to be up.

JIRA: NETCONF-1108
Change-Id: I9210b2924a9b8239161c8f4c649db3677e63b5b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up SSHTransportStack.sessionEvent() 95/108395/3
Robert Varga [Fri, 13 Oct 2023 12:51:43 +0000 (14:51 +0200)]
Clean up SSHTransportStack.sessionEvent()

Event type dispatch should forward to individual methods, so we can
specialize them.

JIRA: NETCONF-1108
Change-Id: I84cf131ccd91b84f587f9ff0ca824e064032c3d7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoHide Netty(Pipeline)AwareChannelSubsystem 92/108392/3
Robert Varga [Fri, 13 Oct 2023 11:41:51 +0000 (13:41 +0200)]
Hide Netty(Pipeline)AwareChannelSubsystem

Just promise a ChannelSubsystem in API and let the implementation detail
with the details.

JIRA: NETCONF-1108
Change-Id: I21d663d4c2d92a5f087579ec9e29804da3bab569
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up NetconfClientSessionImpl 91/108391/3
Robert Varga [Fri, 13 Oct 2023 11:01:12 +0000 (13:01 +0200)]
Clean up NetconfClientSessionImpl

This class should be final and it shares a bunch of code internally.
Also clean up Netty(Pipeline)AwareChannelSubsystem to share code.

JIRA: NETCONF-1108
Change-Id: Idccb4b6398e28d0a68f4e97f1aa2f06b5984d129
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoFix incorrect operational state of device configuration 88/107688/14
Yaroslav Lastivka [Mon, 4 Sep 2023 10:04:51 +0000 (13:04 +0300)]
Fix incorrect operational state of device configuration

Initialization of clientConfig in NetconfNodeHandler can throw
a RuntimeException, leaving no handler to clean up
the operational datastore. This results in garbage
data upon node deletion.

Made clientConfig nullable and wrapped its initialization in
a try/catch block to handle exceptions. Moved input validation
for host/port from AbstractNetconfTopology#setupConnection()
to DefaultNetconfClientConfigurationBuilderFactory
and included relevant unit tests.

JIRA: NETCONF-1114
Change-Id: Ieb74ee3c1a4e0cbab7f0e01c942d1e8c1d6e20e4
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoClean up SSHTransportStack a bit 82/108382/1
Robert Varga [Fri, 13 Oct 2023 08:28:54 +0000 (10:28 +0200)]
Clean up SSHTransportStack a bit

Shuffle justification and fields a bit.

JIRA: NETCONF-1106
Change-Id: I5e1f9a0efcc7c50871042045147688b66e5cf3c6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoIntegrate UserAuthSessionListener into SSHTransportStack 81/108381/2
Robert Varga [Thu, 12 Oct 2023 21:24:32 +0000 (23:24 +0200)]
Integrate UserAuthSessionListener into SSHTransportStack

These two classes are inherently tied together. Make sure they do not
expose their internals outside SSHTransportStack.

Change-Id: I492ee6452047a1520f0de978510cdd6d9379f241
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoExpose NetconfSubsystemOutboundChannelHandler 80/108380/2
Robert Varga [Thu, 12 Oct 2023 20:31:51 +0000 (22:31 +0200)]
Expose NetconfSubsystemOutboundChannelHandler

This is a building block for shuffling SSH data, without any
dependencies on NETCONF. Promote it to transport-ssh for reuse.

JIRA: NETCONF-1106
Change-Id: I06086e532744f3b746c98fbfa6680c66cfad60d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDo not propagate empty writes 79/108379/2
Robert Varga [Thu, 12 Oct 2023 20:26:30 +0000 (22:26 +0200)]
Do not propagate empty writes

The API contract says we can see 0-sized events. Do not propagate those,
as they are not changing channel state.

JIRA: NETCONF-1106
Change-Id: I5dab0bca2616627833409eb82da733bec87cc1a4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoFix NetconfMessage not sent on EmbeddedChannel 16/108116/7
Ruslan Kashapov [Mon, 2 Oct 2023 10:41:53 +0000 (13:41 +0300)]
Fix NetconfMessage not sent on EmbeddedChannel

The EmbeddedChannel implementation uses built-in implementation
for event loop (EmbeddedEventLoop) which has no own executor.
The tasks placed via execute() method are queued but not executed
unless predefined events like channel closure.

Explicit triggering of pending tasks processing resolves the issue
for now, but this needs to be revisited.

JIRA: NETCONF-1106
Change-Id: Ief1d9566651c39e10310c961e5899324e73fa923
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDo not reference DefaultPromise 76/108376/2
Robert Varga [Thu, 12 Oct 2023 16:24:44 +0000 (18:24 +0200)]
Do not reference DefaultPromise

Use newPromise() instead, which does the right thing.

JIRA: NETCONF-1106
Change-Id: I0e2a13ae6612d00afc2ac9753e3af5d376d4c167
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoImprove write error handling 75/108375/3
Robert Varga [Thu, 12 Oct 2023 15:45:50 +0000 (17:45 +0200)]
Improve write error handling

We are swallowing errors if the attempt to write out fails. We also fail
to release the buffer in error paths.

Refactor the implementation to:
- release ByteBuf as soon as we have extracted bytes from it
- propagate failure to the promise
- emit a trace message if we encounter a non-ByteBuf

Also add a TODO to consider creating a ByteBufBuffer, which might reduce
the need copy bytes around.

JIRA: NETCONF-1106
Change-Id: I1da71b1f5c9959a5a32a9ce39067d25464b785c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoSplit out NetconfSubsystemOutboundChannelHandler 74/108374/2
Robert Varga [Thu, 12 Oct 2023 15:32:32 +0000 (17:32 +0200)]
Split out NetconfSubsystemOutboundChannelHandler

Do not use an anonymous class, but rather split the logic into its own
dedicated class.

JIRA: NETCONF-1106
Change-Id: Ic8786dc950225a51d93d61e2c6a9bb64e144a7af
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoNetconfSubsystem should be a ChannelDataReceiver 73/108373/3
Robert Varga [Thu, 12 Oct 2023 15:12:42 +0000 (17:12 +0200)]
NetconfSubsystem should be a ChannelDataReceiver

We are tightly bound to our inner channel, do not allocate a separate
object just to shuffle bytes.

JIRA: NETCONF-1106
Change-Id: I2311170bdc6b1566be5062c1ea0ca38273187966
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoFactor out NetconfSubsystem 72/108372/3
Robert Varga [Thu, 12 Oct 2023 15:07:21 +0000 (17:07 +0200)]
Factor out NetconfSubsystem

This is an inner class for no real reason, split it out into a separate
class for clarity.

JIRA: NETCONF-1106
Change-Id: I1267db3475619ff17f4a026a2f6156f62dd50d8a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoThrows RDE exception in case model was not found 48/108248/11
Oleksandr Zharov [Thu, 5 Oct 2023 12:19:57 +0000 (14:19 +0200)]
Throws RDE exception in case model was not found

Added proper response in case model was not found using
RestconfDocumentedException's DATA_MISSING error tag.

Added unit tests to cover this cases.

JIRA: NETCONF-1159
Change-Id: Ife5b3836c8c2d974963d80df4d497ec019a83cc1
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoThrow exception when module cannot be found 14/108214/8
Oleksandr Zharov [Thu, 5 Oct 2023 09:01:49 +0000 (11:01 +0200)]
Throw exception when module cannot be found

Made module field in SchemaExportContext class @NonNull.
Added exception in case module not found in
ParserIdentifier#toSchemaExportContextFromIdentifier.

JIRA: NETCONF-1166
Change-Id: I9571496d789a1c499fd4871787e25e562bfec8ae
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoRefactor JaxRsRestconfCallback 98/108298/3
Robert Varga [Tue, 10 Oct 2023 08:09:47 +0000 (10:09 +0200)]
Refactor JaxRsRestconfCallback

Rather than using a Function for transform, force users to subclass and
provide the transform function inline.

JIRA: NETCONF-718
Change-Id: I211234113537422996762d17db1f614c32fb4273
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoUse RestconfFuture in putData() 97/108297/1
Robert Varga [Tue, 10 Oct 2023 07:53:19 +0000 (09:53 +0200)]
Use RestconfFuture in putData()

RestconfStrategy.putData() is the final caller of
TransactionUtil.syncCommit().

Refactor it to return a RestconfFuture, adjust callers and eliminate
syncCommit().

JIRA: NETCONF-718
Change-Id: I1f34ddf767bb340d479fdd7fffa4287040559c85
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoUse RestconfFuture/AsyncResponse for postData() 76/108276/6
Robert Varga [Mon, 9 Oct 2023 08:19:26 +0000 (10:19 +0200)]
Use RestconfFuture/AsyncResponse for postData()

We now have the tooling we need to make POST requests asynchronous, at
least from the JAX-RS perspective.

This patch provides the first-order wiring change, allowing
RestconfStrategy to completely control how the request is dispatched.
Current implementation eliminates synchronous wait for the commit
future, but leaves other blocking calls as they are.

JIRA: NETCONF-718
Change-Id: Iefcbe31b73b9ed85527ce57d75f29145dbc2ab4c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoStreamline GlobalContext retrieving 74/108274/3
Ivan Hrasko [Fri, 6 Oct 2023 10:44:08 +0000 (12:44 +0200)]
Streamline GlobalContext retrieving

We do not have to use flatMap or additional Optional to get
EfffectiveModelContext from DOMSchemaService.

Use just DOMSchemaService::getGlobalContext method reference instead.

Change-Id: I0cbcf59bc65ba84bdcf6c5c921c6628b255af97d
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoOpenAPI: Update Swagger UI to v5.9.0 85/108185/3
Yaroslav Lastivka [Tue, 3 Oct 2023 10:49:34 +0000 (13:49 +0300)]
OpenAPI: Update Swagger UI to v5.9.0

Update Swager UI from v4.18.1 to v5.9.0:
https://github.com/swagger-api/swagger-ui/releases/tag/v5.9.0
https://github.com/swagger-api/swagger-ui/releases/tag/v5.0.0

This new UI enables to update to OpenApi spec 3.1.0 in the future.

JIRA: NETCONF-1162
Change-Id: Ide7c6652d36ef5e6d1c2f58eb0b51bd0f4644512
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
7 months agoAdd RestconfCallback 67/108267/2
Robert Varga [Thu, 5 Oct 2023 23:48:54 +0000 (01:48 +0200)]
Add RestconfCallback

Improve RestconfFuture with a .addCallback(RestconfCallback), where
RestconfCallback is specialized to match RestconfFuture's reporting only
RestconfDocumentedException.

This opens up for a further specialization, JaxRsRestconfCallback, which
performs a transform-and-set of an AsyncResponse.

JIRA: NETCONF-718
Change-Id: I912847da952d7c23cc5d08a3da90758e3f065539
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRestconfStrategy.patchData() should result in RestconfFuture 65/108265/5
Robert Varga [Thu, 5 Oct 2023 21:12:25 +0000 (23:12 +0200)]
RestconfStrategy.patchData() should result in RestconfFuture

This method performs an intrinsically asynchronous operation, clarify
that in its contract.

JIRA: NETCONF-718
Change-Id: I1c4584c27ad78107ed5bf8299ab60287b8942a2b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMake ExistenceCheck implement FutureCallback 64/108264/2
Robert Varga [Thu, 5 Oct 2023 20:46:47 +0000 (22:46 +0200)]
Make ExistenceCheck implement FutureCallback

There is some shared state we are expressing, but we are leaving
implicit dependencies up to an anonymous class to capture.

ExistenceCheck is never instantiated, which seems to be a waste. Split
out the stateful bit allocation to start() and let ExistenceCheck be a
FutureCallback dealing the partial outcome.

Having state ownership indicated a bit more clearly, this exposes a
subtle race: if the last two checks complete concurrently, and one would
result in success and the other in failure, the counter-based logic
could result in a false success.

We document the above interactions and reorder operations to close the
above race without introducing additional locking.

JIRA: NETCONF-718
Change-Id: I3aa8edb4df695131be7e0b79e7f1453fb26837f4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoUse RestconfException in ExistenceCheck 63/108263/2
Robert Varga [Thu, 5 Oct 2023 19:51:32 +0000 (21:51 +0200)]
Use RestconfException in ExistenceCheck

The only caller is wrapping failures with RestconfDocumentedException,
which means we can unify handling by relocating failure handling to the
original site.

The caller gets the benefit of getOrThrow(), which is completely
appropriate in this execution context.

JIRA: NETCONF-718
Change-Id: Id050e627cf1613dec5eb2411a30c353d2af04c60
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoChange reported path in conflict detection 62/108262/2
Robert Varga [Thu, 5 Oct 2023 19:26:08 +0000 (21:26 +0200)]
Change reported path in conflict detection

We really should be reporting a consistent path here, barring the
datastore report.

JIRA: NETCONF-718
Change-Id: Ie7e0c413e3befbba3e941b397b43b88e477d37df
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRefactor BatchedExistenceCheck 61/108261/3
Robert Varga [Thu, 5 Oct 2023 18:31:59 +0000 (20:31 +0200)]
Refactor BatchedExistenceCheck

Users are only interested in a ListenableFuture, which now results in a
'Conflict' record, which captures the semantics of the Entry we use to
return.

The 'Batched' part is not entirely useful, as we can handle single
requests just as well (if the need arises) -- just rename the class to
ExistenceCheck.

As a final twist, pass the presence expectation from the caller, so this
turns a more powerful building block -- which we may need later.

JIRA: NETCONF-718
Change-Id: I71f43e02ff91d8e4fd796dee151c59919663cdc6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoIntroduce XmlUtil.requireSingleElement 07/108207/3
Robert Varga [Tue, 3 Oct 2023 16:17:23 +0000 (18:17 +0200)]
Introduce XmlUtil.requireSingleElement

Improve our handling of structural errors, by reporting missing-element
instead of invalid-value. The utility to do so is also independent from
XmlElement.

Change-Id: If1efd60aa268d659b1e5f43686caf49e77e40c05
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoTurn ListenersBroker into a component 34/107834/17
Oleksandr Zharov [Tue, 12 Sep 2023 11:57:54 +0000 (13:57 +0200)]
Turn ListenersBroker into a component

Refactored the ListenersBroker class into a component using
osgi.service.component.annotations.

JIRA: NETCONF-1104
Change-Id: I6ef5fa2ab22792c3d408dfa9db92ae7f07b3c63d
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoFix 'End of input' exception on netconf session.close() 15/108115/7
Ruslan Kashapov [Mon, 2 Oct 2023 10:29:05 +0000 (13:29 +0300)]
Fix 'End of input' exception on netconf session.close()

On session.close() the channel is closed before the
session state updated. When processing channel closure
event the endOfInput() detects session is still up and
instructs session listener to throw an exception.
Updating state before channel closure eliminates the issue.

JIRA: NETCONF-1106
Change-Id: I0394c808dd13adb5f82290c625d0a04b14c91179
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRemove type arguments 49/108249/1
Robert Varga [Thu, 5 Oct 2023 12:27:01 +0000 (14:27 +0200)]
Remove type arguments

We can use diamond notation to let javac figure out the type.

Change-Id: I098c1713c4b0899f88931c6e10d331d683617ed3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoFix channel initialization for netconf server 14/108114/6
Ruslan Kashapov [Mon, 2 Oct 2023 09:33:47 +0000 (12:33 +0300)]
Fix channel initialization for netconf server

The start() triggering run() method is executed on very
first client request within an open channel. Initializing
data receiver within run() method causes default data
receiver with incoming message buffer being dropped,
resulting the hello request from client being ignored.
While hello request from server is sent it leads netconf
session initialization on client, but not on server.

The fix enables channel initialization on processing
setChannelSession() and setIoOutputStream() methods which
are invoked by ChannelSession#prepareChannelCommand()
on processing channel OPEN request.

JIRA: NETCONF-1106
Change-Id: If6baba692e0178d7b5a24866176fe93aa0a0a485
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDo not repair XML namespaces on output 99/108199/3
Robert Varga [Tue, 3 Oct 2023 15:28:35 +0000 (17:28 +0200)]
Do not repair XML namespaces on output

Our output should be namespace-clean, hence there should be no need for
repairing.

Change-Id: Iad70bf0fd750caf54c3dc7461219e8b78f46a6c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoFix RPC XML payload missing namespace 62/107762/17
Matej Sramcik [Mon, 25 Sep 2023 06:39:17 +0000 (08:39 +0200)]
Fix RPC XML payload missing namespace

XML payload for RPCs is missing namespace.
Add namespace parameter to schema builder.
Add test to check if namespace is present.
Edit expected outcome from affected tests.

JIRA: NETCONF-1139
Change-Id: I17b99e0afa6acdcac98a63baef625c671a6ce29e
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
7 months agoTest JSON representations of responses in OpenApi 91/107391/29
Šimon Ukuš [Fri, 11 Aug 2023 12:48:15 +0000 (14:48 +0200)]
Test JSON representations of responses in OpenApi

We did not have any tests that would provide a higher overview
of the responses sent back to clients. Such view gives us an idea
about the generated output.

These tests verify the full response of each endpoint by comparing
the results to prepared JSONs.

JIRA: NETCONF-1131
Change-Id: I008f01e3c11593f5a2d0f53843bc4d5639abda1a
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoClean up boolean values in records 02/108002/4
Samuel Schneider [Thu, 28 Sep 2023 10:48:01 +0000 (12:48 +0200)]
Clean up boolean values in records

Remove unnecessary boolean values in record and
the rest change to Boolean, so it can be null.

JIRA: NETCONF-938
Change-Id: Ieaadb216c23b9aea5bf682e914a554daf39907ff
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
7 months agoEliminate HandlingPriority.CANNOT_HANDLE 71/108171/2
Robert Varga [Tue, 3 Oct 2023 08:12:10 +0000 (10:12 +0200)]
Eliminate HandlingPriority.CANNOT_HANDLE

This is an ugly special case. It really is used only as a return from
canHandle(), which in turn can use a @Nullable return to represent this.

Change-Id: I87ce5f1a4391e04de78377c1d4d27b55e2fe80e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up HandlingPriority 70/108170/1
Robert Varga [Mon, 2 Oct 2023 18:12:05 +0000 (20:12 +0200)]
Clean up HandlingPriority

Clean up comparison and API surface and mark CANNOT_HANDLE for removal.

Change-Id: Iec8585f67c25f65e8c473372bf7d37ab62c3ae65
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoFix RuntimeRpc.canHandle() 66/108166/2
Robert Varga [Mon, 2 Oct 2023 17:25:48 +0000 (19:25 +0200)]
Fix RuntimeRpc.canHandle()

We were disregarding the result from the RPC search, fix that.

Change-Id: Ice6e1d4cc7aa381c21fe640dbd1b5044c68cf6c7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRuntimeRpc should be final 65/108165/1
Robert Varga [Mon, 2 Oct 2023 17:13:43 +0000 (19:13 +0200)]
RuntimeRpc should be final

We do not expect this class to be customized, make it final.

Change-Id: If2568f12fc512c3a078bdfb04d187f583412dc21
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMake AbstractNetconfOperation.handle() final 56/108156/2
Robert Varga [Mon, 2 Oct 2023 12:09:20 +0000 (14:09 +0200)]
Make AbstractNetconfOperation.handle() final

We do not want to have a byzantine overrides when there is an extension
point. This locks the method down by making it final.

Change-Id: I974d6944a51d579607a422a8ced4d6917e470be5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMake SettableRpc final 55/108155/2
Robert Varga [Mon, 2 Oct 2023 11:18:13 +0000 (13:18 +0200)]
Make SettableRpc final

This is an internal implementation class, there is no need to keep it
non-final.

Change-Id: I824422b26542737fa09e4b818932f5bc789f45d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoSSH keep-alive mechanism to use IGNORE messages 13/108113/1
Ruslan Kashapov [Mon, 2 Oct 2023 08:44:59 +0000 (11:44 +0300)]
SSH keep-alive mechanism to use IGNORE messages

Initial setting of HeartbeatType.RESERVED requires
custom implementation of heartbeat message handler.
Otherwise, the exception is thrown.

JIRA: NETCONF-590
Change-Id: I4752718a5bc9ac18910fa4c141e0fc53155e5ce8
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
8 months agoFix frame encoder for netconf server 01/108001/3
Ruslan Kashapov [Thu, 28 Sep 2023 09:33:22 +0000 (12:33 +0300)]
Fix frame encoder for netconf server

Using first appearance of ByteBuf output as a final
message caused frame encoder being skipped and
message returned without expected EOM bytes. Message
extraction from inner channel re-implemented as an
outbound message handler.

JIRA: NETCONF-1106
Change-Id: Icb7fc6eca070c75910a35c8f117e6b1fa4295c0c
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
8 months agoClean up XmlElementTest 07/108107/1
Robert Varga [Sun, 1 Oct 2023 22:48:39 +0000 (00:48 +0200)]
Clean up XmlElementTest

Use local variable type inference and text blocks.

Change-Id: I471d99d11a493c46aba9a2e6fe868172edfc6a24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoClean up XmlElement methods 90/108090/4
Robert Varga [Sun, 1 Oct 2023 13:36:34 +0000 (15:36 +0200)]
Clean up XmlElement methods

XmlElement has a number of methods which are better hosted in XmlUtil,
without the need for encapsulation.

Change-Id: I5e47719ce3c31b3e41976f0e1955ac097b4a1485
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>