netconf.git
4 days agoSimplify working with Capability objects 71/107471/37
Oleksandr Zharov [Tue, 22 Aug 2023 11:40:01 +0000 (13:40 +0200)]
Simplify working with Capability objects

Added Utility class with two methods to simplify creating/parsing
Capability objects. The first is a method that can parse an urn
string and create a Capability from it. The second is a method that
extracts capabilities from all present modules.

Added test for new logic.

JIRA: NETCONF-1015
Change-Id: I85edf4e20d6b53677c0fe216c83edf4e6bdb010c
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
4 days agoDesign a Capability object model 46/105846/30
Robert Varga [Fri, 5 May 2023 00:21:03 +0000 (02:21 +0200)]
Design a Capability object model

Implemented YangModuleCapability and EXiCapability
which extend ParameterizedCapability.
These classes appear to represent YANG module capabilities
and have attributes like content, revision, module name,
features, deviations, etc.
Added enumeration of SimpleCapability which implements
the Capability interface, listing various NETCONF
capabilities based on different RFCs and drafts.

JIRA: NETCONF-1015
Change-Id: I6c935dc4818e1968d656ce00aa08fb82f7650fc5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
5 days agoRemove unnecessary check for canceled future 27/112227/4
Peter Suna [Tue, 18 Jun 2024 16:20:33 +0000 (18:20 +0200)]
Remove unnecessary check for canceled future

The requests queue contains only instances of UncancellableFuture
with "uncancellable" set to "true". Thus checking for cancellation
is unnecessary.

Change-Id: If63f271ebc6659f3d90de3c1b502678f28b1268d
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
5 days agoRelease semaphore after disconnection 26/112226/3
Peter Suna [Tue, 18 Jun 2024 16:13:36 +0000 (18:13 +0200)]
Release semaphore after disconnection

Ensure semaphore is released when requests are removed in
the tearDown method. This ensures that the concurrent RPC
limit corresponds accurately to the actual requests.

JIRA: NETCONF-1332
Change-Id: Id677b5d05805d50c193235f6b2a594bb76f0ef59
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
5 days agoCleanup OpenAPI tests 99/112299/3
Ivan Hrasko [Wed, 26 Jun 2024 11:16:26 +0000 (13:16 +0200)]
Cleanup OpenAPI tests

Use JUnit 5 code style (no more public test methods) and
remove unnecessary empty lines.

JIRA: NETCONF-1309
Change-Id: If14b89e2a6a39fe4b585a796bab4fffcaea7a339
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
5 days agoCheck for netconf interleave capability 38/110738/14
Samuel Schneider [Thu, 14 Mar 2024 16:49:40 +0000 (17:49 +0100)]
Check for netconf interleave capability

Add check for interleave capability.
Do not allow notification subscription at all if it is not present.

JIRA: NETCONF-91
Change-Id: Id346ff8c1c73eb8c1be4a006216b15dadebf3dd4
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
5 days agoPrevent NPE for Credentials 92/110192/50
Yaroslav Lastivka [Thu, 8 Feb 2024 13:22:54 +0000 (15:22 +0200)]
Prevent NPE for Credentials

Added mandatory field to Credential choice.
Changed the logic for writing device data into the OPERATIONAL
datastore to include credentials.

JIRA: NETCONF-1235
Change-Id: Ibb2640efcaf301c06e29199008a0c9cedf124a34
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
5 days agoUse JUnit5 code style in BugDocumentTest 74/112274/2
lubos-cicut [Tue, 25 Jun 2024 08:45:32 +0000 (10:45 +0200)]
Use JUnit5 code style in BugDocumentTest

Remove unnecessary access modifiers and simplify source for
parameterized test.

JIRA: NETCONF-1309
Change-Id: Ibc1fe843701d006ee0f98e8ee32fba96f62dbea5
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
5 days agoMigrate plugins/netconf-server-mdsal/notifications tests to JUnit5 10/111810/5
Oleksandr Zharov [Tue, 21 May 2024 17:59:27 +0000 (19:59 +0200)]
Migrate plugins/netconf-server-mdsal/notifications tests to JUnit5

Migrated plugins/netconf-server-mdsal/notifications tests from JUnit4
to JUnit5.

JIRA: NETCONF-1310
Change-Id: Ic34fa191ae4ddf84953b7fc12555ac0b1eff61ec
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
7 days agoRemove unnecessary casting 81/111681/4
lubos-cicut [Mon, 13 May 2024 09:19:54 +0000 (11:19 +0200)]
Remove unnecessary casting

Removed unnecessary casting of DataSchemaNode.

Change-Id: I60748937179fb6fdcda3b311e71d3fdb8bf74cd4
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
7 days agoOpenapi: Missing schema for node processed by another parent test 80/111680/6
lubos-cicut [Mon, 13 May 2024 08:41:38 +0000 (10:41 +0200)]
Openapi: Missing schema for node processed by another parent test

If the same node was a child of more than one parent, only the first
one was processed.

Parent patch fixes this problem. Now when node is processed it will be
saved with the current parent. This patch tests if generated document
is as expected.

Created new test to simplify testing of new reported bugs.

JIRA: NETCONF-1309
Change-Id: I7cc72f5d12286154056da6f5b551a11429518332
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
7 days agoOpenapi: Missing schema for node processed by another parent 79/111679/3
lubos-cicut [Mon, 13 May 2024 07:05:04 +0000 (09:05 +0200)]
Openapi: Missing schema for node processed by another parent

If the same node was a child of more than one parent, only the first
one was processed.

This patch fixes this problem. Now when node is processed it will
check if his clear name is saved in set of names.

JIRA: NETCONF-1309
Change-Id: Ia8360b2e51084001cc2a7a4e4645b301801c3a4c
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
12 days agoRemove most RestconfDocumentedException users 46/111346/18
Robert Varga [Tue, 18 Jun 2024 06:37:12 +0000 (08:37 +0200)]
Remove most RestconfDocumentedException users

ServerException provides equivalent facilities with better call
convention and semantics. Migrate most users over.

JIRA: NETCONF-1188
Change-Id: I1733374f38c645c25ab6a98ef6590530fbec17d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoEliminate TransactionUtil 21/112221/6
Robert Varga [Tue, 18 Jun 2024 08:38:17 +0000 (10:38 +0200)]
Eliminate TransactionUtil

The methods here are primarily used in RestconfStrategy implementations.
Rehost them there.

JIRA: NETCONF-1188
Change-Id: Ib0e2425a7664601981c6f0c2cfd352856a0bd358
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoBump sshd to 2.13.0 30/112230/1
Robert Varga [Wed, 19 Jun 2024 08:41:35 +0000 (10:41 +0200)]
Bump sshd to 2.13.0

https://github.com/apache/mina-sshd/releases/tag/sshd-2.13.0

Change-Id: I91417e758dcb2f9ee3d2fe08d8df692f646ebc5c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 days agoSupport auth* service integration for HttpTransport 35/111735/7
Ruslan Kashapov [Fri, 17 May 2024 13:29:12 +0000 (16:29 +0300)]
Support auth* service integration for HttpTransport

Due to channel handler is stateful object using same auth*
handler for multiple connection causes error. Fixed by
replacing handler instance with handler factory usage.

Server API extended to accept custom authn/authz handler
factory. This allows external services integration.

JIRA: NETCONF-1316
Change-Id: I99cd267c0955b93d10e7f75de31897533edb5b9b
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 days agoUse ServerException to report DOMRpcResult errors 19/112219/7
Robert Varga [Tue, 18 Jun 2024 06:05:43 +0000 (08:05 +0200)]
Use ServerException to report DOMRpcResult errors

Move RpcError mapping away from RestconfError and use it only in
ServerError.

Change-Id: I444aca99b2fe66167cb80bff3198484b768b4a7b
JIRA: NETCONF-1188
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 days agoMove RestconfFuture to rfc8040.rest.transations 18/112218/7
Robert Varga [Tue, 18 Jun 2024 04:18:02 +0000 (06:18 +0200)]
Move RestconfFuture to rfc8040.rest.transations

ExistenceCheck is the sole remaining user of RestconfFuture et al.
Relocate and hide these classes before we embark on more interation.

JIRA: NETCONF-1188
Change-Id: Ieb7590f75b0498a13b3e2793989da18a4bb3da79
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 days agoRemove RestconfDocumentedException throws 17/112217/8
Robert Varga [Tue, 18 Jun 2024 03:08:16 +0000 (05:08 +0200)]
Remove RestconfDocumentedException throws

Convert all remaining throwing callsites to throw ServerException
instead.

This introduces a ton of try/catch exception blocks around
RestconfTransaction. These will be dealth with in subsequent patches,
where RestconfTransaction gains proper ServerRequest integration.

This also flushes out a few tests which are asserting direct throws,
which we update here to use assertError() instead.

JIRA: NETCONF-1188
Change-Id: I0da8929a42496426cda8b172658014a828cb1c29
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 days agoRefactor ServerRequest 16/112216/6
Robert Varga [Mon, 17 Jun 2024 21:08:48 +0000 (23:08 +0200)]
Refactor ServerRequest

Our invocation currently routes responses via RestconfFuture and then
via RestconfCallback.

This is quite superfluous indirection, which we eliminate by expading
ServerRequest to being an entity that can be completed -- just like a
RestconfCallback.

We then create a specialized JaxRsServerRequest, which is essentially
what JaxRsRestconfCallback used to be, and use it instead of
RestconfFuture in RestconfServer.

JIRA: NETCONF-1188
Change-Id: I870d2dd444f43d71ebb2d249e76097af6d39c33f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 days agoMigrate netconf-topology-singleton tests to JUnit5 91/111691/8
lubos-cicut [Tue, 14 May 2024 12:54:11 +0000 (14:54 +0200)]
Migrate netconf-topology-singleton tests to JUnit5

Migrate tests in apps/netconf-topology-singleton from JUnit4 to JUnit5.

JIRA: NETCONF-1310
Change-Id: I0144238346fe180daaf30d865ddab58ba5db932f
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
2 weeks agoUse ServerException in PatchBody.toPatchContext() 07/112207/1
Robert Varga [Mon, 17 Jun 2024 17:18:23 +0000 (19:18 +0200)]
Use ServerException in PatchBody.toPatchContext()

The errors we are reporting are rather simple, perform the obvious
migration.

JIRA: NETCONF-1188
Change-Id: Id8272742e587ed007b974906e7123c7f7e9dd189
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize JsonPatchBody a bit 05/112205/1
Robert Varga [Mon, 17 Jun 2024 15:27:28 +0000 (17:27 +0200)]
Modernize JsonPatchBody a bit

Use arrows in switch cases to make things a bit more compact.

Change-Id: If89d745811c7ff4b3c9c985ad10d89beb08a0002
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoLimit usage of ensureParentsByMerge 52/111552/14
Yaroslav Lastivka [Mon, 29 Apr 2024 19:43:29 +0000 (22:43 +0300)]
Limit usage of ensureParentsByMerge

We should not used ensureParentsByMerge when communicating
with NETCONF devices.

EnsureParentsByMerge has been moved to MdsalRestconfTransaction
and will only be used for MdsalRestconfStrategy.

JIRA: NETCONF-1276
Change-Id: I14747d5b3e037ff2c98b4f05e613be8d0b5fdeda
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
2 weeks agoFix DefaultMapBodyOrder body sorting 86/112086/7
Robert Varga [Tue, 11 Jun 2024 18:03:45 +0000 (20:03 +0200)]
Fix DefaultMapBodyOrder body sorting

NormalizedNodeContainer allows a MapEntryNode to return its children in
any order. That means we can very much trigger a case when body ordering
does not match expectations.

Improve test coverage to 100%, fixing the accidental UOE path as well as
improving reported messages.

JIRA: NETCONF-1325
Change-Id: Ieb6942105521928744466ec8573ca3839cb970c3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFix typo in javadoc 98/112098/3
Samuel Schneider [Wed, 12 Jun 2024 10:04:45 +0000 (12:04 +0200)]
Fix typo in javadoc

Fix typo in javadoc of RemoteDeviceCommunicator#sendRequest method.

JIRA: NETCONF-1223
Change-Id: Ic88108540f17cd98e840224c763a1ea1f53dd335
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
2 weeks agoRemove RemoteDeviceCommunicator#sendRequest method 56/110356/14
Samuel Schneider [Tue, 27 Feb 2024 10:19:08 +0000 (11:19 +0100)]
Remove RemoteDeviceCommunicator#sendRequest method

Remove deprecated RemoteDeviceCommunicator#sendRequest method
with unused parameter.

JIRA: NETCONF-1223
Change-Id: I84a01dc67e55b6f6d5cb997944b635950d521efb
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
2 weeks agoMigrate ResourceBody to ServerException 69/112069/2
Robert Varga [Tue, 11 Jun 2024 11:42:06 +0000 (13:42 +0200)]
Migrate ResourceBody to ServerException

Clean up the overall migration tools and make sure ResourceBody uses
ServerException instead of RestconfDocumentedException.

JIRA: NETCONF-1188
Change-Id: Ic2b94a02c118c30632f345fde0f0607e17c32669
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoReplace qualified names with imports 74/112074/2
Ivan Hrasko [Tue, 11 Jun 2024 13:32:25 +0000 (15:32 +0200)]
Replace qualified names with imports

Replace qualified names with imports in CallHomeMountService class
documentation.

Change-Id: Id4b57e06ef4743aa6d2c442b379e8f51d7d5704c
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
2 weeks agoDocument RemoteDeviceCommunicator#sendRequest method 65/110865/10
Samuel Schneider [Tue, 19 Mar 2024 11:42:38 +0000 (12:42 +0100)]
Document RemoteDeviceCommunicator#sendRequest method

Add documentation for RemoteDeviceCommunicator#sendRequest.
As one of the parameters is unused mark the method as deprecated.
Add new one without the parameter.

JIRA: NETCONF-1223
Change-Id: I154c6e2940ed35013a9c8c51349f7c1d9ef46209
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
2 weeks agoAdd test for length parameter 98/111698/9
Yaroslav Lastivka [Wed, 15 May 2024 10:51:44 +0000 (13:51 +0300)]
Add test for length parameter

Added test case for regex generated strings restricted by length parameter

JIRA: NETCONF-1312
Change-Id: If9766decae06dfa241dc9abeb1f59ae3444c60f2
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
2 weeks agoAdd ability to limit string example length 56/111856/6
Yaroslav Lastivka [Mon, 27 May 2024 08:31:50 +0000 (11:31 +0300)]
Add ability to limit string example length

Implemented a new prepareExample method that provides the ability to
generate string based on regex and length parameters.

JIRA: NETCONF-1312
Change-Id: Ife7040c0ed474b4386acfb6d53c6e8a0e902a860
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
2 weeks agoReport ServerException from OperationInputBody.toPayload() 67/112067/3
Robert Varga [Tue, 11 Jun 2024 08:18:24 +0000 (10:18 +0200)]
Report ServerException from OperationInputBody.toPayload()

This peels another set of users RDE and moves them to using
ServerException.

JIRA: NETCONF-1188
Change-Id: I76cf15a2c4a47363fcf1f550a1ca8d7e5744ff78
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoReport ServerException from ChildBody.toPayload() 30/111730/6
Robert Varga [Sun, 19 May 2024 16:06:20 +0000 (18:06 +0200)]
Report ServerException from ChildBody.toPayload()

Migrate a set of users from RestconfDocumentedException to
ServerException.

This necessitates updating RestconfDocumentedException, so we can
properly propagate multiple errors and an EffectiveModelContext.

We also convert a number of RuntimeException to ServerException, so that
we have a more uniform error reporting semantics.

JIRA: NETCONF-1188
Change-Id: Iaacdaa519cdde6ee13730907a853a05d8f0dd764
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMigrate netconf-client-mdsal tests to JUnit5 20/111720/14
Yaroslav Lastivka [Fri, 17 May 2024 13:28:31 +0000 (16:28 +0300)]
Migrate netconf-client-mdsal tests to JUnit5

Migrate tests in a netconf-client-mdsal from JUnit4 to JUnit5.

JIRA: NETCONF-1310
Change-Id: I4f1622b5f41d96dce91d68500d2eedcbf327d68c
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
2 weeks agoMigrate netconf/netconf-netty-util 01/111701/6
Samuel Schneider [Wed, 15 May 2024 12:52:55 +0000 (14:52 +0200)]
Migrate netconf/netconf-netty-util

Migrate netconf/netconf-netty-util to JUnit5.

JIRA: NETCONF-1310
Change-Id: Ic68bca28f642dc689fe4036117da87e07b063665
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
2 weeks agoOpenAPI: Update module revision docs 69/111869/2
lubos-cicut [Tue, 28 May 2024 07:18:33 +0000 (09:18 +0200)]
OpenAPI: Update module revision docs

Updated documentation according changes made in NETCONF-1303. Revision
was changed to @QueryParam, so now we have to use
/mounts/1/toaster?revision=2009-11-20 for module with revision and
/mounts/1/definition-test for module without revision.

JIRA: NETCONF-1315
Change-Id: If3244d2e6f3b9a12154082eb9c499df8e3091072
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
3 weeks agoUtilize key-id for TLS devices in netconf-topology 51/109151/13
Ruslan Kashapov [Tue, 19 Mar 2024 10:59:57 +0000 (12:59 +0200)]
Utilize key-id for TLS devices in netconf-topology

When SslHandler is created all the private keys from
configured keystore are used for each device being
connected via TLS protocol. In order to use per device
defined keys new key-id configuration property is used.

JIRA: NETCONF-821
Change-Id: Ia0ea8382f646f8a48f05e5ccad81b8068ed07b4a
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
3 weeks agoAdd key-id into device TLS parameters 67/110867/5
Ruslan Kashapov [Tue, 19 Mar 2024 10:59:57 +0000 (12:59 +0200)]
Add key-id into device TLS parameters

New key-id leaf-list added for TLS connection-configuration in order
to allow specify the keys which are used to establish secure connection
with device.

JIRA: NETCONF-821
Change-Id: I87c346ce5eea2b9f95ddb10066472e75407f62d6
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
3 weeks agoDocument netopeer2 TLS port 60/112060/1
Ivan Hrasko [Mon, 10 Jun 2024 10:35:09 +0000 (12:35 +0200)]
Document netopeer2 TLS port

Document that when we want to use netopeer2 with TLS
we have to enable port 6513.

JIRA: NETCONF-1284
Change-Id: I6e21c668f3f473c338167e79d3cf7a49867b4e16
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
3 weeks agoFix device notification accept type 55/112055/2
Ivan Hrasko [Mon, 10 Jun 2024 09:01:37 +0000 (11:01 +0200)]
Fix device notification accept type

After websockets removal application/xml is no more valid
accept type for getting notifications from device.

Change it to: text/event-stream.

JIRA: NETCONF-1321
Change-Id: I957ada1ac4e0dd68d24d03cf1ed3887039626859
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
3 weeks agoMigrate netconf-client-mdsal/spi tests to JUnit5 19/111719/10
Yaroslav Lastivka [Fri, 17 May 2024 13:27:25 +0000 (16:27 +0300)]
Migrate netconf-client-mdsal/spi tests to JUnit5

Migrate tests in a netconf-client-mdsal/spi from JUnit4 to JUnit5.

JIRA: NETCONF-1310
Change-Id: I666a63da504be4cdd897353d42a64252c28206be
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
3 weeks agoMigrate netconf-server tests to JUnit5 77/111777/3
lubos-cicut [Mon, 20 May 2024 12:37:06 +0000 (14:37 +0200)]
Migrate netconf-server tests to JUnit5

Migrate tests in protocol/netconf-server from JUnit4 to JUnit5.

JIRA: NETCONF-1310
Change-Id: I6454472d9bbaaa57827c1ca38c190d6d193e0978
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
3 weeks agoMigrate netconf-server/spi tests to JUnit5 76/111776/3
lubos-cicut [Mon, 20 May 2024 12:36:40 +0000 (14:36 +0200)]
Migrate netconf-server/spi tests to JUnit5

Migrate tests in protocol/netconf-server/spi from JUnit4 to JUnit5.

JIRA: NETCONF-1310
Change-Id: Ib46eb271178511bd205fa895f9ca50719c9fdb0b
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
3 weeks agoMigrate plugins/netconf-server-mdsal/operations tests to JUnit5 09/111809/3
Oleksandr Zharov [Tue, 21 May 2024 17:25:20 +0000 (19:25 +0200)]
Migrate plugins/netconf-server-mdsal/operations tests to JUnit5

Migrated plugins/netconf-server-mdsal/operations tests from JUnit4
to JUnit5.

JIRA: NETCONF-1310
Change-Id: I82bcc37166645975e8633919d5e2da77270b446a
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
3 weeks agoMigrate protocol/netconf-client tests to JUnit5 03/111703/2
Matej Sramcik [Thu, 16 May 2024 04:57:52 +0000 (06:57 +0200)]
Migrate protocol/netconf-client tests to JUnit5

Migrate tests in protocol/netconf-client from JUnit4 to JUnit5.

JIRA: NETCONF-1310
Change-Id: Ica257e32bad20deebb525295eb6d97d8b36905a2
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
3 weeks agoMigrate restconf/restconf-nb tests to JUnit5 00/111700/12
Matej Sramcik [Wed, 15 May 2024 11:52:38 +0000 (13:52 +0200)]
Migrate restconf/restconf-nb tests to JUnit5

Migrate tests in arestconf/restconf-nb from JUnit4 to JUnit5.

JIRA: NETCONF-1310
Change-Id: Ib54819fa14b8673390d9986cd9669600f0b2985f
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
3 weeks agoRemove websocket from docs 26/111926/5
lubos-cicut [Mon, 3 Jun 2024 09:59:44 +0000 (11:59 +0200)]
Remove websocket from docs

Websocket based stream has been removed in NETCONF-1209. Adapted
NETCONF's user guide to reflect this change.

JIRA: NETCONF-1321
Change-Id: Ib68c110027e60a64f56c77e1e338e7906affd615
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
4 weeks agoMigrate netconf-client-mdsal/api tests to JUnit5 18/111718/8
Yaroslav Lastivka [Fri, 17 May 2024 13:25:37 +0000 (16:25 +0300)]
Migrate netconf-client-mdsal/api tests to JUnit5

Migrate tests in a netconf-client-mdsal/api from JUnit4 to JUnit5.

JIRA: NETCONF-1310
Change-Id: I43265cae38624fb6f016cf152ec7bb8c28ddf186
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
4 weeks agoMigrate netconf-client-mdsal/impl tests to JUnit5 17/111717/7
Yaroslav Lastivka [Fri, 17 May 2024 13:20:56 +0000 (16:20 +0300)]
Migrate netconf-client-mdsal/impl tests to JUnit5

Migrate tests in a netconf-client-mdsal/impl from JUnit4 to JUnit5.

JIRA: NETCONF-1310
Change-Id: I6153b44dc30b204ae9a2782153fa3fc7cceed480
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
4 weeks agoRemove the option to deliver streams over WebSockets 11/111711/4
Robert Varga [Thu, 16 May 2024 17:34:20 +0000 (19:34 +0200)]
Remove the option to deliver streams over WebSockets

We have been providing SSE-based delivery for a very long time and have
deprecated WebSockets in NETCONF-1208.

This patch completely removes this mode of delivery.

JIRA: NETCONF-1209
Change-Id: Ifc45d4e815abe84f7797b977a985457cd2cebd08
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoBump versions to 8.0.0-SNAPSHOT 75/111875/1
Robert Varga [Tue, 28 May 2024 11:24:55 +0000 (13:24 +0200)]
Bump versions to 8.0.0-SNAPSHOT

This starts the next major development iteration.

Change-Id: Ie73749dc4bea34bed11bfc79179362b1adac1e6f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoMigrate netconf-server/mapping tests to JUnit5 75/111775/1
lubos-cicut [Mon, 20 May 2024 12:36:20 +0000 (14:36 +0200)]
Migrate netconf-server/mapping tests to JUnit5

Migrate tests in protocol/netconf-server/mapping from JUnit4 to JUnit5.

JIRA: NETCONF-1310
Change-Id: Ia8578ea11320918012e236facbf2766f232df89c
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
6 weeks agoMigrate netconf-server/osgi tests to JUnit5 74/111774/1
lubos-cicut [Mon, 20 May 2024 12:35:31 +0000 (14:35 +0200)]
Migrate netconf-server/osgi tests to JUnit5

Migrate tests in protocol/netconf-server/osgi from JUnit4 to JUnit5.

JIRA: NETCONF-1310
Change-Id: I9062daee8f015e7dcbdbf615d28cb3f62bc840db
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
6 weeks agoMigrate netconf-server/api tests to JUnit5 73/111773/1
lubos-cicut [Mon, 20 May 2024 12:34:38 +0000 (14:34 +0200)]
Migrate netconf-server/api tests to JUnit5

Migrate tests in protocol/netconf-server/api from JUnit4 to JUnit5.

JIRA: NETCONF-1310
Change-Id: Ie99729cc76a6a88f29665e9f3b3790f51c055b5f
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
6 weeks agoBump versions to 7.0.6-SNAPSHOT 34/111734/1
Robert Varga [Mon, 20 May 2024 07:29:22 +0000 (09:29 +0200)]
Bump versions to 7.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: Iee9f890451738a8a151ecf057647074447b82e5f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoRelease netconf v7.0.5
jenkins-releng [Sun, 19 May 2024 18:03:50 +0000 (18:03 +0000)]
Release netconf

6 weeks agoOpenApi: Refactor inconsistent naming of modelContext 94/111694/5
lubos-cicut [Tue, 14 May 2024 16:17:32 +0000 (18:17 +0200)]
OpenApi: Refactor inconsistent naming of modelContext

In restconf-openapi is inconsistent naming of EffectiveModelContext,
this patch unify it to modelContext.

JIRA: NETCONF-1313
Change-Id: I64face48ef43b59bc489c3058fa5dfa4bcbb4e41
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
6 weeks agoUse ServerException in JaxRsRestconfCallback.transform() 29/111729/2
Robert Varga [Sun, 19 May 2024 15:23:26 +0000 (17:23 +0200)]
Use ServerException in JaxRsRestconfCallback.transform()

We have only a single implementation which throws, convert it to
ServerException.

JIRA: NETCONF-1188
Change-Id: I8127549346956632c311252c57e1dcb4c9d587e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoReport ServerException from ApiPathCanonizer 28/111728/3
Robert Varga [Sun, 19 May 2024 13:29:45 +0000 (15:29 +0200)]
Report ServerException from ApiPathCanonizer

This is the next step in RDE eradication.

JIRA: NETCONF-1188
Change-Id: I9123b37849636e7d38167b280265d0d900565a96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoReport ServerException from ApiPathNormalizer 24/111724/4
Robert Varga [Sat, 18 May 2024 22:54:15 +0000 (00:54 +0200)]
Report ServerException from ApiPathNormalizer

This patch takes a step away from RestconfDocumentedException by making
APiPath normalization requests report ServerException instead.

We also update ServerException to match RestconfDocumentedException's
behaviour of reporting cause message in error-info.

JIRA: NETCONF-1188
Change-Id: I51aa91d4b3c914a421fe28a9ed8a517be1e47571
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoEnhance Netconf message handling 74/111474/8
Yaroslav Lastivka [Mon, 22 Apr 2024 08:55:42 +0000 (11:55 +0300)]
Enhance Netconf message handling

Enhance the `onMessage` method in the NetconfServerSession handler to
include detailed response handling and error logging for outgoing
Netconf messages. This update introduces a listener to the
`sendMessage` call, which logs failures to send messages and
confirms successful transmissions. The changes aim to improve
debugging capabilities by providing specific message IDs for
each failed or successful send operation, aiding in better
traceability and error handling in the communication process.

JIRA: NETCONF-1261
Change-Id: I088da6832d3ab267717ee122d53371bf05e8360c
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoMigrate SessionNotificationProducer 23/111723/1
Robert Varga [Sat, 18 May 2024 22:52:10 +0000 (00:52 +0200)]
Migrate SessionNotificationProducer

Sessions pertain to oper state, hence in terms of notifications they are
cluster-global. This changes behaviour towards reflecting what the
injected DOMDataBroker is bound to see.

Change-Id: I35549c5a8ec59364de05fd18e5192992d7d69906
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoRemove DatabindFormattableBody 22/111722/1
Robert Varga [Sat, 18 May 2024 20:37:32 +0000 (22:37 +0200)]
Remove DatabindFormattableBody

This class does not bring much to the party, integrate it into its sole
subclass.

JIRA: NETCONF-773
Change-Id: I8caeedca764b7045ab40ad6d27e9c0af5be5a658
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoUse ServerError in PatchStatus{Context,Entity} 21/111721/1
Robert Varga [Sat, 18 May 2024 20:11:31 +0000 (22:11 +0200)]
Use ServerError in PatchStatus{Context,Entity}

RestconfError is not properly structured, use ServerError, which
correctly models errors. This in turn allows PatchStatusContext to not
have a DatabindContext.

JIRA: NETCONF-1188
Change-Id: I288ad55de771474930362eb570ba315f5b700905
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoUse non-deprecated writeValue() 16/111716/2
Robert Varga [Fri, 17 May 2024 12:32:56 +0000 (14:32 +0200)]
Use non-deprecated writeValue()

Inline the behaviour of the default method to remove two sources of
warnings.

Change-Id: I5716cafff41d33ae916759f761ca48eb59b7456c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoUse simpler parseValue() 15/111715/2
Robert Varga [Fri, 17 May 2024 12:32:04 +0000 (14:32 +0200)]
Use simpler parseValue()

We have parseValue(String), use that instead of playing tricks with
null.

Change-Id: I7c4567ed0fb2db9d018c5aa8e5166910a8e02ed7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoMigrate a user of Builders 14/111714/2
Robert Varga [Fri, 17 May 2024 12:31:33 +0000 (14:31 +0200)]
Migrate a user of Builders

We have ImmutableNodes as a replacement, use that.

Change-Id: I9a41d87982f8ea992e379b75c18e72edc70322ae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoCatch correct exceptions when decrypting password 15/110515/10
Samuel Schneider [Thu, 7 Mar 2024 09:11:13 +0000 (10:11 +0100)]
Catch correct exceptions when decrypting password

Catch correct exceptions when we fail to decrypt password.
It has been changed from IAE to ISE by: 15f04f0 which adopts
improvement made in AAA-266.

This adaptation makes our workaround to work again.

JIRA: NETCONF-1114
Change-Id: I86741e51855cfee687e56b5991ae39a8b08cd9f7
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
6 weeks agoRemove HackJsonWriter 10/111710/2
Robert Varga [Thu, 16 May 2024 17:04:16 +0000 (19:04 +0200)]
Remove HackJsonWriter

We have a fix for JSONCodec.unparseValue() available, hence we can
remove our HackJsonWriter.

Change-Id: I2c42920835236c3090f3f7fa6752962583b9c1d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoRemove OperationOutputBody 09/111709/4
Robert Varga [Thu, 16 May 2024 16:36:54 +0000 (18:36 +0200)]
Remove OperationOutputBody

We have a fix for YANGTOOLS-1570 integrated, hence we do not need
to special-case anything -- a plain ContainerNode can we used with an
inference pointing to the operation.

JIRA: NETCONF-773
Change-Id: I0a70e067a796a7197a80d0312fdce90f793f08df
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoCapabilities unavailable for yang models without revision 51/111351/4
Yaroslav Lastivka [Thu, 11 Apr 2024 06:18:10 +0000 (09:18 +0300)]
Capabilities unavailable for yang models without revision

The updated logic now gracefully handles optional revisions
by defaulting to an empty string ("") when the revision is not present.
This change ensures that capabilities for Yang models without
a specified revision can be retrieved successfully, aligning
with modifications in the netconf module that now require an
empty string to represent models without a revision.

JIRA: NETCONF-1263
Change-Id: I65da21f877f572cc227ac5ec1ca8c76bf66a8b77
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
6 weeks agoOpenAPI: Generate document for module without revision 22/111522/5
lubos-cicut [Fri, 26 Apr 2024 04:08:49 +0000 (06:08 +0200)]
OpenAPI: Generate document for module without revision

Changed revision to @QueryParam. So now we have to use
/mounts/1/toaster?revision=2009-11-20 for module with revision and
/mounts/1/definition-test for module without revision.

JIRA: NETCONF-1303
Change-Id: Ia75180a9aad95182248041c117d0868bae94a856
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
6 weeks agoBump upstreams 02/111702/5
Robert Varga [Wed, 15 May 2024 15:13:02 +0000 (17:13 +0200)]
Bump upstreams

Adopt:
- odlparent-13.1.2
- infrautils-6.0.8
- yangtools-13.0.5
- mdsal-13.0.3
- controller-9.0.3
- aaa-0.19.4

Change-Id: I8b65d1e89d8ae00c81a94aaf7f3c992aa6014fb1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoOpenApi for TransportPCE with controller resources fix 81/111281/18
lubos-cicut [Fri, 5 Apr 2024 11:54:13 +0000 (13:54 +0200)]
OpenApi for TransportPCE with controller resources fix

Openapi did not fully work for TransportPCE when we selected
"Controller resource - Restconf RFC 8040". This was due to multiple
generation of the API for models with a different revision, now it
is only generated for the latest version.

Added tests for this case which show that the models are loaded
correctly and targeting to a model with an old revision returns the
correct output.

JIRA: NETCONF-1279
Change-Id: I3042c51715eddfaabe0a1179f1fd0d6cabc9c976
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
6 weeks agoCleanup document tests 05/111705/1
Ivan Hrasko [Thu, 16 May 2024 07:49:57 +0000 (09:49 +0200)]
Cleanup document tests

Remove unnecessary empty lines from *DocumentTest(s).

Change-Id: I8548b6f7171ec2a22310a74edad767035da0cf4c
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
6 weeks agoFix incorect pattern for mac-address 96/111696/2
Yaroslav Lastivka [Wed, 15 May 2024 09:06:47 +0000 (12:06 +0300)]
Fix incorect pattern for mac-address

The length parameter has to be equally limiting or more limiting than
the pattern length constraint.
Length parameter has been removed.MacAddress pattern has been
replaced with correct from ietf-yang-types model.

JIRA: NETCONF-1312
Change-Id: I7553c934f375f0b0d4e77647528cb6b624b44af9
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
6 weeks agoTests improvement for duplicated schemas 30/111230/4
Samuel Schneider [Wed, 3 Apr 2024 16:15:50 +0000 (18:15 +0200)]
Tests improvement for duplicated schemas

Improve test for duplicated schemas to better test
usage of discriminator.

JIRA: NETCONF-1270
Change-Id: I7cabefed15a798b89d200cf6338a65253d89c5c6
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
7 weeks agoFix instance-identifier key being not recognized properly 44/111644/1
Ruslan Kashapov [Tue, 7 May 2024 11:09:19 +0000 (14:09 +0300)]
Fix instance-identifier key being not recognized properly

List key of type instance-identifier require own context
based codec to properly parse the value. Previous usage
TypeDefinitionAwareCodec (serves primitive types) resulted
NPE due to absence of associated codec.

JIRA: NETCONF-1214
Change-Id: Iaefe44b2be8346f55d4087b4512c010354fd2da6
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
2 months agoBind OutboundChannelHandler to ChannelAsyncOutputStream 35/111535/2
Robert Varga [Thu, 25 Apr 2024 22:53:59 +0000 (00:53 +0200)]
Bind OutboundChannelHandler to ChannelAsyncOutputStream

Our Netty/SSHD integration uses asynchronous streams. This means that we
get to use ChannelAsyncOutputStream, which does not allow multiple
writes to be issued.

Make sure we verify this assumption when we are attaching the IO
underlay and make sure we perform out internal buffering.

JIRA: NETCONF-1299
Change-Id: I30baa080989dc9aabd134977575f47bdaa9e18d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoAdd MapBodyOrder 64/111464/6
Robert Varga [Fri, 19 Apr 2024 07:06:15 +0000 (09:06 +0200)]
Add MapBodyOrder

Make DefaultNormalizedNodeWriter a final class by extracting out the
child sorting logic into a pair of classes.

This exposes the fact that ordered and unordered output behaves
differently -- the latter includes map entry keys. This output is not
possible to trigger under normal circumstances, so we adjust the tests
to assert the ordered behaviour.

JIRA: NETCONF-773
Change-Id: Ia70295cd048b97dfc284f014e477cfd72a5d347a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoClean up InOrder assertion 69/111469/1
Robert Varga [Fri, 19 Apr 2024 15:39:48 +0000 (17:39 +0200)]
Clean up InOrder assertion

The use of times(2) is confusing -- we actually want the invocations in
strict order.

Change-Id: Ib723347b9ae9cc6cee546f98bc77710d05b145fd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRefactor NormalizedNodeWriter 53/111453/2
Robert Varga [Thu, 18 Apr 2024 23:01:04 +0000 (01:01 +0200)]
Refactor NormalizedNodeWriter

Split out the baseline abstract class, which performs dispatch. Keep the
actual logic separately. This will allow us to specialize
implementations further.

JIRA: NETCONF-773
Change-Id: I6840eb5a21c326d7788679c7fd246c3f04dcdefb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoPropagate DatabindContext to RestconfTransaction 42/111442/2
Robert Varga [Wed, 17 Apr 2024 16:06:35 +0000 (18:06 +0200)]
Propagate DatabindContext to RestconfTransaction

We will need to be producing ServerErrorPaths from RestconfTransactions,
for which we need more than just the EffectiveModelContext.

JIRA: NETCONF-1188
Change-Id: I10e63d7759f9351455242e99c14c70957f6c8e30
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoYangErrorsBody is a FormattableBody 37/111437/2
Robert Varga [Tue, 16 Apr 2024 19:54:11 +0000 (21:54 +0200)]
YangErrorsBody is a FormattableBody

We have a well-defined mapping to both JSON and XML formats, let's reuse
that binding.

JIRA: NETCONF-1188
Change-Id: I4e120a6f8403cd46f2487127ad08786a71da62e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoAdd YangErrorsBody 35/111435/2
Robert Varga [Tue, 16 Apr 2024 16:28:43 +0000 (18:28 +0200)]
Add YangErrorsBody

YangErrorsBody is the canonical server-side representation of a set of
reported errors.

Shift serialization logic to this server.api construct, eliminating the
use of intermediate transformers in favor of a centralized indenting
constract.

JIRA: NETCONF-1188
Change-Id: If9f0b8c91a93726444e45b9c261aeb198cc9cc00
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoUpdate notification subscription user guide 38/111338/3
Samuel Schneider [Tue, 9 Apr 2024 15:19:49 +0000 (17:19 +0200)]
Update notification subscription user guide

Update notification subscription user guide to reflect
usage of random UUIDs for stream names and necessity to
specify encoding in url.

JIRA: NETCONF-1272
Change-Id: I6dc49670e55df1b6fdf8256dde6ab07274dd882c
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
2 months agoRemove "/" sign in AbstractRestconfStreamRegistry 72/111272/5
Yaroslav Lastivka [Fri, 5 Apr 2024 06:31:28 +0000 (09:31 +0300)]
Remove "/" sign in AbstractRestconfStreamRegistry

In AbstractRestconfStreamRegistry#baseStreamLocation, the method generated
incorrect paths containing a double slash after `rests` in the device
notification stream URL. This error occurred because URI.getPath()
always includes a trailing slash. Additionally, the UriInfo.getBaseUri()
method, used within JaxRsRestconf, also consistently appends a slash
at the end.

Document this fact in RestconfServer and do not append it in
AbstractRestconfStreamRegistry.

JIRA: NETCONF-1274
Change-Id: Ib5074dc150d27a8482c7e49f89549973ab707270
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoFix 500 server error in PUT request 28/111228/3
Oleksandr Zharov [Wed, 3 Apr 2024 15:34:03 +0000 (17:34 +0200)]
Fix 500 server error in PUT request

Fixed error response for PUT create device request. One of the catch
cases didn't throw errors in the correct way causing a 500 server
error response instead of a proper message.

JIRA: NETCONF-1268
Change-Id: Iaf94814c5f5b1f4ad3bb12c8408ffa72acf0d25c
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
2 months agoMigrate netconf-topology tests to JUnit 5 19/111319/9
lubos-cicut [Mon, 8 Apr 2024 06:30:24 +0000 (08:30 +0200)]
Migrate netconf-topology tests to JUnit 5

Migrated tests in netconf-topology package to JUnit 5.

JIRA: NETCONF-1282
Change-Id: Iee0ddc762309e9c9329805db68593b30f88e98f7
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
2 months agoWrap operationsPOST result with JaxRsFormattableBody 88/111388/2
Robert Varga [Mon, 15 Apr 2024 08:38:40 +0000 (10:38 +0200)]
Wrap operationsPOST result with JaxRsFormattableBody

We need to wrap the entity with formatting metadata for it to be picked
up by JaxRsFormattableBodyWriter.

JIRA: NETCONF-1296
Change-Id: I68366ba56c2d62901ffaf938739d94d3667f7ffd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoMake SSEStreamService class public 87/111387/2
Yaroslav Lastivka [Mon, 15 Apr 2024 07:16:30 +0000 (10:16 +0300)]
Make SSEStreamService class public

The SSEStreamService class was previously package-private, which
restricted access from classes not within the same package.
This limitation was causing an IllegalAccessException when
methods from this class were being accessed reflectively
by the Jersey framework, which is outside of its package.

JIRA: NETCONF-1273
Change-Id: I2c0ce558a7ccd53e9a8636690d2676d5d7ebb9df
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
2 months agoDefine a replacement for Restconf{Error,Exception,Future} 63/111363/8
Robert Varga [Thu, 11 Apr 2024 23:33:24 +0000 (01:33 +0200)]
Define a replacement for Restconf{Error,Exception,Future}

Server-side API is opinionated about how it reports errors. This patch
defines:
- ErrorMessage to hold the RFC6241 definition of what is an error
  message
- ServerError to replace RestconfError
- ServerErrorInfo to hold the error-info element
- ServerErrorPath to hold the error-path element
- ServerException to replace RestconfDocumentedException

ServerException has a more logical API, holding only a single error and
performing explicit mapping when instantiated with just a Throwable
cause. This mode of operation maps:
- IllegalArgumentException to ErrorTag.INVALID_VALUE
- UnsupportedOperationException to ErrorTag.OPERATION_NOT_SUPPORTED

JIRA: NETCONF-1188
Change-Id: I07e7a9a56e4e02c699ead96bed1c115136767c4c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoFix dataGet() of MapEntries 69/111369/2
Robert Varga [Fri, 12 Apr 2024 16:26:32 +0000 (18:26 +0200)]
Fix dataGet() of MapEntries

Expand RestconfDataGetTest to cover more NormalizedNode structures,
verifying we are producing what we need.

This flushes out an alignment problem between XML and JSON: the latter
does need the entrypoint to be MapNode, the other does not care.

Change-Id: Ic11863b6dec5bd1a5bb860dd3d3732c5e3c53384
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoClean up NormalizedNodeWriter tests 64/111364/1
Robert Varga [Fri, 12 Apr 2024 07:56:32 +0000 (09:56 +0200)]
Clean up NormalizedNodeWriter tests

We have a bit of duplication with data, collect that into a common
superclass.

While we are at it, migrate to JUnit5, which allows us to remove the use
of verifyNoMoreInteractions().

Change-Id: I0599e400665e36b5005eab5cbe2ab08fbf72f1a1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoImprove JaxRsFormattableBody.toString() 62/111362/1
Robert Varga [Thu, 11 Apr 2024 22:03:55 +0000 (00:03 +0200)]
Improve JaxRsFormattableBody.toString()

Output the pretty-print boolean instead of a class, improving
experience.

JIRA: NETCONF-773
Change-Id: I1cded9f21a7e4a36df3110ddece4db0d2c3eec85
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoMove ErrorTags 61/111361/3
Robert Varga [Thu, 11 Apr 2024 21:53:26 +0000 (23:53 +0200)]
Move ErrorTags

ErrorTags now only defines a single ErrorTag. Move it to
restconf.nb.rfc8040 for the time being.

JIRA: NETCONF-773
Change-Id: I9025682cd563002111dbc2ecf2ba4737810d54fb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoEliminate restconf.nb.rfc8040.jersey 60/111360/3
Robert Varga [Thu, 11 Apr 2024 21:32:48 +0000 (23:32 +0200)]
Eliminate restconf.nb.rfc8040.jersey

There are only a couple of classes left in this hierachy. This patch
moves them around:
- RestconfDocumentedExceptionMapper moves to restconf.nb.rfc8040.legacy
- RestconfNormalizedNodeWriter moves to restconf.server.spi

JIRA: NETCONF-773
Change-Id: I9b9311c3a4f22922f8c435b12f7071b1ea6b6b6b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoEliminate NormalizedNodePayload 59/111359/4
Robert Varga [Thu, 11 Apr 2024 19:18:07 +0000 (21:18 +0200)]
Eliminate NormalizedNodePayload

NormalizedNodePayload is only used in RestconfStrategy.dataGET() and is
one of the two last places where we use old JAX-RS serialization.

This patch introduces {Data,Root}FormattableBody class to act as a
combination of NormalizedFormattableBody and NormalizedNodePayload.

This also refactors the interface towards RestconfNormalizedNodeWriter
by introducing a factory which is under control of the RestconfStrategy
which produces the result.

JIRA: NETCONF-773
Change-Id: I867944ab260828fb19e3ba829d1188a215e0bd9f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoIntegrate RestconfNormalizedNodeWriter 58/111358/1
Robert Varga [Thu, 11 Apr 2024 14:22:44 +0000 (16:22 +0200)]
Integrate RestconfNormalizedNodeWriter

RestconfNormalizedNodeWriter is an interface with a single
implementation, integrate it there and simplify naming.

JIRA: NETCONF-773
Change-Id: I552aad11b4cc2c3db9eb46f5d2d4410e1c30ccb0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>