netconf.git
6 months agoDitch use of Optional in EventFormatter 30/108830/2
Robert Varga [Thu, 2 Nov 2023 23:16:14 +0000 (00:16 +0100)]
Ditch use of Optional in EventFormatter

These are internal implementation classes, switch to using @Nullable
instead.

Change-Id: Id8d0a5e096e324e7e9a03bc84196c39e340f7147
JIRA: NETCONF-1102
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoClean up JSONDataTreeCandidateFormatter constants 29/108829/2
Robert Varga [Thu, 2 Nov 2023 21:14:14 +0000 (22:14 +0100)]
Clean up JSONDataTreeCandidateFormatter constants

Eliminate a static block and inline a single-use literal.

JIRA: NETCONF-1102
Change-Id: Ie2f8d7d99eb1825391a3214e20747de9e6f75794
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoDo not pretend we support stream replay 28/108828/2
Robert Varga [Thu, 2 Nov 2023 20:59:36 +0000 (21:59 +0100)]
Do not pretend we support stream replay

We do not have any sort of replay buffer and therefore we should not
advertize replay-support -- and we certainly do not have
replay-log-creation-time!

This patch removes all start/stop handling from AbstractCommonSubscriber
and relocates the now-orphan code to AbstractReplayParam for future use.

JIRA: NETCONF-1102
Change-Id: Icc3d3b6df1ecf72afea6c7f340efbfd78127bbbf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRefactor NotificationQueryParams 26/108826/3
Robert Varga [Thu, 2 Nov 2023 18:50:55 +0000 (19:50 +0100)]
Refactor NotificationQueryParams

Add explicit documentation pointing to 'Subscribing to Receive
Notifications' chapter of RFC8040.

Turn this class into a record and rename it to ReceiveEventsParams to
mirror naming of ReadDataParams.

JIRA: NETCONF-1102
Change-Id: I7a033bad585aef1b2e6c628db9d8d5c95b9ac0ff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoClean up adapter constructors 23/108823/2
Robert Varga [Thu, 2 Nov 2023 17:14:02 +0000 (18:14 +0100)]
Clean up adapter constructors

Reorder arguments to match what we are passing to superclasses. We will
use this as a springboard to further shuffling around.

JIRA: NETCONF-1102
Change-Id: I403bf59915818339455484b574ea0f204bad4c87
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoUnify streams URI 15/108815/1
Robert Varga [Thu, 2 Nov 2023 01:25:38 +0000 (02:25 +0100)]
Unify streams URI

We have a tad inconsistent delivery of events:
- SSE binds to /rests/notif
- WS binds to /xyz (with special prefixes)

Unify handling so that we bind to /rests/events irrespective of the
protocol we use. This eliminates the need for WS to know the exact
naming of streams (to intercept them).

Also update WS to:
- use URI.getPath(), as we want the decoded stream name
- perform path stripping without createStreamNameFromUri(), as that
  method is just confusing and unnecessary

JIRA: NETCONF-1102
Change-Id: I4c67b443d9cbe6feb9d5e5225115d37ba609a86a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up createWebSocket() 13/108813/2
Robert Varga [Wed, 1 Nov 2023 23:29:46 +0000 (00:29 +0100)]
Clean up createWebSocket()

Rename arguments to match super definition, which makes things a tad
denser.

JIRA: NETCONF-1102
Change-Id: I1d3473e11e9a9b79c97a18c81d60414dd8f93d81
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up SSE stream name handling 12/108812/1
Robert Varga [Wed, 1 Nov 2023 23:19:41 +0000 (00:19 +0100)]
Clean up SSE stream name handling

We are using JAX-RS to extract the stream name for the request URL. This
means we should not be talking to createStreamNameFromUri(), as it is
either a no-op or it actively corrupts the input.

Also ditch @Encoded, as we do not perform any decoding -- and hence the
container should deal with decoding the URL.

JIRA: NETCONF-1102
Change-Id: If06a0bf6e7af65bb7d58c9cc7c972c162c53b82a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoEliminate AbstractRestconfApplication 11/108811/2
Robert Varga [Wed, 1 Nov 2023 18:06:42 +0000 (19:06 +0100)]
Eliminate AbstractRestconfApplication

AbstractRestconfApplication is really needed only to support
RestconfDocumentedException, which we are no longer using.

Rename DataStreamApplication to ServerSentEventsApplication, hidden from
outside world and make it a plain Application.

Also merge AbstractRestconfApplication into RestconfApplication and hide
it as well.

JIRA: NETCONF-1102
Change-Id: I91135f716c46a6aa34c98c4f89ddcd42d344082a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoReport 404 instead of 409 when listener is not found 10/108810/1
Robert Varga [Wed, 1 Nov 2023 17:56:55 +0000 (18:56 +0100)]
Report 404 instead of 409 when listener is not found

When we fail to find the stream we should just return 404, not muck with
RestconfDocumentedException.

JIRA: NETCONF-1102
Change-Id: I63e761ef01141b23cd4b67b97aa0e5b32e86dcd1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoEliminate nb.rfc8040.monitoring 08/108808/1
Robert Varga [Wed, 1 Nov 2023 17:45:58 +0000 (18:45 +0100)]
Eliminate nb.rfc8040.monitoring

This package is superfluous, as RestconfStateStreams belongs to
rfc8040.streams and CapabilitiesWriter is really a core component.

JIRA: NETCONF-1102
Change-Id: I1d62bd95eaa72824deb3bfb9050cd7a3eb1255a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMove RestconfStreamsConstants 07/108807/1
Robert Varga [Wed, 1 Nov 2023 17:43:36 +0000 (18:43 +0100)]
Move RestconfStreamsConstants

RestconfStreamsConstants is tightly coupled with rfc8040.streams, move
it to that package.

JIRA: NETCONF-1102
Change-Id: I70cd1c6f9378a6d9ae0377f4174ae2162cf4c769
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoEliminate rfc8040.streams.listeners package 06/108806/1
Robert Varga [Wed, 1 Nov 2023 17:36:33 +0000 (18:36 +0100)]
Eliminate rfc8040.streams.listeners package

There is no point in keeping two separate packages here, just merge them
together -- all these classes are supporting event streams.

JIRA: NETCONF-1102
Change-Id: Id88815af2de1c93e245db37d6f488320cb24360b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoEliminate SubscribeToStreamUtil 05/108805/3
Robert Varga [Wed, 1 Nov 2023 16:58:47 +0000 (17:58 +0100)]
Eliminate SubscribeToStreamUtil

SubscribeToStreamUtil is tightly coupled to ListenersBroker, as it needs
its services. ListenersBroker in turn will require access to
SubscribeToStreamUtil's understanding of endpoints.

This patch merges the two classes, eliminating SubscribeToStreamUtil in
the process of doing so.

JIRA: NETCONF-1102
Change-Id: I9b33844b594c3cef7272ce7b81539b1fc78ec156
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDisconnect RestconfDataServiceImpl from streams 04/108804/2
Robert Varga [Wed, 1 Nov 2023 15:38:51 +0000 (16:38 +0100)]
Disconnect RestconfDataServiceImpl from streams

The overlap between dataservice and subscription service should not
exist -- what dataservice really wants is to have the operational
datastore populated with information about supported streams.

This patch deals with the first part -- eliminating the primary
dependency.

JIRA: NETCONF-1102
Change-Id: Ie119e8e160eb61d670dc6f6ce3d3051348018064
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoSimplify HandlersHolder 03/108803/1
Robert Varga [Wed, 1 Nov 2023 14:09:46 +0000 (15:09 +0100)]
Simplify HandlersHolder

This is a pure DTO, make it a record and update users.

JIRA: NETCONF-1102
Change-Id: I24276884f24165550fe0e69a5a0ea32488b04be9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDo not parse data change stream name 98/108798/1
Robert Varga [Wed, 1 Nov 2023 09:09:27 +0000 (10:09 +0100)]
Do not parse data change stream name

We have all the information we need available when the adapter is
created, hence we do not need to interpret the stream name.

JIRA: NETCONF-1102
Change-Id: I786fc980bd05a158879d6899898c01582a50c7a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoBump upstreams 94/108794/1
Robert Varga [Tue, 31 Oct 2023 14:28:16 +0000 (15:28 +0100)]
Bump upstreams

Adopt:
- odlparent-13.0.7
- yangtools-11.0.4
- mdsal-12.0.3
- controller-8.0.3
- aaa-0.18.3

Change-Id: I4be9c89883dd429b4e2be60b59d55c41bdaedfed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoFactor out WebSocketFactory 62/108762/1
Robert Varga [Mon, 30 Oct 2023 22:33:25 +0000 (23:33 +0100)]
Factor out WebSocketFactory

WebSocketFactory is a simple immutable thing. Factor it out of
WebSocketInitializer and turn it into a record.

Also share a single instance for all invocations of
WebSocketInitializer.configure() -- allowing us to ditch a number of
fields.

JIRA: NETCONF-1102
Change-Id: I83b2d74eab081d35367133519bb23df0276ed7a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDisable WebSocketInitializer serialization 61/108761/2
Robert Varga [Mon, 30 Oct 2023 22:21:12 +0000 (23:21 +0100)]
Disable WebSocketInitializer serialization

Our servlet cannot be serialized because it has external dependencies.
Disable serialization and eliminate @SuppressFBWarnings annotations.

JIRA: NETCONF-1102
Change-Id: If4d1801745ea34b0704e6e4f8a534b302c1fc770
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRegister only one events servlet 60/108760/2
Robert Varga [Mon, 30 Oct 2023 22:02:34 +0000 (23:02 +0100)]
Register only one events servlet

SubscribeToStreamUtil and the corresponding servlet are strongly
related -- the former produces references to the latter.

Express this dependency by allocating both object in the same place and
pass them to their respective users.

This has the nice end result that we do not enable WS servlet when
configured to use SSE and vice-versa -- making it clear the two belong
together and paving the way towards making the two proper components.

Change-Id: I42b0878fa9c9ac4e4b5800bfde8719134a409c7a
JIRA: NETCONF-1102
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up websocket's prepareUriByStreamName() 58/108758/2
Robert Varga [Mon, 30 Oct 2023 21:17:22 +0000 (22:17 +0100)]
Clean up websocket's prepareUriByStreamName()

Use a switch expression to streamline UriBuilder use.

JIRA: NETCONF-1102
Change-Id: Ia0f1261fffd33faef48b14ff21a6446b7d236b8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoFix device notification not working with websockets 57/108757/1
Robert Varga [Mon, 30 Oct 2023 21:09:30 +0000 (22:09 +0100)]
Fix device notification not working with websockets

The routing of device notifications works only in through a hack in
RestconfDataStreamServiceImpl.

This patch refactors the implementation to properly assign a well-known
prefix, just as all the other adapters use, moving routing
appropriately.

JIRA: NETCONF-1102
Change-Id: I333a6d641d41a2e849b6004f8ec81020a9572283
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoReduce StreamsConfiguration proliferation 56/108756/2
Robert Varga [Mon, 30 Oct 2023 18:19:11 +0000 (19:19 +0100)]
Reduce StreamsConfiguration proliferation

The indirection through configuration is causing us to allocate multiple
instances of SubscribeToStreamUtil.

Refactor instantiation so that we really are using a single configured
instance.

JIRA: NETCONF-1102
Change-Id: Ib6028aad570e4fac6d77540c6bece1f44ef77113
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoChange CreateStreamUtil return types 28/108728/4
Robert Varga [Sun, 29 Oct 2023 21:26:39 +0000 (22:26 +0100)]
Change CreateStreamUtil return types

Move RestconfFuture allocation down to CreateStreamUtil, as we will need
asynchronous operations. Prepare for that by pushing the future down a
layer.

JIRA: NETCONF-1102
Change-Id: I0d3474319ce0de766483b527831fe507ab70ad5a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDo not reference streams in RestconfApplication 55/108755/1
Robert Varga [Mon, 30 Oct 2023 17:59:03 +0000 (18:59 +0100)]
Do not reference streams in RestconfApplication

The only reason we needed these references is because we were creating
stream subscriptions. That is no longer necessary, hence ditch this
leak.

JIRA: NETCONF-1099
Change-Id: I5a6c1354dd1b4edbddbc8b852ebfd3b8fb6010ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMove stream name allocation 10/108710/2
Robert Varga [Sun, 29 Oct 2023 15:24:45 +0000 (16:24 +0100)]
Move stream name allocation

ListenersBroker should really be tracking available streams in a single
map. This patch prepares the scenery by shifting the logic which creates
stream names down to ListenersBroker and makes CreateStreamUtil pick it
up from the returned adapter.

JIRA: NETCONF-1099
Change-Id: I16b1704d3a8e98ec1a3da4e57f88e97fd07a2d6a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoImplement create-notification-stream 47/107147/5
Robert Varga [Mon, 31 Jul 2023 10:02:24 +0000 (12:02 +0200)]
Implement create-notification-stream

Refactor YANG notification subscription to work with proper filters,
just as they did before NETCONF-342.

This leaves a chunk of commented-out code, which will be addressed in a
subsequent patch.

JIRA: NETCONF-1099
Change-Id: I36a370e67b440cba68f1a26430978273db61234e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up restconf-common dependencies 88/108688/3
Robert Varga [Thu, 26 Oct 2023 17:09:05 +0000 (19:09 +0200)]
Clean up restconf-common dependencies

We have a few warnings reported here, clean them up.

Change-Id: Ida88e1939b2901b642ea14798a4833954cdc05ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRemove NetconfServerFactory 49/108649/9
Robert Varga [Tue, 24 Oct 2023 21:22:52 +0000 (23:22 +0200)]
Remove NetconfServerFactory

NetconfServerFactory is not used anywhere, remove it along with its
single implementation class.

Refactor its unit tests to separate (Ssh,Tcp}NetconfServerTests,
properly specialized to what we need. This offers quite a few clean up
opportunities in the testing code, which are also implemented -- notably
reducing the number of warnings generated.

Finally clean up pom.xml as well, as the code updates lower
dependencies,  which need to be reflected back in order to keep
maven-dependency-plugin content.

JIRA: NETCONF-1106
Change-Id: I40445177aa1a8deaa8d5a0bcb41101447fa884be
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoHide SendErrorExceptionUtil 48/108648/4
Robert Varga [Tue, 24 Oct 2023 21:15:56 +0000 (23:15 +0200)]
Hide SendErrorExceptionUtil

This utility class is an implementation detail, hide it from the outside
world, allowing it to be split up in the future.

JIRA: NETCONF-1106
Change-Id: I362b5bc1f80af69ae6dde43ad8c9785c4f9baa25
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoInline NetconfServerSessionNegotiatorFactoryBuilder 47/108647/4
Robert Varga [Tue, 24 Oct 2023 21:13:07 +0000 (23:13 +0200)]
Inline NetconfServerSessionNegotiatorFactoryBuilder

Make the builder static inline class for the entity being built,
cleaning up the namespace a bit. This allows us to inline
transformCapabilities(), as it is only used in the builder.

JIRA: NETCONF-1106
Change-Id: Id22438e6212188f19c85ccb74d9d0d5077c2c84c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoWorkaround invalid password 78/108678/2
Robert Varga [Thu, 26 Oct 2023 10:58:45 +0000 (12:58 +0200)]
Workaround invalid password

Catch IAE which can, for example, be produced when we attempt to decrypt
a bad password.

JIRA: NETCONF-1114
Change-Id: I17154dea25cdec0252514ed803fbfaafd5060a6c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoBump SSHD to 2.11.0 34/108634/4
Robert Varga [Tue, 24 Oct 2023 15:32:26 +0000 (17:32 +0200)]
Bump SSHD to 2.11.0

https://github.com/apache/mina-sshd/blob/master/docs/changes/2.11.0.md

JIRA: NETCONF-1189
Change-Id: I4bd7e028f9340c7169317a10bd2ccf3d75e1058e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoReturn ImmutableSet from transformCapabilities() 46/108646/3
Robert Varga [Tue, 24 Oct 2023 21:03:23 +0000 (23:03 +0200)]
Return ImmutableSet from transformCapabilities()

Ditch use of Collections2 and modernize to return ImmutableSet, which
conveys the semantics.

JIRA: NETCONF-1106
Change-Id: Ic815d7236299a5da5737299b685fa13592fde2d8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMark deprecated login-password as obsolete 12/108612/2
Oleksandr Zharov [Tue, 24 Oct 2023 09:38:47 +0000 (11:38 +0200)]
Mark deprecated login-password as obsolete

Marked deprecated login-password as obsolete before removing it.

JIRA: NETCONF-1187
Change-Id: Ibc0e633621572aef109632b4c0f9a787020ba728
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
7 months agoEliminate use of checkArgument() 45/108645/1
Robert Varga [Tue, 24 Oct 2023 20:45:16 +0000 (22:45 +0200)]
Eliminate use of checkArgument()

This is an explicit check, make sure we isolate it as such.

Change-Id: Id69ae248ae69f62c227b69bacdd36baf13976aa8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDo not use NetconfServerFactory 42/108642/2
Robert Varga [Tue, 24 Oct 2023 18:12:12 +0000 (20:12 +0200)]
Do not use NetconfServerFactory

ConcurrentClientsTest is establishing only TCP sessions, which turns out
to be a very simple operation. Do not use NetconfServerFactory for that,
but rather talk to TCPServer directly.

JIRA: NETCONF-1106
Change-Id: I1ed165276d119de4fa2f07f8cc9db9bd13a9189e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoAdd BootstrapFactory 26/108626/4
Robert Varga [Tue, 24 Oct 2023 13:45:50 +0000 (15:45 +0200)]
Add BootstrapFactory

We have SSHTransportStackFactoryin in transport-ssh, which provides nice
encapsulation of Netty EventLoopGroups and utility
new(Server)Bootstrap() methods.

This patch introduces BootstrapFactory, making this utility available
to all users of transport-tcp -- reducing the need to muck directly with
NettyTransportSupport.

JIRA: NETCONF-590
Change-Id: I1e22dcf16dcd1aa6ef076717562fe84df41937da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRemove PublicKeyAuth 09/108609/6
Robert Varga [Mon, 23 Oct 2023 23:41:09 +0000 (01:41 +0200)]
Remove PublicKeyAuth

This class is not used anywhere, remove it. Also make
LoginPasswordHandler final, as there are no subclasses (and it is a
trivial implementation).

JIRA: NETCONF-1108
Change-Id: Ibb9acfd9aa2f6adeab767af46e3c048e1bf84d1b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMerge (Abstract)NetconfSessionNegotiator 08/108608/7
Robert Varga [Mon, 23 Oct 2023 22:37:29 +0000 (00:37 +0200)]
Merge (Abstract)NetconfSessionNegotiator

All NetconfSessionNegotiator are based on
AbstractNetconfSessionNegotiator, hence we can ditch the intermediate
interface to improve clarity.

JIRA: NETCONF-590
Change-Id: I952a2d0f03b8ff3d2dda3e6b382a93e9ba38168c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoOpenApi: Fix parameter types for paths 21/108321/11
lubos-cicut [Tue, 10 Oct 2023 18:37:19 +0000 (20:37 +0200)]
OpenApi: Fix parameter types for paths

Corrected the hard-coded "string" type for path parameters type to the
proper type. Created a test to verify that the Schema type is assigned
with the expected type.

JIRA: NETCONF-1168
Change-Id: I0c1ff3dd04044507840fe2c484145e8c5740776a
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoDo not start devices with invalid configuration 08/108508/8
Robert Varga [Wed, 18 Oct 2023 20:30:31 +0000 (22:30 +0200)]
Do not start devices with invalid configuration

We have an unfortunate modeling accident, where netconf-node's 'host'
and 'port' leaves cannot be made mandatory unless an incompatible change
is made.

This means invalid configuration may hit the configuration datastore
(rather than being rejected) and we need to deal with that.

Redefine ensureNode() to issue a deleteNode() on error and restructure
internals to capture required state before we make a decision whether
to start a node. This rids us of a source of NPE when the NetconfNode is
completely missing.

JIRA: NETCONF-1114
Change-Id: I2f0fd8a65d1c508cb439c1994cf6c446d051412d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
7 months agoClean up AuthenticationHandler 07/108607/4
Robert Varga [Mon, 23 Oct 2023 22:22:36 +0000 (00:22 +0200)]
Clean up AuthenticationHandler

We do not have an import conflict anymore, make things a tad more
concise.

Change-Id: I424cf907412bf1e01563bc863d5d56617c4be9d1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
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>