netconf.git
18 months agoUse Future.cause() for completion checking 48/102748/1
Robert Varga [Tue, 18 Oct 2022 18:45:14 +0000 (20:45 +0200)]
Use Future.cause() for completion checking

We know the future has completed, hence nullability of Future.cause()
is a quicker check for success.

Change-Id: Ie7baadb7fd744a8b7cfd58b01097997e71045ccd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoImprove default client parameters 41/102741/1
Robert Varga [Tue, 18 Oct 2022 15:15:14 +0000 (17:15 +0200)]
Improve default client parameters

Properties can be directly set, use that instead of mucking with strings
and maps.

Change-Id: I90dbef2431dff8206532445998177b7cb903928c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoCheck disconnected flag on each operation 40/102740/5
Robert Varga [Tue, 18 Oct 2022 14:44:39 +0000 (16:44 +0200)]
Check disconnected flag on each operation

We are performing a staggered setup during which we may encounter an
asynchronous disconnect. We have an atomic flag guarding this, which is
always flipped before disconnect enters critical region.

Check the flag at each synchronized connect stage and abort connection
if it is observed as flipped -- ensuring we cannot accidentally signal
channel activation after the channel has been close()d.

Also ditch the AtomicBoolean and instead use a simple VarHandle, saving
a few bytes of overhead.

JIRA: NETCONF-905
Change-Id: I857b1768b083c13ac5060a803a9ba6d4008c5e4b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRun AsyncSshHandler.onOpenComplete() on event loop 24/102724/3
Robert Varga [Tue, 18 Oct 2022 11:24:39 +0000 (13:24 +0200)]
Run AsyncSshHandler.onOpenComplete() on event loop

onOpenComplete() runs ctx.fireChannelActive(), which in turn talks to
other handlers. Netty silently delays the invocation if it is called
from a different thread.

Make sure we run onOpenComplete() on the appropriate executor, so that
the state transition and handler updates run synchronously.

JIRA: NETCONF-905
Change-Id: Id8c2f4cb1e045d5d5bb446801deec341ccb27e87
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoMake AsyncSshHandler final 23/102723/5
Robert Varga [Tue, 18 Oct 2022 09:50:10 +0000 (11:50 +0200)]
Make AsyncSshHandler final

AsyncSshHandler is a fixed-functionality block dealing with
multi-threaded transitions. Make sure it is final so we can reason about
what is going on.

JIRA: NETCONF-905
Change-Id: If494145662d8705eb81c3a5e7ee55a989c218ae1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRework AsyncSshHandler callback locking 22/102722/5
Robert Varga [Tue, 18 Oct 2022 09:15:33 +0000 (11:15 +0200)]
Rework AsyncSshHandler callback locking

We have top-half and bottom-half dispatch going on here, with both paths
acquiring the object lock. Unify callbacks and lock object before
deciding which path to take.

JIRA: NETCONF-905
Change-Id: Ic42a652ed06ea8bc90cbe504963cc1405dad7fdc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRun safelyDisconnect() on event loop 21/102721/5
Robert Varga [Tue, 18 Oct 2022 09:10:15 +0000 (11:10 +0200)]
Run safelyDisconnect() on event loop

The disconnect() operation needs to inform handlers of state
transitions, which should not be delayed. Netty provides indirects these
calls silently on thread mismatch, which we do not want.

Make sure to schedule safelyDisconnect() on the event loop, so that that
it cannot run concurrently with other channel tasks.

JIRA: NETCONF-905
Change-Id: Iffe98db142f9c407fca9f92e5d336a0484ef1eff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRename AsyncSshHandler.handleSshSetupFailure() 20/102720/4
Robert Varga [Tue, 18 Oct 2022 09:02:06 +0000 (11:02 +0200)]
Rename AsyncSshHandler.handleSshSetupFailure()

Rename this method to onOpenFailure() and move it to a more appropriate
place.

JIRA: NETCONF-905
Change-Id: I9ab3b6d4e7701fe3ee432ee0965322426dda0bec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRemove AsyncSshHandler.handleSshChanelOpened() 19/102719/4
Robert Varga [Tue, 18 Oct 2022 08:58:35 +0000 (10:58 +0200)]
Remove AsyncSshHandler.handleSshChanelOpened()

This is the locked bottom of onOpenComplete(), rename it and co-locate
it with its sole caller, making the code progression linear.

JIRA: NETCONF-905
Change-Id: I5a8fba44767535fb1e59bf48e3f4a422c0db3b59
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRemove AsyncSshHandler.handleSshAuthenticated() 18/102718/3
Robert Varga [Tue, 18 Oct 2022 08:55:29 +0000 (10:55 +0200)]
Remove AsyncSshHandler.handleSshAuthenticated()

This method is the locked bottom of onAuthComplete(), rename it and
split out onOpenComplete(), making the flow more linear. Also switch
to use getException() to discern success/failure, fixing up badly-named
mocks.

JIRA: NETCONF-905
Change-Id: I7a0c20b872b19b66e99144d0ce83636d6b4cd400
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRemove AsyncSshHandler.handleSshSessionCreated() 17/102717/2
Robert Varga [Tue, 18 Oct 2022 08:44:52 +0000 (10:44 +0200)]
Remove AsyncSshHandler.handleSshSessionCreated()

This method is the synchronized part of onConnectComplete(), move it
closer to its source and split out onAuthComplete(). Also switch to
using getException() to check for success/failure.

JIRA: NETCONF-905
Change-Id: Ic8a49491afa92d68cb0585538a3fc9ffb044e9cb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoAdd AsyncSshHandler.onConnectComplete() 16/102716/2
Robert Varga [Tue, 18 Oct 2022 08:27:19 +0000 (10:27 +0200)]
Add AsyncSshHandler.onConnectComplete()

Rather than using an anonymous listener, document the lifecycle event,
allowing us to refactor locking and extraction in the future. Also use
getException() to check for success.

JIRA: NETCONF-905
Change-Id: I8569ca007aefad634aff54294b475e565ac4f669
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoInline AsyncSshHandler.startSsh() 11/102711/2
Robert Varga [Mon, 17 Oct 2022 18:51:13 +0000 (20:51 +0200)]
Inline AsyncSshHandler.startSsh()

There is just no reason to have this method split out, inline it to its
sole user -- which is making interactions a bit clearer. We also see
that there is a blocking call, holding up the caller until the
connection succeeds.

JIRA: NETCONF-905
Change-Id: Iae781a743e670498c9329162bb05a7475f32d370
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 months agoFix a typo 91/102691/1
Robert Varga [Fri, 14 Oct 2022 00:32:01 +0000 (02:32 +0200)]
Fix a typo

'underlyinch' vs 'underlying'.

Change-Id: Icc224eadb60cb6029caafdc9e9bb603638e57bce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 months agoFinish the sentence 71/102671/1
Robert Varga [Thu, 13 Oct 2022 14:30:11 +0000 (16:30 +0200)]
Finish the sentence

The fix here broke off mid-sentence, finish that up.

Change-Id: I4e991d84e048e9fb1c9312444527b4a2dbb7c618
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 months agoExpire negotiation on event loop 15/102615/2
Robert Varga [Wed, 12 Oct 2022 11:54:06 +0000 (13:54 +0200)]
Expire negotiation on event loop

Rather than having to completely synchronize state transitions, make
sure we run expiry on the event loop.

JIRA: NETCONF-827
Change-Id: I8d02c025ceaf78d547848e7e92861cb125405141
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 months agoUse switch expression to dispatch session 14/102614/1
Robert Varga [Wed, 12 Oct 2022 11:29:27 +0000 (13:29 +0200)]
Use switch expression to dispatch session

We are displating on an enum: use a switch expression to ensure it is
always exhaustive.

Change-Id: I0623fefd3d81b2fe538509fdbaf790a6ee5cbbaf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 months agoDo not use Optional for SslHandler 13/102613/1
Robert Varga [Wed, 12 Oct 2022 09:50:31 +0000 (11:50 +0200)]
Do not use Optional for SslHandler

Use a simple @Nullable return instead wrapping and unwrapping it again.

Change-Id: I97d3475d4a8090ca7ac75e67c56d37997a58b859
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 months agoAdd draft-ietf-netconf-crypto-types model 01/102301/10
Robert Varga [Wed, 7 Sep 2022 10:27:37 +0000 (12:27 +0200)]
Add draft-ietf-netconf-crypto-types model

This is a prerequisite for other client/server models, most notably used
by the forthcoming transport-api implementations.

JIRA: NETCONF-590
Change-Id: Ib005461637dd1bdab7b1d7a37efbb9f070911bbe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 months agoBump versions to 4.0.3-SNAPSHOT 44/102444/1
Robert Varga [Thu, 22 Sep 2022 15:24:08 +0000 (17:24 +0200)]
Bump versions to 4.0.3-SNAPSHOT

This starts the next development iteration.

Change-Id: I7d37dc37de0971a4a775b41237804d79b13e5d37
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 months agoBump aaa to 0.16.3 43/102443/1
Robert Varga [Thu, 22 Sep 2022 13:09:29 +0000 (15:09 +0200)]
Bump aaa to 0.16.3

Pick up a fix from upstream.

Change-Id: I8d4cca5582ff2663155c58164e89370fecb5f929
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 months agoTeach netconf-impl about maximum incoming chunk size 02/102302/4
DanielCV [Wed, 7 Sep 2022 10:51:21 +0000 (16:21 +0530)]
Teach netconf-impl about maximum incoming chunk size

Negotiators can specify custom maximum chunk size, this patch teaches
netconf-impl's configuration to take advantage of that.

JIRA: NETCONF-898
Change-Id: I1532a7e56e496c55af0d510e0259479fe2508eb4
Signed-off-by: DanielCV <daniel.viswanathan@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoBump upstreams 03/102403/1
Robert Varga [Fri, 16 Sep 2022 19:44:08 +0000 (21:44 +0200)]
Bump upstreams

Adopt:
- mdsal-10.0.2
- controller-6.0.2
- aaa-0.16.2

Change-Id: I209dbfd3e08cb6b08eebf7d8406b380c17cfed0f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoCorrect test package 76/102376/1
Robert Varga [Wed, 14 Sep 2022 14:53:51 +0000 (16:53 +0200)]
Correct test package

Unit tests should reside in the same package as the classes they are
testing. Fix that up.

Change-Id: If286b23228bfaa2a753522a013bd77dcc4cdc6f7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoUse Set.of() in ApiDocApplication 75/102375/1
Robert Varga [Wed, 14 Sep 2022 14:51:19 +0000 (16:51 +0200)]
Use Set.of() in ApiDocApplication

Use an immutable set instead of a HashSet.

Change-Id: I9bc8a44c4224b28efe7a968e6b1abbe58614555b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoCleanup WebInitializer a bit 53/102353/4
Robert Varga [Mon, 12 Sep 2022 15:32:37 +0000 (17:32 +0200)]
Cleanup WebInitializer a bit

This class should be final and should specify its close() method.

Change-Id: Ia3e839781f5f7ea658af9ff5157260be197ff28e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoSlim down NetconfKeystoreAdapter 29/102329/2
Robert Varga [Fri, 9 Sep 2022 21:57:30 +0000 (23:57 +0200)]
Slim down NetconfKeystoreAdapter

There is no need to store DataBroker and our listen path, ditch these
two fields.

Change-Id: Ie5c1e13eaacebcb6f4636712ec352a449a201f43
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoClean up SslHandlerFactoryImpl a bit 28/102328/2
Robert Varga [Fri, 9 Sep 2022 12:03:17 +0000 (14:03 +0200)]
Clean up SslHandlerFactoryImpl a bit

Use an instanceof pattern and if/else chain instead of a checkArgument.
Also prefer Set.of().

Change-Id: I643fd75bd5191f1f9d9f434844d1b0e924433ad2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoClean up callhome TLS implementation 22/102322/2
Robert Varga [Fri, 9 Sep 2022 08:59:41 +0000 (10:59 +0200)]
Clean up callhome TLS implementation

We have fields for single-use listeners and we are using
GenericFutureListener with suppressions. Clean that up.

Change-Id: I59908f032a422a15ef67ee48f18e90ec5d2695e1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoClean up TcpClientChannelInitializer 21/102321/2
Robert Varga [Fri, 9 Sep 2022 08:58:29 +0000 (10:58 +0200)]
Clean up TcpClientChannelInitializer

There is no need to reference GenericFutureListener/DefaultPromise.
Adjust code accordingly.

Change-Id: I0518ab00611c45ddcf2c19b802ecb810fc94ca94
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoBump jquery to 3.6.1 51/102351/1
Robert Varga [Mon, 12 Sep 2022 13:31:28 +0000 (15:31 +0200)]
Bump jquery to 3.6.1

https://blog.jquery.com/2022/08/26/jquery-3-6-1-maintenance-release/

Change-Id: I5e5ae541c1acc5a1f0c8dc5699066ec6c2734851
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoRemove TestableContext 93/102293/1
Robert Varga [Mon, 5 Sep 2022 16:14:55 +0000 (18:14 +0200)]
Remove TestableContext

Use a simple spy() instead of a subclass here.

Change-Id: Ib714741641b125697984b1559e2f84d25ebeb309
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoImprove callhome-protocol unit tests 92/102292/1
Robert Varga [Mon, 5 Sep 2022 15:50:12 +0000 (17:50 +0200)]
Improve callhome-protocol unit tests

Do not mix Mockito references -- just use static imports. Also use
assertThrows() instead of Test(expected).

Change-Id: I3734828f3322665f330f9460042638adfbf7f3f5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoRemove unused parameter in CallHomeSessionContext.java 79/101779/13
Ivan Martiniak [Fri, 8 Jul 2022 12:24:51 +0000 (14:24 +0200)]
Remove unused parameter in CallHomeSessionContext.java

Parameter in the constructor 'final SocketAddress remoteAddress'
was marked as unused.
Method and tests related to this constructor were adjusted.

Resolved FIXME: Enable test
failureToOpenTheChannelShouldCauseTheSessionToClose().
Mock-maker-inline is used to be able to successfully run this test.

JIRA: NETCONF-681
Change-Id: Ifd8a76c6edcf801e432b7b925873806014b43b1a
Signed-off-by: Ivan Martiniak <ivan.martiniak@pantheon.tech>
20 months agoRemove draft paths from tests 17/102217/2
Ivan Hrasko [Thu, 25 Aug 2022 07:49:06 +0000 (09:49 +0200)]
Remove draft paths from tests

Remove old RESTCONF draft paths usage from tests. Now the only
available implementation is located at /rests/.

Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Change-Id: Id2b79f6c4c5ef83fb356aeccc12d4859d0a6b746

20 months agoRemove not-relevant swagger README 16/102216/2
Ivan Hrasko [Thu, 25 Aug 2022 07:41:00 +0000 (09:41 +0200)]
Remove not-relevant swagger README

Remove README file which contains no more relevant information:

- there are no multiple (RFC and draft) swagger UI links

- maven generator is no more available

JIRA: NETCONF-902
Change-Id: I80c055545babb0948ec35b314497d2c97d38c4f0
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
20 months agoRemove draft paths from swagger index.html 15/102215/2
Ivan Hrasko [Thu, 25 Aug 2022 07:36:30 +0000 (09:36 +0200)]
Remove draft paths from swagger index.html

RESTCONF draft 18 paths are no more used.
Remove them from swagger index.html.

JIRA: NETCONF-902
Change-Id: I7a72d3bdc634248ae88f087548f53442ce5e3601
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
20 months agoRemove draft paths from swagger 14/102214/2
Ivan Hrasko [Thu, 25 Aug 2022 07:33:17 +0000 (09:33 +0200)]
Remove draft paths from swagger

Nowadays we have only one RESTCONF implementation.
Remove RESTCONF draft 18 paths from swagger WebInitializer.

JIRA: NETCONF-902
Change-Id: I8605597b1c66caecc6a1e083078ab26a1484c6f7
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
20 months agoFix periodic NETCONF Call Home connection dropping 33/100133/37
ivan.martiniak [Tue, 28 Jun 2022 05:00:58 +0000 (07:00 +0200)]
Fix periodic NETCONF Call Home connection dropping

Callhome devices make reconnection every hour due to key re-exchange,
which is part of SSHD implementation.

When a specific session is authenticated and activated,
in case of key re-exchange, authentication (invoking of doAuth() method)
does not need to be made again.

While we are at it, also make sure CallHomeSessionContext's constructor
does not have side-effects -- while this cannot quite happen since we do
not reuse ClientSessions, it is a needless leak.

JIRA: NETCONF-681
Change-Id: I824c92d230c7570570d5eed21d489c435bdc8b22
Signed-off-by: Ivan Martiniak <ivan.martiniak@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoDo not embed netconf-impl 03/102203/1
Robert Varga [Mon, 22 Aug 2022 11:00:57 +0000 (13:00 +0200)]
Do not embed netconf-impl

Rather than embedding the dependency, use proper imports to satisfy the
needs of blueprint container.

JIRA: NETCONF-899
Change-Id: Iee2e2564384d3aa2660169c99ff375358b949a15
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoBump versions to 4.0.2-SNAPSHOT 59/102159/1
Robert Varga [Thu, 18 Aug 2022 21:54:43 +0000 (23:54 +0200)]
Bump versions to 4.0.2-SNAPSHOT

This starts the next development iteration.

Change-Id: I630b0fa640d8c4c805b07a841c26bdf2539d6d70
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoTeach netconf-client abount maximum incoming chunk size 24/101924/5
Robert Varga [Fri, 29 Jul 2022 17:37:09 +0000 (19:37 +0200)]
Teach netconf-client abount maximum incoming chunk size

Negotiators can specify custom maximum chunk size, this patch teaches
netconf-client's configuration to take advantage of that.

JIRA: NETCONF-897
Change-Id: I3ae11a860a61b4fb061ca785a545a38381b90e7c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoBump upstreams 58/102158/1
Robert Varga [Thu, 18 Aug 2022 21:50:28 +0000 (23:50 +0200)]
Bump upstreams

Adopt:
- odlparent-11.0.1
- yangtools-9.0.1
- infrautils-4.0.1
- mdsal-10.0.1
- controller-6.0.1
- aaa-0.16.1

Change-Id: Ic44d4773af1720661bea8b293d1c22a628480e54
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoFix incorrect level assignment during fields parsing 21/99421/7
Peter Puškár [Mon, 24 Jan 2022 11:30:39 +0000 (12:30 +0100)]
Fix incorrect level assignment during fields parsing

Everytime a sub-selector is encountered, new level is created.
This behaviour is not in accordance to the one described in Javadoc.
Side effects of this issue are missing data in RESTCONF, for NETCONF
mount-points it will fail with NullPointerException because LinkedPathElement is expected on previous level but it cannot be found.
Add proper level tracking and test-cases.
Example:
fields=security:objects(zones/zone);application-identification(user-defined-applications/user-defined-application/app-name)

incorrect structure before:
0 = security:objects, application-identification
1 = zones
2 = zone
3 = user-defined-applications
4 = user-defined-application
5 = app-name

correct structure after:

0 = security:objects, application-identification
1 = zones, user-defined-applications
2 = zone, user-defined-application
3 = app-name

JIRA: NETCONF-660
Signed-off-by: Peter Puškár <ppuskar@frinx.io>
Change-Id: Icaf7c181b23ce9f7110cd6f63f17b55b4c1bc322

21 months agoPass maximum chunk size to AbstractNetconfSessionNegotiator 21/101921/4
Robert Varga [Fri, 29 Jul 2022 16:27:21 +0000 (18:27 +0200)]
Pass maximum chunk size to AbstractNetconfSessionNegotiator

We want to be able to control incoming maximum chunk size on a
session-by-session basis. This patch allows session negotiators
to specify this value for each instance.

JIRA: NETCONF-888
Change-Id: Ib001942ada2d5445a558f30efc8b6ec2a12395d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDeprecate DEFAULT_MAXIMUM_CHUNK_SIZE 19/101919/3
Robert Varga [Fri, 29 Jul 2022 15:56:58 +0000 (17:56 +0200)]
Deprecate DEFAULT_MAXIMUM_CHUNK_SIZE

This is an artificial global limit. We provide the ability to specify
this limit on a per-instance basis and callers should be taking
advantage of that instead.

Change-Id: I3abbed74c37b4f9a9e820adf0c38fba160a8dc88
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoAllow NetconfChunkAggregator's maximum size to be adjusted 60/101860/8
DanielCV [Tue, 19 Jul 2022 13:39:05 +0000 (19:09 +0530)]
Allow NetconfChunkAggregator's maximum size to be adjusted

There are devices which send out arbitrarily-large chunks, requiring
a potentially large buffer to hold the incoming message.

This patch allows each instance to have a the chunk size specified
as well as control over the default size via a system property.

JIRA: NETCONF-888
Change-Id: Iec041a4ba9c8886cceb44fa86d07320bb5ae942b
Signed-off-by: DanielCV <daniel.viswanathan@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoReduce constructor visibility 23/101923/1
Robert Varga [Fri, 29 Jul 2022 16:42:49 +0000 (18:42 +0200)]
Reduce constructor visibility

NetconfServerSessionNegotiator is a final class, there is no point in
having a protected constructor.

Change-Id: Ib973cc1831cfab65b347f84a373f368d065e695e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse switch expression in FramingMechanismHandlerFactory 20/101920/2
Robert Varga [Fri, 29 Jul 2022 16:10:55 +0000 (18:10 +0200)]
Use switch expression in FramingMechanismHandlerFactory

Switch expressions are exhaustive, which is exactly what we want to
do here.

Change-Id: I32312c9ee8ac0f4e5da919b2b1d384a37cbadaad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoBump versions to 4.0.1-SNAPSHOT 98/101898/1
Robert Varga [Fri, 29 Jul 2022 11:22:00 +0000 (13:22 +0200)]
Bump versions to 4.0.1-SNAPSHOT

This starts the next development iteration.

Change-Id: I94404116224f8e07a48046385df33fb3705d7b3e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoReuse encoder 94/101894/1
Robert Varga [Fri, 29 Jul 2022 09:59:50 +0000 (11:59 +0200)]
Reuse encoder

This is a tiny improvement: reuse the encoder for initilization of all
three byte arrays.

Change-Id: Ic01e9fcf1667ca6f28e089dae291f9a7acfecd30
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse multi-line string literals 85/101885/3
Robert Varga [Thu, 28 Jul 2022 20:54:45 +0000 (22:54 +0200)]
Use multi-line string literals

We have JDK17, use mulit-line literals for the test.

Change-Id: Ibe46846fe96b75bc9156c85a2014df842968f5a2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoGet rid of Netty's DelimiterBasedFrameDecoder 90/75490/15
Jakub Morvay [Thu, 16 Aug 2018 12:02:02 +0000 (14:02 +0200)]
Get rid of Netty's DelimiterBasedFrameDecoder

Netty's DelimiterBasedFrameDecoder is not really effective when dealing
with huge NETCONF messages and reading them in just really small parts
at a time.

DelimiterBasedFrameDecoder always searches whole input ByteBuf for
delimiter when new input bytes are available. It performs the search
also on bytes already checked in previous tries. Obviously, this can be
really ineffective when reading large messages by very small parts at
a time.

Replace Netty's DelimiterBasedFrameDecoder by our own frame detection
implementation. The implementation remembers already checked part of
the input ByteBuf and searches the delimiter just in a new bytes
available.

JIRA: NETCONF-889
Change-Id: If5e78f4373d767f4cf465024313eeac873c1621d
Signed-off-by: Jakub Morvay <jmorvay@frinx.io>
Signed-off-by: Maros Marsalek <mmarsalek@frinx.io>
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove NetconfMessageConstants 86/101886/4
Robert Varga [Thu, 28 Jul 2022 20:43:57 +0000 (22:43 +0200)]
Remove NetconfMessageConstants

MessageParts are really something related to FramingMechanism, without
much further value. Get rid of it by moving interesting constants to
FramingMechanism.

Change-Id: I1e92dbc771876a53c12e8f60f4beed35de747529
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRename restconf-nb-rfc8040 to restconf-nb 81/101881/2
Robert Varga [Thu, 28 Jul 2022 17:10:50 +0000 (19:10 +0200)]
Rename restconf-nb-rfc8040 to restconf-nb

We only have RFC-compliant version of the northbound plugin, ditch the
rfc8040 qualifier.

JIRA: NETCONF-893
Change-Id: I75a9a7fd59bd23063662256a9c15309fb25fd966
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoReduce exception guard 82/101382/7
Robert Varga [Tue, 31 May 2022 19:04:53 +0000 (21:04 +0200)]
Reduce exception guard

We really should not be catching Exceptions here and once connect()
returns we should be completely asynchronous. Reduce the amount of
code protected by the try/catch block.

Change-Id: I673cc4f0a52cefd2659a5db5a96417e00fd89422
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoSplit out strategy decision error handling 81/101381/7
Robert Varga [Tue, 31 May 2022 18:59:29 +0000 (20:59 +0200)]
Split out strategy decision error handling

When the strategy determines that a connection attempt should not be
made it will throw an exception. Peel this case out of the rest of
connection handling and add a dedicated message.

Change-Id: I9dd897f487421ba096240ebc9e3d999a7a5d7489
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoTurn NetconfMessageConstants into a final class 84/101884/2
Robert Varga [Thu, 28 Jul 2022 18:24:50 +0000 (20:24 +0200)]
Turn NetconfMessageConstants into a final class

Keeping constants in an interface is an antipattern, correct that.

Change-Id: I71a49126ec05107dc09ff05e47d16ba461d92e9d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse strict String->byte[] conversion 83/101883/1
Robert Varga [Thu, 28 Jul 2022 18:15:30 +0000 (20:15 +0200)]
Use strict String->byte[] conversion

Improve defensiveness around constant encoding: the strings are expected
to be be ASCII-only, so enforce that by using a properly-configured
coder.

Change-Id: I991640d6ad6e4c928b64fdabcbe7f0b60418c7af
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoMessageParts should be a class 82/101882/1
Robert Varga [Thu, 28 Jul 2022 18:00:15 +0000 (20:00 +0200)]
MessageParts should be a class

Using interface to hold constants is an antipattern, ditch it.

Change-Id: I4b77c5d1ca6021f4381a17245ac3286ea36a08ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoMove SchemaExportContext 80/101880/1
Robert Varga [Thu, 28 Jul 2022 16:14:54 +0000 (18:14 +0200)]
Move SchemaExportContext

This class is tied to RestconfSchemaService, co-locate it in the same
package.

JIRA: NETCONF-837
Change-Id: I0961bc939230a028a0c3915cf1f9c3d9668063b6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoMove restconf.common.util 79/101879/1
Robert Varga [Thu, 28 Jul 2022 15:57:48 +0000 (17:57 +0200)]
Move restconf.common.util

The contents of this package is only used by
RestconfOperationsServiceImpl, move them there and mark them as
reprecated.

JIRA: NETCONF-837
Change-Id: I8624be2d6d55f78e01004da718d93c30399f31f1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoClean up ietf-netconf-monitoring-extension 57/101857/4
Robert Varga [Sun, 17 Jul 2022 22:26:43 +0000 (00:26 +0200)]
Clean up ietf-netconf-monitoring-extension

Use a proper OpenDaylight namespace in both module name and namespace.

JIRA: NETCONF-891
Change-Id: I5853e33134fc6c0dcea3b4635d36f7c85c9de35e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoMove ietf-netconf-monitoring-extension 55/101855/5
Robert Varga [Sun, 17 Jul 2022 15:40:24 +0000 (17:40 +0200)]
Move ietf-netconf-monitoring-extension

This is an implementation detail, let's make sure we treat it that way.

JIRA: NETCONF-891
Change-Id: I2de2dbf7c348f1790f9e2cec21db8b9cbfa0a2d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoDo not depend on ietf-netconf-monitoring-extension 56/101856/1
Robert Varga [Sun, 17 Jul 2022 22:16:15 +0000 (00:16 +0200)]
Do not depend on ietf-netconf-monitoring-extension

Since we are filtering content, there is no point to bring the
monitoring extension into the picture. Remove this dependency.

JIRA: NETCONF-881
Change-Id: Ib13baa2750671cbb6ebddc679c75b4de580d569d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoFilter non-standard nodes from NETCONF monitoring schemas 50/101850/5
Sangwook Ha [Thu, 14 Jul 2022 08:03:54 +0000 (01:03 -0700)]
Filter non-standard nodes from NETCONF monitoring schemas

Some NETCONF servers use augmented netconf-monitoring schema and
controller fails to parse XML with strict parsing requirement.

Add a filtering function based on the namespace of the XML node,
and filter out any node not in the netconf-monitoring namespace to
prevent parsing failure.

JIRA: NETCONF-881
Change-Id: I93b7da0baf00de59613d970fd4ec89e47eb26e58
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoCleanup models/rfc6470 dependencies 54/101854/1
Robert Varga [Sun, 17 Jul 2022 15:18:20 +0000 (17:18 +0200)]
Cleanup models/rfc6470 dependencies

We have both unused and used dependencies, clean them up.

Change-Id: Ia0bcf3b3bf882b0bc49da87acdd3324422dc38b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoFixups for model movement 43/101843/1
Robert Varga [Tue, 12 Jul 2022 22:34:59 +0000 (00:34 +0200)]
Fixups for model movement

Add references for RFC5277 models and fix RFC6022 description.

JIRA: NETCONF-890
Change-Id: I2d24ae830bc283538751f4efd7741287896cc540
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoRefactor standard model placement 41/101841/11
Robert Varga [Tue, 12 Jul 2022 15:31:27 +0000 (17:31 +0200)]
Refactor standard model placement

Rather than having standards models scattered throughout the repository,
dedicate a namespace, org.opendaylight.netconf.model, and a top-level
directory to hold them.

JIRA: NETCONF-890
Change-Id: I4bc667a3b4977bc00b929e6c03472952f6d3dcad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoAdd ietf-subscribed-notifications 74/97874/3
Robert Varga [Wed, 13 Oct 2021 10:58:13 +0000 (12:58 +0200)]
Add ietf-subscribed-notifications

RFC8639 defines baseline structures for subscribed notifications. Make
sure we package the corresponding model.

JIRA: NETCONF-814
Change-Id: I103c8bb64f51f837c85956d3ac091ff74e19573f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoDisable creating reduced netconf-testtol pom 17/101717/5
Peter Suna [Mon, 4 Jul 2022 11:29:06 +0000 (13:29 +0200)]
Disable creating reduced netconf-testtol pom

When dependency reduced pom for netconf-testtool is generated, it gets
overridden with scale-util pom.
Fix that by disabling creating reduced dependency pom.

https://maven.apache.org/plugins/maven-shade-plugin/shade-mojo.html#createDependencyReducedPom

JIRA: NETCONF-884
Change-Id: Iea5269782261d2d550cb534fa405ec0fadaced46
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
22 months agoUse a simple immutable leaf node 05/101505/7
Robert Varga [Wed, 8 Jun 2022 14:41:35 +0000 (16:41 +0200)]
Use a simple immutable leaf node

Remove a bit of redundancy and a reference to NormalizedNodeBuilder.

Change-Id: I5a62f1283a449f62c586a403992e3615a64f19a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoUse aaa-0.16.0 64/101764/1
Robert Varga [Wed, 6 Jul 2022 22:58:21 +0000 (00:58 +0200)]
Use aaa-0.16.0

Use the release version instead of snapshots.

Change-Id: I3253325939fb251341ca2ada037c8fe3fd0a5566
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoUse instanceof patterns in netconf-util 28/101728/2
Robert Varga [Mon, 4 Jul 2022 20:40:37 +0000 (22:40 +0200)]
Use instanceof patterns in netconf-util

We can improve expressiveness here, eliminating casts.

Change-Id: I0f4a43b9bbbf019dbf98f36037b7d1e8db47cae9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoUse instanceof pattern in netconf-impl 27/101727/2
Robert Varga [Mon, 4 Jul 2022 20:35:13 +0000 (22:35 +0200)]
Use instanceof pattern in netconf-impl

We can reduce verbosity by using a pattern match, use it.

Change-Id: Id92bda676d8c02f5670ae1aeacb526e20e6af03b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoUse instanceof pattern in RemoteNetconfCommand 26/101726/2
Robert Varga [Mon, 4 Jul 2022 20:31:12 +0000 (22:31 +0200)]
Use instanceof pattern in RemoteNetconfCommand

Remove duplicate casts, improving expressiveness.

Change-Id: I662686d163217a28d8d1c2d44e8ad1f7c3a7de4f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoUse of instanceof pattern match in XmlElement 25/101725/2
Robert Varga [Mon, 4 Jul 2022 20:28:08 +0000 (22:28 +0200)]
Use of instanceof pattern match in XmlElement

Improve expressiveness through check-and-cast mechanics.

Change-Id: Id837cf0e8f1791d1a4dae5a28b468209566a308f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoBump upstream versions 30/101630/7
Robert Varga [Mon, 27 Jun 2022 09:13:41 +0000 (11:13 +0200)]
Bump upstream versions

Adopt:
- odlparent-11.0.0
- infrautils-4.0.0
- yangtools-9.0.0
- mdsal-10.0.0
- controller-6.0.0
- aaa-0.16.0-SNAPSHOT

Change-Id: I2541823f98942f6cf03331416a57777539dfb9f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoModernize ParameterAwareNormalizedNodeWriterDepthTest 13/101713/1
Robert Varga [Sun, 3 Jul 2022 20:43:04 +0000 (22:43 +0200)]
Modernize ParameterAwareNormalizedNodeWriterDepthTest

Use List/Set.of() and System{LeafSet,Map}Node.

Change-Id: I40bea558245e060853e6a0f63092dcd96fa98ed1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoModerinize ParameterAwareNormalizedNodeWriterFieldsTest 12/101712/1
Robert Varga [Sun, 3 Jul 2022 20:40:49 +0000 (22:40 +0200)]
Moderinize ParameterAwareNormalizedNodeWriterFieldsTest

Uses System{LeafList,Map}Node, static imports and List/Set.of().

Change-Id: I754e39a4e409f4697fdb2510e4a211510595500d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoCleanup ParameterAwareNormalizedNodeWriterParametersTest 11/101711/1
Robert Varga [Sun, 3 Jul 2022 20:36:24 +0000 (22:36 +0200)]
Cleanup ParameterAwareNormalizedNodeWriterParametersTest

Use SystemLeafSetNode, static imports and Set/List.of().

Change-Id: Ida264c88e7121449bb191f6238114c7c30866c74
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoClean up SshClient factories 08/101608/2
Robert Varga [Mon, 20 Jun 2022 09:29:37 +0000 (11:29 +0200)]
Clean up SshClient factories

We really have only a single factory, remove the constant and inline
it to its sole caller. Also remove an unused factory.

Change-Id: I13523654e3ee4556365c3d809bcdf9f613aa6900
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoRemove use of yangtools.concepts.Builder 07/101607/3
Robert Varga [Mon, 20 Jun 2022 08:58:59 +0000 (10:58 +0200)]
Remove use of yangtools.concepts.Builder

This concept has been deprecated, let's not use it.

Change-Id: I25abbedb5bf9530d517e976c4e1bc1cded65d724
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoUse a local for nodeId 06/101606/2
Robert Varga [Mon, 20 Jun 2022 08:53:56 +0000 (10:53 +0200)]
Use a local for nodeId

We are accessing it twice, let's just use a local for it.

Change-Id: I7d221ed6ff34bdbea6b0d30f6309f8d1162effe2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoFix error message typo 04/101604/3
Peter Puškár [Mon, 20 Jun 2022 06:53:26 +0000 (08:53 +0200)]
Fix error message typo

The correct string is 'nonconfig', not 'non-config'.

JIRA: NETCONF-886
Signed-off-by: Peter Puškár <ppuskar@frinx.io>
Change-Id: If5b77c64f8f17885977c8700195ba6b910197e26

23 months agoHide AbstractGet 47/101547/2
Robert Varga [Thu, 9 Jun 2022 15:28:19 +0000 (17:28 +0200)]
Hide AbstractGet

This is an implementation detail, do not expose it outside the package.

Change-Id: Ia910a8cfe0f995cef38ccff382257275b61ab626
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoCorrect root vs. nested writeout 46/101546/3
Robert Varga [Thu, 9 Jun 2022 15:08:28 +0000 (17:08 +0200)]
Correct root vs. nested writeout

The instance identifier we are getting points to the data node, not to
its parent. Make sure we adjust event streaming accordingly.

JIRA: NETCONF-879
Change-Id: I198ff72674660dd7053a5224030c154a625c44e4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoSimplify trimming 04/101504/1
Robert Varga [Wed, 8 Jun 2022 14:31:14 +0000 (16:31 +0200)]
Simplify trimming

We have needlessly complicated if/else flows, simplify them.

Change-Id: I358482f477cce6f889895537572ed1ca2b4942f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoDo not use SchemaAwareBuilders in CreateStreamUtilTest 03/101503/1
Robert Varga [Wed, 8 Jun 2022 14:21:14 +0000 (16:21 +0200)]
Do not use SchemaAwareBuilders in CreateStreamUtilTest

The use of builders is clunky at best. Just use plain builders.

Change-Id: Id198e4a52ff54acf3296537d18e6768c5b6f54c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoFix AbstractGet.transformNormalizedNode() 98/101498/1
Robert Varga [Wed, 8 Jun 2022 11:21:03 +0000 (13:21 +0200)]
Fix AbstractGet.transformNormalizedNode()

We should not be adjusting the baseline twice. Make sure we only
pass the data identifier to downstream.

JIRA: NETCONF-879
Change-Id: Iec2cf9bd227b84c8c4651012695f2c296e5c3f25
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoCleanup Netconf538Test 97/101497/1
Robert Varga [Wed, 8 Jun 2022 11:12:13 +0000 (13:12 +0200)]
Cleanup Netconf538Test

Improve NormalizedNode structure allocation and import assertions.

Change-Id: I63156f3efcd63f8cdb56b2bd2fe6bab4e1f4131a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoClean up MdsalOperationProvider 95/101495/2
Robert Varga [Wed, 8 Jun 2022 10:36:36 +0000 (12:36 +0200)]
Clean up MdsalOperationProvider

Basic formatting fixes.

Change-Id: Ibcca569248dc6104ef13e6ae850cab27281557eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoRemove Netconf(Client)SessionPreferences 47/101447/3
Robert Varga [Thu, 2 Jun 2022 18:40:16 +0000 (20:40 +0200)]
Remove Netconf(Client)SessionPreferences

These NetconfClientSessionPreferences are a strictly netconf-client thing,
remove it and adjust its users. This also renders
NetconfSessionPreferences useless, hence those are removed as well.

JIRA: NETCONF-590
Change-Id: I72c5718182751cb869c13318b4b0133bdbd197ea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoRemove NetconfServerSessionPreferences 46/101446/4
Robert Varga [Thu, 2 Jun 2022 19:22:31 +0000 (21:22 +0200)]
Remove NetconfServerSessionPreferences

This class is a pure DTO used only internally in netconf-impl. Remove it
and adjust users accordingly.

JIRA: NETCONF-590
Change-Id: I1f99fbea705ce4a6128413ff7f68d782744bd68a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoAbstractNetconfSessionNegotiator uses only NetconfHelloMessage 43/101443/3
Robert Varga [Thu, 2 Jun 2022 18:24:23 +0000 (20:24 +0200)]
AbstractNetconfSessionNegotiator uses only NetconfHelloMessage

We have a bit over-zealous use of NetconfSessionPreferences. We really
just need the hello message for negotiation -- reducing the need to
have a generic parameter, which is only causing issues with SpotBugs.

JIRA: NETCONF-590
Change-Id: I7437fda181a447fe740aeed514c0eb3a779002e8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoCleanup restconf-common dependencies 40/101440/2
Robert Varga [Thu, 2 Jun 2022 17:05:48 +0000 (19:05 +0200)]
Cleanup restconf-common dependencies

We have quite a few warnings with some unused large dependencies, clean
all of that up.

Change-Id: Id908c23400437892ce181613286e98ce620ad54b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoCleanup restconf-nb-rfc8040 dependencies 39/101439/2
Robert Varga [Thu, 2 Jun 2022 16:44:06 +0000 (18:44 +0200)]
Cleanup restconf-nb-rfc8040 dependencies

We have a number of warnings here, clean them up as much as possible.

Change-Id: I6f75390c49171430de0da09f0c4c98a849e7c459
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoCleanup netconf-netty-util dependencies 38/101438/2
Robert Varga [Thu, 2 Jun 2022 16:09:08 +0000 (18:09 +0200)]
Cleanup netconf-netty-util dependencies

We have a few warnings here, clean them up.

Change-Id: I78ceb34fa252e3df4fb6e236b6fa45902501622c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoServerChannelInitializer should be final 37/101437/5
Robert Varga [Thu, 2 Jun 2022 09:51:59 +0000 (11:51 +0200)]
ServerChannelInitializer should be final

This is a simple implementation class, make sure it is final to keep
its interactions well-defined.

Change-Id: I7e276e85cf7c08e470657c46b5c2d394bee65a8d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoAdd AbstractClientChannelInitializer 36/101436/5
Robert Varga [Thu, 2 Jun 2022 09:47:20 +0000 (11:47 +0200)]
Add AbstractClientChannelInitializer

We have three distinct classes doing essentially the same thing,
add an intermediate abstract class to handle common functionality.

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