netconf.git
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>