netconf.git
7 months agoMigrate netconf-nb to JUnit5 91/108991/1
Robert Varga [Thu, 16 Nov 2023 17:30:34 +0000 (18:30 +0100)]
Migrate netconf-nb to JUnit5

This is a simple test migrate it, updating mocking to eliminate
superfluous runs.

Change-Id: I7d89def26c6dfc84c870bf0289965e73b4fe46d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDisconnect netconf-topology-singleton from EventExecutor 83/108983/1
Robert Varga [Thu, 16 Nov 2023 08:57:58 +0000 (09:57 +0100)]
Disconnect netconf-topology-singleton from EventExecutor

EventExecutor is no longer used. Remove references to it and clean up
NetconfTopologySetupBuilder.

JIRA: NETCONF-1106
Change-Id: Icd9319ee527abe50af06d903a8b74937ae0a4858
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDisconnect netconf-topology from threadpool-config-api 05/108905/8
Robert Varga [Wed, 15 Nov 2023 15:14:33 +0000 (16:14 +0100)]
Disconnect netconf-topology from threadpool-config-api

We are just a simple user of thread pools here, make sure we do not rely
on specific details how the pools are created.

Also cleans up future handling within NetconfNodeHandler, paving the way
for further refinement.

JIRA: NETCONF-590
Change-Id: I94ca12604947d32a632fa8e846d052ad93ce4543
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up AbstractWriteTx 72/108972/3
Robert Varga [Wed, 15 Nov 2023 12:25:27 +0000 (13:25 +0100)]
Clean up AbstractWriteTx

Do not invoke init() directly from constructor is bad. Refactor the code
to have callers invoke init() as needed.

While we are at it, use Registration instead of AutoCloseable and use
assertThrows() instead of legacy Test(expected).

Change-Id: I7373d91ceedd07e138577e563776e881acc295c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean-up AbstractRestconfStreamRegistryTest 71/108971/3
Samuel Schneider [Wed, 15 Nov 2023 11:58:19 +0000 (12:58 +0100)]
Clean-up AbstractRestconfStreamRegistryTest

Remove unused methods from AbstractRestconfStreamRegistryTest.
Test which was using these methods was removed by:
https://git.opendaylight.org/gerrit/c/netconf/+/107210
also with the tested method/class.

The tested method was marked as @VisibleForTesting and the
original functionality is no longer present.

JIRA: NETCONF-1196
Change-Id: I05933b916af0019e0f07927b3658f198aaea1741
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
7 months agoTear down NETCONF session on keepalive timeout 00/108200/14
Robert Varga [Wed, 15 Nov 2023 11:03:53 +0000 (12:03 +0100)]
Tear down NETCONF session on keepalive timeout

The keepalive mechanism guards user-level invocations from timeouts, but
does not proactively react to the device failing to respond to the
keepalive request itself.

Fix this by adding a timeout for the keepalive request as well.

JIRA: NETCONF-966
Change-Id: I39f8ba16a3f85c450f601f0ce42201e2bdccc1d0
Signed-off-by: Martin Sunal <martin@paxet.io>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up RequestTimeoutTask 65/108965/2
Robert Varga [Wed, 15 Nov 2023 10:26:44 +0000 (11:26 +0100)]
Clean up RequestTimeoutTask

There is no point in cancelling the user future or re-enabling
keepalives, as we will do that when our onFailure() callback is invoked.

Change-Id: Ibdeddf1140b8e77e70d90e74ade23ac976fbc233
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoInvert enableKeepalive() check 64/108964/1
Robert Varga [Wed, 15 Nov 2023 10:06:55 +0000 (11:06 +0100)]
Invert enableKeepalive() check

Invert if/else condition to remove a negation.

Change-Id: I5af0c9fd49df39487b822ad151135f5aff8a3eb2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRemove unused suppressions 63/108963/1
Robert Varga [Wed, 15 Nov 2023 09:47:48 +0000 (10:47 +0100)]
Remove unused suppressions

SpotBugs is now better at analyzing nulls, hence we do not need these
suppressions.

Change-Id: I9e7835e5657a1d29ee967f0cdf3eb914cb843a86
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRemove JaxbContextResolver class 30/106430/4
Ivan Hrasko [Thu, 8 Jun 2023 13:19:42 +0000 (15:19 +0200)]
Remove JaxbContextResolver class

This class only provides unused ObjectMapper. Remove it.

Change-Id: I057f6be8fdcb979436576a3b2bbf41a62e48f305
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoMigrate test-tool StressClient to transport-api 62/108662/5
Ruslan Kashapov [Thu, 26 Oct 2023 07:17:22 +0000 (10:17 +0300)]
Migrate test-tool StressClient to transport-api

JIRA: NETCONF-1108
Change-Id: I7517bc2c2e69303fc853198ca59cdd4247cea556
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
7 months agoCall-home with ext service integration for TLS transport 91/108591/5
Ruslan Kashapov [Mon, 3 Jul 2023 14:51:49 +0000 (17:51 +0300)]
Call-home with ext service integration for TLS transport

Call-home test case added.

JIRA: NETCONF-1183
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Change-Id: Iff4fd61d10d62ead28ad48e5ac67f3cfd25ecaab

7 months agoMigrate netconf-topology to new transport 53/108253/18
Ruslan Kashapov [Mon, 23 Oct 2023 09:38:37 +0000 (12:38 +0300)]
Migrate netconf-topology to new transport

Deprecated NetconfClientDispatcher was replaced with
NetconfClientFactory for further migration. The call-home
components were updated only as ancestor component,
reflecting api changes.

JIRA: NETCONF-1108
Change-Id: Iade4fcaf0680d58319427020d1b1894e3c6ac75e
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoExt service integration support for Netconf SSH client 99/108499/10
Ruslan Kashapov [Wed, 18 Oct 2023 14:21:51 +0000 (17:21 +0300)]
Ext service integration support for Netconf SSH client

Netconf topology and call-home components are using
own services for authorization, configuration only
approach for ssh client is not sufficient.

JIRA: NETCONF-1108
Change-Id: Iac63445067b235437ebf6d2c06df7f9f22acbf89
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
7 months agoExt service integration support for SSH client 98/108498/11
Ruslan Kashapov [Mon, 3 Jul 2023 14:51:49 +0000 (17:51 +0300)]
Ext service integration support for SSH client

Netconf topology and call-home components are using
own services for authorization, configuration only
approach for ssh client is not sufficient.

JIRA: NETCONF-1108
Change-Id: Ie7ef8a60c21204ad9df69964423c451291d4ee77
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
7 months agoWire RestconfImpl to MdsalRestconfServer 10/108910/6
Robert Varga [Fri, 10 Nov 2023 09:01:08 +0000 (10:01 +0100)]
Wire RestconfImpl to MdsalRestconfServer

Our databind operations should strictly go through server, as that
is the true backed for everything. Update RestconfImpl to defer to
server. Also clean up code a bit.

JIRA: NETCONF-773
Change-Id: I85b965d3dd301e0e2d6209d08aeebd8ebed44afd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoClose device's source resolution on teardown 67/108167/15
Sangwook Ha [Mon, 2 Oct 2023 20:24:48 +0000 (13:24 -0700)]
Close device's source resolution on teardown

Checking the current connection status is not enough to guarantee that
schema setup was completed for the initial session-up event.

To resolve this close ListenableFuture for device schema resolution
when the 'onRemoteSessionDown' method is called.

This prevents unnecessary duplicate notification, creating duplicate
SchemaContext and avoid confusion in the connection state.

JIRA: NETCONF-1173
Change-Id: I7f84da4a9197db52a0c33d2640e0c2543e587d7b
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoDitch threadpool-config-api from netconf-server 04/108904/5
Robert Varga [Fri, 10 Nov 2023 01:26:41 +0000 (02:26 +0100)]
Ditch threadpool-config-api from netconf-server

Use direct integration with ScheduledExecutorService in a purely user
role.

JIRA: NETCONF-1106
Change-Id: Id624b8b27287fb268fae5435a705db23ed1cf819
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoAdapt netconf testtool for login-password removal 11/108911/3
Samuel Schneider [Fri, 10 Nov 2023 09:37:36 +0000 (10:37 +0100)]
Adapt netconf testtool for login-password removal

Adapt netconf testtool for removal of deprecated way of configuring
login/password (unencrypted) from odl-netconf-device YANG file.

JIRA: NETCONF-1198
Change-Id: Ibf5ca9fad8d88fceac6b6a79e449caf6f472429e
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
7 months agoEliminate RestconfInvokeOperationsServiceImpl 06/108906/2
Robert Varga [Fri, 10 Nov 2023 05:46:28 +0000 (06:46 +0100)]
Eliminate RestconfInvokeOperationsServiceImpl

This class handles only POST, merge it into
RestconfOperationsServiceImpl, which already handles GET.

JIRA: NETCONF-773
Change-Id: I1f61c4957c04f05333ec6438c85b356f3c1642eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoIntroduce restconf.server.{api,spi,mdsal} 77/108877/11
Robert Varga [Wed, 8 Nov 2023 06:44:48 +0000 (07:44 +0100)]
Introduce restconf.server.{api,spi,mdsal}

This patch refactors restconf-nb wiring by introducing:
- RestconfServer, capable of invokeRpc()
- RestconfStreamRegistry, being the public interface to ListenersBroker
- RpcImplementation, being a native RestconfServer RPC invocation interface

This allows us to split out RPCs and logic for individual
RestconfStream.Sources -- which now become normal components injected
into MdsalRestconfServer.

This necessitates dealing with the fact that ListenerBroker requires
configuration. We take this on by splitting Config Admin interactions
into OSGiNorthbound, which then instantiates components based on
configuration.

After the dust settles, we end up ditching a controller dependency and
have a pretty crisp model of what gets done where and how.

JIRA: NETCONF-773
Change-Id: I3ea139dd811b487d676353adf075dcb102abc0c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoExpose streams with all supported encodings 64/108864/12
Robert Varga [Mon, 6 Nov 2023 14:17:14 +0000 (15:17 +0100)]
Expose streams with all supported encodings

The entire idea of output-type for a stream is wrong. The user can
choose which encoding to pick based on operational datastore -- and
there we expose all encodings.

This requires a rather major refactor to deal with stream lifecycle:
- RestconfStream is the central point
- RestconfStream.Source is a source of events -- notifications, DTCL
- RestconfStream.Source.start() is invoked when the first subscriber
  arrives
- RestconfStream.Source is stopped when the last subscriber disappears
- both sides can terminate the stream

JIRA: NETCONF-1102
Change-Id: I6f7a196195ac96706c3c6b1797350e5fd96b261e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoFix JSON and XML PatchBodyWriter errors output 87/107687/21
Matej Sramcik [Mon, 4 Sep 2023 07:58:51 +0000 (09:58 +0200)]
Fix JSON and XML PatchBodyWriter errors output

When an error occurs on commit the result displays a global error
together with per-operation status, which is confusing and self
contradicting.

JsonPatchBodyWriter and XmlPatchBodyWriter edited to omit
per-operation status if global error is present.

Added tests for this behavior.

JIRA: NETCONF-1176
Change-Id: I228754e75189e8475fbd32fa0cb57272b35f654a
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
7 months agoAdd correct status code to YangPatch 80/108880/4
Peter Suna [Tue, 7 Nov 2023 16:17:36 +0000 (17:17 +0100)]
Add correct status code to YangPatch

Set the status code based on the first global error
or the first error in the PatchStatusEntity.

JIRA: NETCONF-1103
Change-Id: Ica4e503226e9323e02efc51cf28e07868177154d
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
7 months agoRemove obsoleted way of configuring password 49/108349/8
Robert Varga [Wed, 11 Oct 2023 12:40:32 +0000 (14:40 +0200)]
Remove obsoleted way of configuring password

We are removing the possibility to configure device's password
as plain text which has been deprecated and obsoleted in NETCONF 6.

JIRA: NETCONF-1187
Change-Id: I1a753dc89add34727a31f7fde723ac75b6327975
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
7 months agoFix OpenApi ignoring min-elements for list 78/108878/3
Matej Sramcik [Wed, 8 Nov 2023 10:25:23 +0000 (11:25 +0100)]
Fix OpenApi ignoring min-elements for list

Replace orElse(null).get() with orElseThrow().get() because
it can produce NullPointerException

JIRA: NETCONF-1172
Change-Id: If0b48b474f6a3e6ed4f6b939b9f5a0709c0244a7
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
7 months agoRefactor EventFormatter interface 76/108876/3
Robert Varga [Wed, 8 Nov 2023 00:52:48 +0000 (01:52 +0100)]
Refactor EventFormatter interface

We have some amount of method duplication and tangling. Move methods
around and clean them up.

JIRA: NETCONF-1102
Change-Id: Ica1af471d1c035142a77bfba14d94ebde624438a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoPopulate restconf-state/streams 75/108875/2
Robert Varga [Tue, 7 Nov 2023 19:17:08 +0000 (20:17 +0100)]
Populate restconf-state/streams

ListenersBroker needs to manage restconf-state/streams, so users
can locate the endpoint servicing each stream.

Pick up the required pieces from RestconfStateStreams and surrounding
commented-out code to generate proper entries.

Also clean up tests, so that we have nice and crispy test suite, without
duplications and asserting proper changes.

JIRA: NETCONF-1102
Change-Id: Ifddb9fba119e6580ac9cb1c6377b63285d8d6cb0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoImprove subscriber tracking 31/108831/12
Robert Varga [Fri, 3 Nov 2023 07:06:15 +0000 (08:06 +0100)]
Improve subscriber tracking

Create a dedicated immutable Subscribers object, which tracks handlers
and their corresponding formatters.

Subscribers are structured, so multiple subscribers with the same
formatter with reuse the same formatted message.

Each RestconfStream starts with Subscribers.empty(), indicating a first
subscriber is required. When we lose the last subscriber, Subscribers
will become null and we trigger stream removal.

This improves on the HashSet tracking in terms of memory footprint, as
we typically will have 0 or 1 subscribers.

The newly introduced indirection through Subscriber allows the
subscriber to dictate the actual formatter which we will use in upcoming
patches.

JIRA: NETCONF-1102
Change-Id: I75e581ed7615b883e65ea60285cd4c1ba09d109e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRefactor EventFormatter constants 51/108851/3
Robert Varga [Sat, 4 Nov 2023 00:54:23 +0000 (01:54 +0100)]
Refactor EventFormatter constants

NotificationFormatter currently hosts a few constants which are really
unrelated to its operation. Move them to the appropriate places.

JIRA: NETCONF-1102
Change-Id: I04d1ed574d7d8fb8bf0a431d3fbba367e894ac9f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoAllow RestconfStream to advertize multiple encodings 50/108850/2
Robert Varga [Sat, 4 Nov 2023 00:03:23 +0000 (01:03 +0100)]
Allow RestconfStream to advertize multiple encodings

Each stream can have multiple encodings -- which we currently do not
support, as we have a singular outputType.

Introduce EncodingName and the ability for RestconfStream to advertize
all encodings it supports. This paves the way for transport components
to select the encoding based on subscriber preferences.

JIRA: NETCONF-1102
Change-Id: I9dbe6f7a0805668e2bbaf18d369c709e71e341f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMove restconfStateStreamPath() 49/108849/1
Robert Varga [Fri, 3 Nov 2023 22:37:02 +0000 (23:37 +0100)]
Move restconfStateStreamPath()

Management of ietf-restconf streams is the domain of ListenersBroker,
move the constant and the single used utility method there.

JIRA: NETCONF-1102
Change-Id: Id44123f5409dd2507db8d55220f9daa8dda23351
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoUpdate sal-remote-augment model to rev 2023-11-03 48/108848/1
Robert Varga [Fri, 3 Nov 2023 22:23:51 +0000 (23:23 +0100)]
Update sal-remote-augment model to rev 2023-11-03

This brings a couple of changes:
- reformat to use two spaces instead of four
- eliminate unneeded things (like version 1)
- do not import-by-revision
- default datastore is CONFIGURATION, document that
- scope parameter is now obsolete as it is completely unused

JIRA: NETCONF-1102
Change-Id: Ifd4dc79575afbd2fb3f383fa8e210f47fecd1ac1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up stream class names 47/108847/4
Robert Varga [Fri, 3 Nov 2023 21:28:24 +0000 (22:28 +0100)]
Clean up stream class names

ListenerAdapter, AbstractStream et al. have rather unfortunate names.

Fix this by renaming:
- AbstractStream to RestconfStream
- AbstractNotificationListenerAdaptor to AbstractNotificationStream
- DeviceNotificationListenerAdaptor to DeviceNotificatioNStream
- ListenerAdapter to DataTreeChangeStream
- NotificationListenerAdapter to NotificationStream

JIRA: NETCONF-1102
Change-Id: Ib42d89344079c9815a628d9353abea15c67a72d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoEliminate AbstractStream.setCloseVars() 46/108846/2
Robert Varga [Fri, 3 Nov 2023 21:17:08 +0000 (22:17 +0100)]
Eliminate AbstractStream.setCloseVars()

We are only setting the DatabindProvider, which is something we have
when we create the stream. Update class design to get the provider in
constructor.

JIRA: NETCONF-1102
Change-Id: Ic46ef9ffe3200e254601d9c65f5a35e3fc39ef4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoListenersBroker requires DOMDataBroker 40/108840/6
Robert Varga [Fri, 3 Nov 2023 11:16:58 +0000 (12:16 +0100)]
ListenersBroker requires DOMDataBroker

Managing the contents of the operation data store is the responsibility
of ListenersBroker, not individual streams. We therefore ListenersBroker
should have a reference to it directly and not have it passed through
from each stream.

JIRA: NETCONF-1102
Change-Id: I79523e139648eacb36def92f24253f79af81b021
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoUse random UUIDs for stream names 45/108845/1
Robert Varga [Fri, 3 Nov 2023 17:47:56 +0000 (18:47 +0100)]
Use random UUIDs for stream names

Deriving stream names from their parameters is rather tacky, as it opens
up race conditions, lifecycle leaks and the lure to try to parse the
names out.

This patch refactors the logic to split stream name allocation, which is
now random, and creation of the actual stream via StreamFactory.

Since we now know names cannot conflict and that each AbstractStream has
its name embedded, we can do away with BiMaps and StampedLocks and
instead keep all streams in a single ConcurrentMap.

We end up removing a ton of duplicated code, allowing us to focus on
the lifecycle itself.

This in turn shows that we do not have an end-of-stream indicator for
subscribers to see -- so introduce it and pick up the resulting
DeviceNotificationListenerAdaptor clean ups.

This refactor also shows that {Json,Xml}NotificationListenerTest are
only testing NotificationFormatter, so we rename them and migrate to
JUnit5.

JIRA: NETCONF-1102
Change-Id: I043bebbd9240281cda9e29b41881de43f0a6b769
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoEliminate CreateStreamUtil 38/108838/5
Robert Varga [Fri, 3 Nov 2023 09:44:47 +0000 (10:44 +0100)]
Eliminate CreateStreamUtil

Integrate the functionality into ListenerBroker, before we end up
splitting it out.

JIRA: NETCONF-1102
Change-Id: I57fafd28bc602d81e06780515cf66c6e26627013
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoFix OpenApi ignoring min-elements for list 56/108456/28
Matej Sramcik [Mon, 16 Oct 2023 12:37:38 +0000 (14:37 +0200)]
Fix OpenApi ignoring min-elements for list

If list have min-elements parameter, it is ignored and example with
only one element is created.
Edited definitionGenerator to adhere to the amount of min-elements,
also if parameter is defined as key, unique examples are created for
string and number types.

MinItems and maxItems values are missing in list property,
so they are added.

JIRA: NETCONF-1172
Change-Id: I5411fe6dd451a87fd7bfa53eb47206685aa624e7
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
7 months agoClose device handler when it fails to connect 41/108841/1
Ivan Hrasko [Fri, 3 Nov 2023 12:48:13 +0000 (13:48 +0100)]
Close device handler when it fails to connect

Close RemoteDeviceHandler instance and thus delete operational data
for device from data-store when we failed to establish connection,
for example because of wrong password format used.

JIRA: NETCONF-1114
Change-Id: I9db06595a3867ec04ad30aa76b7a5b21c75b7a8f
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoEliminate RestconfStreamsSubscriptionService 35/108835/6
Robert Varga [Fri, 3 Nov 2023 09:08:54 +0000 (10:08 +0100)]
Eliminate RestconfStreamsSubscriptionService

Move the code to ListenersBroker pending further refactors. Also move
and comment-out RestconfStreamsSubscriptionServiceImplTest.

JIRA: NETCONF-1102
Change-Id: Iebe56ae46455d707ce522e16d8d640246bccd8e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoOpenApi: Document feature installation and usage 67/108467/11
Samuel Schneider [Mon, 16 Oct 2023 17:16:05 +0000 (19:16 +0200)]
OpenApi: Document feature installation and usage

Add dedicated paragraph into Netconf user guide which
document OpenApi feature installation and usage.

JIRA: NETCONF-1181
Change-Id: I46facaea023f9b981b12089448139affd336d7b2
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoClean up restconf-nb dependencies a bit 34/108834/3
Robert Varga [Fri, 3 Nov 2023 06:52:28 +0000 (07:52 +0100)]
Clean up restconf-nb dependencies a bit

maven-dependency-plugin is complaining about a number of things, fix at
least model artifact references.

Change-Id: Ic673f825ff7393f5a1b4cd7d049156870b20a157
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRemove BaseListenerInterface 33/108833/3
Robert Varga [Fri, 3 Nov 2023 06:46:48 +0000 (07:46 +0100)]
Remove BaseListenerInterface

BaseListenerInterface is directly implemented by
AbstractCommonSubscriber. Inline it and rename AbstractCommonSubscriber
to AbstractStream -- thus improving overall naming.

JIRA: NETCONF-1102
Change-Id: I6ef187bd736f22bd632936fb64ffa178eff375c7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoPurge AbstractNotificationsData 32/108832/4
Robert Varga [Fri, 3 Nov 2023 06:29:29 +0000 (07:29 +0100)]
Purge AbstractNotificationsData

Most of the methods here are completely unused, remove them and inline
the remainder into AbstractCommonSubscriber.

JIRA: NETCONF-1102
Change-Id: I1abdfaa522f4a215c9755de25e7d726f2177bb00
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoUpdate buffer readerIndex after XML parsing error 18/108818/2
Sangwook Ha [Thu, 2 Nov 2023 08:40:52 +0000 (01:40 -0700)]
Update buffer readerIndex after XML parsing error

The readerIndex of the input buffer may have not reached the end
of the message when XML parsing fails. And in this case unnecessary
decoding may get repeatedly triggered for the unread partial message.

Make sure that readerIndex advances to writerIndex so that the next
decoding can start for a new message and add a test case to show this
parsing error scenario.

It means that we can skip all readable bytes counted by:
(ByteBuff.writerIndex - ByteBuff.readerIndex).

JIRA: NETCONF-1194
Change-Id: I01b668eb0c995ff01435e983cdbba1490645909e
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>