netconf.git
10 months agoClean up DocumentedException 62/107162/4
Robert Varga [Mon, 31 Jul 2023 22:38:52 +0000 (00:38 +0200)]
Clean up DocumentedException

Provide tie-ins to constant refactor and clean up the class.

JIRA: NETCONF-1014
Change-Id: Ieffc03ec27fb2cddef43db4c6f1a32352df0c840
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoRegister NioSocketChannel 61/107161/4
Robert Varga [Mon, 31 Jul 2023 22:20:41 +0000 (00:20 +0200)]
Register NioSocketChannel

NioSocketChannel must be bound to an Eventloop during close(). This
patch adds the smarts to associate it.

JIRA: NETCONF-1030
Change-Id: I0fcb2d130f38f4f44c4c9979d81ea8c2e611b0a6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoQualify ListenersBroker FIXMEs 60/107160/3
Robert Varga [Mon, 31 Jul 2023 19:51:45 +0000 (21:51 +0200)]
Qualify ListenersBroker FIXMEs

Mark the issue associated with cleaning up ListenersBroker.getInstance()
and deprecate that method to increase visibility of its users.

JIRA: NETCONF-1104
Change-Id: Iaef1883e028debb446c1186c6b105d9088465c98
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoEliminate OperationBuilder.CONSUMES_PUT_POST 56/107156/3
Robert Varga [Mon, 31 Jul 2023 16:31:06 +0000 (18:31 +0200)]
Eliminate OperationBuilder.CONSUMES_PUT_POST

This constant is not used anywhere, remove it.

Change-Id: I01d5ffb3882cbe6f2181582d9b2d2f211366d390
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoReduce builder exposure 54/107154/2
Robert Varga [Mon, 31 Jul 2023 16:07:02 +0000 (18:07 +0200)]
Reduce builder exposure

Build objects fluently so the builders do not escape.

Change-Id: I34d145224ae33965bb9751ec3f59a115378a41c4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoUse local variable type inference 53/107153/2
Robert Varga [Mon, 31 Jul 2023 16:02:13 +0000 (18:02 +0200)]
Use local variable type inference

Bind more tightly to TreeSet.

Change-Id: I6eb31f902a89bbce7396c3555581120f67120761
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoReduce casts a bit 52/107152/2
Robert Varga [Mon, 31 Jul 2023 16:01:19 +0000 (18:01 +0200)]
Reduce casts a bit

Use instanceof patterns to reduce explicit casts.

Change-Id: I2d06c9702c6d3f9cdadb84c5bce0506ffe98566d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoImport javax.ws.rs.core.UriInfo 51/107151/2
Robert Varga [Mon, 31 Jul 2023 14:34:33 +0000 (16:34 +0200)]
Import javax.ws.rs.core.UriInfo

There is no point in using a FQCN, just import UriInfo.

Change-Id: I117cd8f756e42ae17c9d1dc1a0f3505ef48b9037
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoDo not use ArrayList in RestconfDataServiceImplTest 59/107159/2
Robert Varga [Mon, 31 Jul 2023 19:23:11 +0000 (21:23 +0200)]
Do not use ArrayList in RestconfDataServiceImplTest

Use List.of() and inline the set of patch entities.

Change-Id: Ia4e608095e2bc17c82e19543be6bad65dc9297f2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoEliminate lockOperationCallback 57/107157/2
Robert Varga [Mon, 31 Jul 2023 18:58:04 +0000 (20:58 +0200)]
Eliminate lockOperationCallback

Having the callback as a field is not nice, move it to its sole user.

Change-Id: I4f3d7da2b792da9562a10efed676e97bea828953
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoSwitch RESTCONF data root namespace to ietf-restconf 92/99992/3
Robert Varga [Mon, 7 Mar 2022 09:55:36 +0000 (10:55 +0100)]
Switch RESTCONF data root namespace to ietf-restconf

The namespace being used here is wrong, referencing NETCONF. We should
be using the RESTCONF namespace instread.

JIRA: NETCONF-855
Change-Id: I43a8d64057ede0badae520b14c99cf49f208f82b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoUpdate sal-remote.yang 48/107148/1
Robert Varga [Mon, 31 Jul 2023 12:06:34 +0000 (14:06 +0200)]
Update sal-remote.yang

The path parameter and list of qnames is mandatory, make sure we express
that in the model.

JIRA: NETCONF-1099
Change-Id: Ica48ea16b238557de1881af0e726b6ad7662c265
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoEliminate AbstractNotificationsData.localName 45/107145/1
Robert Varga [Mon, 31 Jul 2023 10:13:13 +0000 (12:13 +0200)]
Eliminate AbstractNotificationsData.localName

This field is not really derived from path/identifier, but really is the
stream name.

JIRA: NETCONF-1099
Change-Id: I33d70ffad8077615f7933df1a99042d881c42f94
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoUpdate RestconfStreamsSubscriptionService 21/107121/1
Robert Varga [Thu, 27 Jul 2023 14:37:04 +0000 (16:37 +0200)]
Update RestconfStreamsSubscriptionService

The @Path element has magic structure, make sure the constant is
expressed therein.

Change-Id: Ife99becaac60b8c6ac1273cde944dac6e2dc30ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoRename and move RestconfConstants 19/107119/2
Robert Varga [Thu, 27 Jul 2023 14:06:13 +0000 (16:06 +0200)]
Rename and move RestconfConstants

Document RestconfConstants and move them to the base package. The new
name is URLConstants.

Change-Id: If3698e2e89c21e79c08a8920b4b911134e80329b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoRemove Rfc8040 class 85/106985/9
Matej Sramcik [Mon, 24 Jul 2023 07:46:44 +0000 (09:46 +0200)]
Remove Rfc8040 class

This class only holds ietf-yang-library constants. Move those constants
to their users are eliminate the class.

JIRA: NETCONF-1092
Change-Id: Id089620022afc629ade29451dcc9ccc140bb54fa
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoExtract modules directly from EffectiveModelContext 85/107085/2
Robert Varga [Wed, 26 Jul 2023 15:26:41 +0000 (17:26 +0200)]
Extract modules directly from EffectiveModelContext

We are ignoring the value passed into mapModulesByIetfYangLibraryYang(),
remove the argument and let the method pick up modules from there.

Change-Id: I81a09a7c30cb9e5d8bade1f9b7d9f7da04059011
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoCentralize access decoding 05/107105/1
Robert Varga [Wed, 26 Jul 2023 22:42:10 +0000 (00:42 +0200)]
Centralize access decoding

We have a number of places which perform access syncing, duplicating
code. Introduce TransactionUtil.syncAccess() to deal with them.

Change-Id: I645cbee00c3a28fd5bbf52683e5253f6f096d11f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoEliminate FutureCallbackTx 04/107104/2
Robert Varga [Wed, 26 Jul 2023 22:05:48 +0000 (00:05 +0200)]
Eliminate FutureCallbackTx

The FutureCallbackTx.addCallback() is misleading and ResponseFactory
is a useless indirection. Eliminate both in favor of
TransactionUtil.syncCommit().

Change-Id: Iebddeac64b624ceaff71260aa3dc0579596fd454
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoClean up PatchDataTransactionUtil error list handling 03/107103/1
Robert Varga [Wed, 26 Jul 2023 21:55:14 +0000 (23:55 +0200)]
Clean up PatchDataTransactionUtil error list handling

The errors reported are immutable, there is absolutely no point in
copying them.

Change-Id: I80a98921f7c4d1127a4d7de7933229db44681a89
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoDisconnect PlainPatchDataTransactionUtil from NormalizedNodePayload 02/107102/3
Robert Varga [Wed, 26 Jul 2023 21:09:14 +0000 (23:09 +0200)]
Disconnect PlainPatchDataTransactionUtil from NormalizedNodePayload

We only require path and data here, there is no need to encapsulate this
in a legacy wrapper.

Change-Id: I1dcadfe0b7c985d5a357cbf112cb720cf883a65e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoUse YangParserTestUtils.parseYangResourceDirectory() 99/107099/2
Robert Varga [Wed, 26 Jul 2023 20:07:56 +0000 (22:07 +0200)]
Use YangParserTestUtils.parseYangResourceDirectory()

We have a build-in utility which does the right thing for
single-directory schema assembly. Use that instead of home-grown
utilities.

Change-Id: I55c956d74d2d142726d39f85655118fbea22018d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoAdd AbstractJukeboxTest 98/107098/2
Robert Varga [Wed, 26 Jul 2023 19:51:02 +0000 (21:51 +0200)]
Add AbstractJukeboxTest

We have a bunch of tests operating on /jukebox model. Centralize the
creation of EffectiveModelContext to take advantage of that. This shaves
off about 0.5 seconds in local test runs.

Change-Id: Id0b7f9536b95d734bf315cfb4db6a8e859ca156e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoClean up PatchDataTransactionUtilTest 97/107097/2
Robert Varga [Wed, 26 Jul 2023 19:37:50 +0000 (21:37 +0200)]
Clean up PatchDataTransactionUtilTest

Assemble SchemaContext only once and clean up builder structure.

Change-Id: Id98874896cc02e559f0a24a52f9a60a79ba37c55
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoClean up PlainPatchDataTransactionUtilTest 96/107096/3
Robert Varga [Wed, 26 Jul 2023 19:27:52 +0000 (21:27 +0200)]
Clean up PlainPatchDataTransactionUtilTest

Assemble SchemaContext only once and clean up builder structure.

Change-Id: I64da30d172525e3c553982930ad280efe4d21d17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoClean up PostDataTransactionUtilTest 95/107095/2
Robert Varga [Wed, 26 Jul 2023 19:14:21 +0000 (21:14 +0200)]
Clean up PostDataTransactionUtilTest

Assemble SchemaContext only once and clean up builder structure.

Change-Id: Idc9906cc97125b84adf77384c3d4dfb8d7d77275
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoClean up PutDataTransactionUtilTest 94/107094/2
Robert Varga [Wed, 26 Jul 2023 19:09:16 +0000 (21:09 +0200)]
Clean up PutDataTransactionUtilTest

Assemble SchemaContext only once and clean up builder structure.

Change-Id: Ibd2ec204abb40d5987e8d44c42fb9c4fd744b827
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoDisconnect PutDataTransactionUtil from NormalizedNodePayload 93/107093/2
Robert Varga [Wed, 26 Jul 2023 18:59:58 +0000 (20:59 +0200)]
Disconnect PutDataTransactionUtil from NormalizedNodePayload

We only require path and data here, there is no need to encapsulate this
in a legacy wrapper.

Change-Id: Ic60ca8f8f086c1c902eecebc0deca59594b3e7ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoDisconnect PostDataTransactionUtil from NormalizedNodePayload 92/107092/3
Robert Varga [Wed, 26 Jul 2023 18:48:06 +0000 (20:48 +0200)]
Disconnect PostDataTransactionUtil from NormalizedNodePayload

We only require path and data here, there is no need to encapsulate this
in a legacy wrapper.

Change-Id: I3c61567c85a4e1939fb1512a84edb019637534d4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoEliminate FutureDataFactory 89/107089/3
Robert Varga [Wed, 26 Jul 2023 16:19:43 +0000 (18:19 +0200)]
Eliminate FutureDataFactory

FutureCallbackTx now has only users dealing with transaction commit,
hence we can properly specialize it to FutureCallbackTx.

Change-Id: Ifb1425c41e8d4e860e6d3ea1547a62c6a60972f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoDo not use FluentFuture in RestconfTransaction.commit() 90/107090/4
Robert Varga [Wed, 26 Jul 2023 16:28:17 +0000 (18:28 +0200)]
Do not use FluentFuture in RestconfTransaction.commit()

Noone is transforming this future, use a ListenableFuture instead.

Change-Id: Icb604d275b04c6a27b0cdcd4049926364cc5a198
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoEliminate NormalizedNodeFactory 88/107088/2
Robert Varga [Wed, 26 Jul 2023 16:09:18 +0000 (18:09 +0200)]
Eliminate NormalizedNodeFactory

The only user is ReadDataTransactionUtil, which can easily perform the
same function, without the need to go through
FutureCallbackTx.addCallback().

Change-Id: Ie2bb31b45565d2225933bc0026a765b8c2851763
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoReduce use of FutureCallbackTx.addCallback() 87/107087/1
Robert Varga [Wed, 26 Jul 2023 15:55:53 +0000 (17:55 +0200)]
Reduce use of FutureCallbackTx.addCallback()

Do not use addCallback() for checking the existence of data. This
inlines the synchronous call and allows it to be be further composed.

Change-Id: I6ea04ff197ae24626fc5ffb409902d1b13dd664d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoDo not use FluentFuture in RestconfStrategy 84/107084/1
Robert Varga [Wed, 26 Jul 2023 15:08:59 +0000 (17:08 +0200)]
Do not use FluentFuture in RestconfStrategy

We are not using the transform(), do not wrap the futures we are using.

Change-Id: Iaf061e2d9a0feb867373265d33afd200d8beab48
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoUse switch expressions in NetconfRestconfStrategy 83/107083/1
Robert Varga [Wed, 26 Jul 2023 15:01:07 +0000 (17:01 +0200)]
Use switch expressions in NetconfRestconfStrategy

We are switching on a well-established enum, use switch expressions to
eliminate never-taken paths.

Change-Id: I1f5aaca2b8a8b683b41570ef4c0eb314688082d7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoDo not use ParserIdentifier for Point parsing 82/107082/3
Robert Varga [Wed, 26 Jul 2023 12:45:40 +0000 (14:45 +0200)]
Do not use ParserIdentifier for Point parsing

YangInstanceIdentifierDeserializer provides a much more direct access to
the path, use that to improve structure and eliminate nullness warnings.

Change-Id: I3e63be7870603d2a882ff36e5774cf7a00c71c2b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoClean up dataChangeStreamEntry() 81/107081/2
Robert Varga [Wed, 26 Jul 2023 12:21:04 +0000 (14:21 +0200)]
Clean up dataChangeStreamEntry()

Use DataSchemaContext instead of transcoding the YangInstanceIdentifier
to and from String.

Change-Id: I9b7a952c0567ec24ad1f15710ddaad7a9c835b4c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoImprove notificationStreamEntry() 80/107080/3
Robert Varga [Wed, 26 Jul 2023 12:03:15 +0000 (14:03 +0200)]
Improve notificationStreamEntry()

Pass down EffectiveModelContext, so that we can locate the notification
more quickly.

Change-Id: I31ac32bae8267cb258ee3ca0dbccf5a3ccbb594d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoMove restconfStateStreamPath() 79/107079/2
Robert Varga [Wed, 26 Jul 2023 11:55:49 +0000 (13:55 +0200)]
Move restconfStateStreamPath()

RestconfStateStreams is a more natural place for these utility methods,
move them there.

Change-Id: Ibf68e1a6e3b1e5bf48f8b38c492200684784c180
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoMove RestconfMappingNodeUtil 77/107077/1
Robert Varga [Wed, 26 Jul 2023 11:39:59 +0000 (13:39 +0200)]
Move RestconfMappingNodeUtil

RestconfMappingNodeUtil contains only utilities for creating
ietf-restconf-monitoring's streams content. Move it and assign better
names all around.

Change-Id: I57ce249aa1a425337bfbc9deb3c0407c38d2c590
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoMove createYangNotifiStream() 76/107076/1
Robert Varga [Wed, 26 Jul 2023 10:48:19 +0000 (12:48 +0200)]
Move createYangNotifiStream()

This method has a single caller, which can provide proper context,
allowing use to simplify the task of creating the stream name.

Change-Id: Ib03450988c93913d737e094ac5b67a596d8784c7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoClean up parseNotificationStreamName() 75/107075/1
Robert Varga [Wed, 26 Jul 2023 09:34:03 +0000 (11:34 +0200)]
Clean up parseNotificationStreamName()

Do not convert the enumeration to a String for comparison purposes.

Change-Id: I6c9eb92835cc3004fa2e57f16583aae1c8c8fb09
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoAdd RFC6243 reference 74/107074/1
Robert Varga [Wed, 26 Jul 2023 00:27:40 +0000 (02:27 +0200)]
Add RFC6243 reference

Add a link to back the copied text.

Change-Id: I43880108d894cd9c2911f6e032a8a21bb2d84fe1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoAdvertise ChangedLeafNodesOnlyParam 73/107073/1
Robert Varga [Wed, 26 Jul 2023 00:18:35 +0000 (02:18 +0200)]
Advertise ChangedLeafNodesOnlyParam

Update CapabilitiesWriter to advertise ChangedLeafNodesOnlyParam as
supported.

JIRA: NETCONF-1100
Change-Id: I98cd364a54dbfd009b2231d763a1e20309e1a7aa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoUpdate RFC links 72/107072/1
Robert Varga [Tue, 25 Jul 2023 23:59:12 +0000 (01:59 +0200)]
Update RFC links

Use rfc-editor.org links instead of datatracker.ietf.org for published
RFCs.

Change-Id: Ie9c36a32cea540292703bd7d4c63c3b3af885354
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoDisconnect CreateStreamUtil from NormalizedNodePayload 71/107071/4
Robert Varga [Tue, 25 Jul 2023 22:57:11 +0000 (00:57 +0200)]
Disconnect CreateStreamUtil from NormalizedNodePayload

CreateStreamUtil really implements RPCs and as such it does not require
all the context provided by NormalizedNodePayload. Refactor its methods
to properly mirror RPC invocations.

Change-Id: I4500af63387c316fa7a6d0b42be563450895404a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoTighten createDataChangeNotifiStream() 70/107070/1
Robert Varga [Tue, 25 Jul 2023 22:40:41 +0000 (00:40 +0200)]
Tighten createDataChangeNotifiStream()

Use explicit NodeIdentifiers for the data we expect from the sole
caller. This makes it much more obvious as to what is going on.

Change-Id: Iabfce27030811def343d977a3500696face5b18a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoTighten RPC dispatch 69/107069/3
Robert Varga [Tue, 25 Jul 2023 22:09:58 +0000 (00:09 +0200)]
Tighten RPC dispatch

We have simple RPC dispatch, make sure we tighten the contracts to
conver exactly the RPCs we support.

Change-Id: I26b684f2d363f1a0b72982a43d5cdb4d80bc2f10
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoTie RestconfStreamsSubscriptionServiceImpl to its model 67/107067/2
Robert Varga [Tue, 25 Jul 2023 17:41:17 +0000 (19:41 +0200)]
Tie RestconfStreamsSubscriptionServiceImpl to its model

The implementation here is tied to subscribe-to-notification.yang,
make sure we have a strong connection to the model.

Change-Id: Ia1fc08b37a483d6ae69580c90da30687a4f779f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoHide getRestconfStrategy() 66/107066/2
Robert Varga [Tue, 25 Jul 2023 17:23:15 +0000 (19:23 +0200)]
Hide getRestconfStrategy()

This method does not touch shared state, hence it should not be
synchronized. It really is a private detail, visible for testing only.

Change-Id: I41a765a7f7aa8b5dcda6e9d57fc4f065f760fbf3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoInline checkItemExists() 64/107064/3
Robert Varga [Tue, 25 Jul 2023 16:52:43 +0000 (18:52 +0200)]
Inline checkItemExists()

This method is used only from MdsalRestconfTransaction, inline it there
in a much simpler form. This makes the flow clearer and eliminates a
user of FutureCallbackTx.

Change-Id: I2f00d0266991d5a7dc0ff8cc9b58b3b26a268d2d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoClean up checkListAndOrderedType() 65/107065/3
Robert Varga [Tue, 25 Jul 2023 17:01:43 +0000 (19:01 +0200)]
Clean up checkListAndOrderedType()

Use instanceof patterns and use a single exception throw site.

Change-Id: I99fdea1d38262d2ed850169bd15d6973168328ed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoClean up FutureCallbackTx 63/107063/2
Robert Varga [Tue, 25 Jul 2023 16:38:14 +0000 (18:38 +0200)]
Clean up FutureCallbackTx

Use instanceof patterns to reduce casting.

Change-Id: If1bceafaeaf348f5b234b4c78007d8bf7fbfb87a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoRemove RestconfConstants.SLASH_SPLITTER 61/107061/3
Robert Varga [Tue, 25 Jul 2023 16:12:43 +0000 (18:12 +0200)]
Remove RestconfConstants.SLASH_SPLITTER

This is a utility, used independently by two components. Eliminate it by
copying it to their respective users.

Change-Id: I43a7d103396e35f22d1a0873317856b7191203b2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoMove RestconfConstants.MOUNT 60/107060/3
Robert Varga [Tue, 25 Jul 2023 16:09:09 +0000 (18:09 +0200)]
Move RestconfConstants.MOUNT

This constant is only used in ParserIdentifier, move it there.

Change-Id: I8caba44e532168e34e640f231d2379c57f3b9a5e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoExternal service integration support for ssh transport. 85/106785/6
Ruslan Kashapov [Mon, 3 Jul 2023 10:51:41 +0000 (13:51 +0300)]
External service integration support for ssh transport.

Existing authentication service expected to be used
for ssh authentication when server is running in karaf.

JIRA: NETCONF-590
Change-Id: I1c6df46ee165a78f7bdd87bd7597ae8f35f75715
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoMake NetconfMessage methods final 64/106964/2
Robert Varga [Fri, 21 Jul 2023 16:30:58 +0000 (18:30 +0200)]
Make NetconfMessage methods final

The toString() and getDocument() methods should not be overridden, make
sure that is the case.

Change-Id: I44a1484ebec9475b4616407bc9975151d041873f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoSplit out CapabilitiesWriter 09/103209/13
Robert Varga [Fri, 11 Nov 2022 00:10:36 +0000 (01:10 +0100)]
Split out CapabilitiesWriter

Maintaining ietf-restconf-monitoring capabilities is a separate task
not done by any other component (unlike ietf-yang-library). Separate it
out.

JIRA: NETCONF-668
Change-Id: Icc0e7bbf4bc0c9ecdac385b7ce311ea49868b9c3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
11 months agoAdd Automatic-Module-Name to RFC8639 model 50/107050/1
Robert Varga [Tue, 25 Jul 2023 14:40:15 +0000 (16:40 +0200)]
Add Automatic-Module-Name to RFC8639 model

This is a standard model and hence we use the usual module naming from
MD-SAL.

Change-Id: I876205b01cf6ee7ee2da669cf682308ba9879ea6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoAdd Automatic-Module-Name to RFC8526 model 47/107047/1
Robert Varga [Tue, 25 Jul 2023 14:11:04 +0000 (16:11 +0200)]
Add Automatic-Module-Name to RFC8526 model

This is a standard model and hence we use the usual module naming from
MD-SAL.

Change-Id: Idfad9b00561fc04a6baebca786fc310f016ce2ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoAdd Automatic-Module-Name to RFC8341 model 46/107046/1
Robert Varga [Tue, 25 Jul 2023 13:55:47 +0000 (15:55 +0200)]
Add Automatic-Module-Name to RFC8341 model

This is a standard model and hence we use the usual module naming from
MD-SAL.

Change-Id: Ic23039068b0cea4b9f735dda2642d5f6b85c277c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoAdd Automatic-Module-Name to RFC8040 model 45/107045/1
Robert Varga [Tue, 25 Jul 2023 13:53:21 +0000 (15:53 +0200)]
Add Automatic-Module-Name to RFC8040 model

This is a standard model and hence we use the usual module naming from
MD-SAL.

Change-Id: I42e36eb7fd569a9d56f93ecb0f221a4e767d800c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoAdd Automatic-Module-Name to RFC7407 model 44/107044/1
Robert Varga [Tue, 25 Jul 2023 13:43:52 +0000 (15:43 +0200)]
Add Automatic-Module-Name to RFC7407 model

This is a standard model and hence we use the usual module naming from
MD-SAL.

Change-Id: I9e6b4146576deb79e6aebc5ce334b482c62b29aa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoAdd Automatic-Module-Name to RFC6470 model 40/107040/1
Robert Varga [Tue, 25 Jul 2023 12:51:50 +0000 (14:51 +0200)]
Add Automatic-Module-Name to RFC6470 model

This is a standard model and hence we use the usual module naming from
MD-SAL.

Change-Id: I9a8156e758e61d04073d9f55e8905cebc7c43eae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoAdd Automatic-Module-Name to RFC6243 model 39/107039/1
Robert Varga [Tue, 25 Jul 2023 12:48:29 +0000 (14:48 +0200)]
Add Automatic-Module-Name to RFC6243 model

This is a standard model and hence we use the usual module naming from
MD-SAL.

Change-Id: I0baab487a3640b55b2b29486cc998fdd26d320d4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoAdd Automatic-Module-Name to RFC6022 model 38/107038/1
Robert Varga [Tue, 25 Jul 2023 12:48:17 +0000 (14:48 +0200)]
Add Automatic-Module-Name to RFC6022 model

This is a standard model and hence we use the usual module naming from
MD-SAL.

Change-Id: Ia4c857bedb21ab07e1437ee21d9052dc5f6319d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoRemove fillDoc 62/106462/15
Oleksandr Zharov [Tue, 13 Jun 2023 11:23:50 +0000 (13:23 +0200)]
Remove fillDoc

Removed fillDoc method - we no longed need it to be separate method.

JIRA: NETCONF-1052
Change-Id: I5f62ed182f7dba9f3394cdf5cfe4e132aba10840
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
11 months agoOpenApi: Make version and title required 72/106972/1
Ivan Hrasko [Mon, 24 Jul 2023 07:26:54 +0000 (09:26 +0200)]
OpenApi: Make version and title required

Version and title are required by OpenApi spec in Info object.
Check if both are present in Info compact constructor.

JIRA: NETCONF-1052
Change-Id: Id9bd2e43c95b587152d1f423a3b304bb953ef652
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
11 months agoRemove Info builder 61/106461/14
Oleksandr Zharov [Tue, 13 Jun 2023 11:11:36 +0000 (13:11 +0200)]
Remove Info builder

Currently Info.Builder used only once and it is also redundant.
Removing it now in prepare for followup patches.

JIRA: NETCONF-1052
Change-Id: I978b7d067fd007114b0f22a4f5ffb98b3ab18c5b
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
11 months agoEliminate DefinitionGenerator#putIfNonNull 93/106893/4
Matej Sramcik [Wed, 12 Jul 2023 13:02:03 +0000 (15:02 +0200)]
Eliminate DefinitionGenerator#putIfNonNull

Method putIfNonNull(ObjectNode, String, String) is used only once,
so is inlined.

JIRA: NETCONF-1080
Change-Id: I1a9fe96ca4b37bbfe1fc46ee9d697d316591c31c
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
11 months agoEliminate appendPathKeyValue() in restconf-openapi 14/106914/3
Šimon Ukuš [Thu, 13 Jul 2023 06:39:03 +0000 (08:39 +0200)]
Eliminate appendPathKeyValue() in restconf-openapi

The protected abstract void appendPathKeyValue method has just one,
single-line implementation, and only one usage.

This change eliminates the method.

JIRA: NETCONF-1084
Change-Id: If45cd7ae2ae2d2a11c5da787397f22e20de2dbc8
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
11 months agoRefactor creating unique parameter name 98/106598/14
Yaroslav Lastivka [Wed, 21 Jun 2023 12:37:15 +0000 (15:37 +0300)]
Refactor creating unique parameter name

Create set containing already existing parameter names and use
simple while loop instead of nested for loops.

JIRA: NETCONF-1060
Change-Id: I34359182cfc1690947cf8ddd4ead297d4039e619
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
11 months agoFix MountPointOpenApiTest 19/106919/1
Ivan Hrasko [Thu, 13 Jul 2023 14:57:39 +0000 (16:57 +0200)]
Fix MountPointOpenApiTest

MountPointOpenApi#getMountPointApi signature has been changed
and no more accepts Optional. Reflect this change in tests.

Change-Id: Idd967bf1602766377d05d61ec50a62626b5d18f6
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
11 months agoRefactor getSortedModules method 16/106916/3
Ivan Hrasko [Thu, 13 Jul 2023 11:09:47 +0000 (13:09 +0200)]
Refactor getSortedModules method

Refactor BaseYangOpenApiGenerator#getSortedModules method to take into
account that Module cannot be null and we can simply use
Collections#addAll method.

Change-Id: Ib08effd03b1bca58c512d0b186fa2f8fab02f5a3
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
11 months agoOpenApi: Do not use ArrayNode to store parameters 34/106634/14
Yaroslav Lastivka [Thu, 22 Jun 2023 08:37:04 +0000 (11:37 +0300)]
OpenApi: Do not use ArrayNode to store parameters

We are using ArrayNode to store parameters. We use it only as a
List which stores parameter objects.

Record Parameter has been created. ArrayNode parameters has been
replaced with List<Parameter> inside Operation.
OperationBuilder#getTypeParentNode has been eliminated.

JIRA: NETCONF-1056
Change-Id: I941e89f78e4b9a82d577a2c96f16a82c261b8a4d
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
11 months agoAdd tests that verify authentication feature 23/106723/13
Matej Sramcik [Tue, 27 Jun 2023 14:51:14 +0000 (16:51 +0200)]
Add tests that verify authentication feature

Add tests to  check if securitySchemes and security elements are present.

JIRA: NETCONF-1064
Change-Id: I949ff9ee51cdab607aab88c7e0d208c2ec1b9af7
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
11 months agoEliminate code duplication in doc creation 56/106256/11
Šimon Ukuš [Thu, 8 Jun 2023 11:52:40 +0000 (13:52 +0200)]
Eliminate code duplication in doc creation

New methods were created during elimination of Optionals
as method parameters which introduced some code duplicities.

This change takes this duplication and moves it into a separate method.

JIRA: NETCONF-998
Change-Id: I176a6454f1814627613849659829de760e8fd818
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
11 months agoIntroduce overloaded buildResponse methods 44/106244/10
Šimon Ukuš [Thu, 8 Jun 2023 11:44:28 +0000 (13:44 +0200)]
Introduce overloaded buildResponse methods

Remove the use of Optional as method parameter.
Separate the logic into two methods.

JIRA: NETCONF-998
Change-Id: I0c30b9ba17cc52876dd10c624424a1cbd8aef6d6
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
11 months agoSimplify element count processing, remove Optional 39/106239/10
Šimon Ukuš [Thu, 8 Jun 2023 11:38:05 +0000 (13:38 +0200)]
Simplify element count processing, remove Optional

Modified how ElementCountConstraint is handled during leaf-list node
processing by taking advantage of the method that depends
on the presence of the Optional value.

JIRA: NETCONF-998
Change-Id: Icde783e392beb3972397d7b4400780a1a89c8154
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
11 months agoRemove Optional for deviceName parameter 37/106237/15
Šimon Ukuš [Thu, 8 Jun 2023 10:57:29 +0000 (12:57 +0200)]
Remove Optional for deviceName parameter

This change modifies deviceName handling by replacing
Optional with null-value logic and adding nullable annotations.

JIRA: NETCONF-998
Change-Id: I5fe3a0bb164baaaed793e2bc0da20e16146e5438
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
11 months agoReplace Optional range with separate methods 36/106236/15
Šimon Ukuš [Tue, 30 May 2023 07:09:25 +0000 (09:09 +0200)]
Replace Optional range with separate methods

The logic was divided into two methods: one for range-based
doc creation and the other for non-range doc creation,
eliminating the use of Optional<Range<Integer>>.

JIRA: NETCONF-998
Change-Id: I521813b87e08d28b6d1071e006b2b2f85f438437
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
11 months agoOpenApi: Broken parameters logic 83/106583/12
Yaroslav Lastivka [Wed, 21 Jun 2023 09:26:45 +0000 (12:26 +0300)]
OpenApi: Broken parameters logic

Logic of numbering for path parameters is broken.

Added additional nested loop for double checking
unique parameter's name.

Implemented Unit tests for validation new logic.

JIRA: NETCONF-1060
Change-Id: I8e36bd6d8dc932e9b032f3d9947a81ee2a93d010
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
11 months agoReduce XML nodes from OpenApi 42/106142/16
Peter Suna [Wed, 24 May 2023 10:35:49 +0000 (12:35 +0200)]
Reduce XML nodes from OpenApi

OpenAPI uses XML nodes to determine the namespace,
but it is not necessary for every element. It is only required
in the first node and the augmented element.

JIRA: NETCONF-1036
Change-Id: Iec1586c2197f91fc7ef6d88980b704b33114ffb0
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
11 months agoRemove TestData and move fields to user 73/106673/4
Šimon Ukuš [Mon, 26 Jun 2023 11:29:11 +0000 (13:29 +0200)]
Remove TestData and move fields to user

The sole purpose of TestData was to hold constants
of ReadDataTransactionUtilTest.

This change moves all the constants to the ReadDataTransactionUtilTest
and removes the TestData.

JIRA: NETCONF-1063
Change-Id: I3104c33a2f2b5284b99ea52c93e4504c6df42b33
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
11 months agoCreate test for custom base path verification 96/106396/14
Šimon Ukuš [Wed, 7 Jun 2023 10:42:40 +0000 (12:42 +0200)]
Create test for custom base path verification

This patch introduces test that verifies the openapi paths
for modular basePath.

JIRA: NETCONF-1021
Change-Id: I6c5bf49f2c2e0b34a37636886c2848ac904ca0a3
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
11 months agoChange hard-coded actions path 94/106394/10
Šimon Ukuš [Wed, 7 Jun 2023 10:29:47 +0000 (12:29 +0200)]
Change hard-coded actions path

There was an assumption about the basePath ('rests') when creating
path for POST method for actions. The path was incorrect if instead of
the default basePath a custom one was used.

This patch fixes the path creation while not making any assumptions
about the basePath. The path is resolved when needed.

JIRA: NETCONF-1021
Change-Id: I4b4a7f8f69626874d9c9821205d7c726dfe90919
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
11 months agoBump versions to 7.0.0-SNAPSHOT 57/106857/1
Ivan Hrasko [Mon, 10 Jul 2023 14:31:41 +0000 (16:31 +0200)]
Bump versions to 7.0.0-SNAPSHOT

This starts the next major development iteration.

Change-Id: I26c0f3c5b0e65bb0204b345d695e9666b8aa0a26
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
11 months agoFix device data update failure after successful connection 33/106833/7
Sangwook Ha [Wed, 5 Jul 2023 21:59:55 +0000 (14:59 -0700)]
Fix device data update failure after successful connection

NetconfNodeHandler does not propagate successful connection to its
delegate (RemoteDeviceHandler). Make sure that it's notified so that
the device data is updated accordingly.

JIRA: NETCONF-1074
Change-Id: Id32996c11d0a63812d439ad386472c059255cf4e
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoUpdate draft-ietf-client-server models 20/106820/3
Robert Varga [Wed, 5 Jul 2023 17:00:15 +0000 (19:00 +0200)]
Update draft-ietf-client-server models

There is a new drop for drafts, updating the modules we are packaging.
Update them. This aligns the revisions with the models used in
netconf-{client,server}.

Since this requires some code changes, code is cleaned up to eliminate
most of the warnings and take advantage of BindingMap.

JIRA: NETCONF-1073
Change-Id: I5c610d852ab504050cb258c6b42bc6e32e5b19e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
11 months agoChange default keyword to example 46/106546/6
tobias.pobocik [Tue, 20 Jun 2023 08:43:43 +0000 (10:43 +0200)]
Change default keyword to example

In many cases we misuse default swagger property to set an example
value. Instead, use example property as specified in:
https://swagger.io/docs/specification/adding-examples/

Also, adjust the existing tests to match the changes.

JIRA: NETCONF-999
Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
Change-Id: Ic1d168b119e4b2226b1fa46c0bf86629ebd990d1

11 months agoConvert restconf-api to a JPMS module 26/106826/2
Robert Varga [Wed, 5 Jul 2023 20:24:24 +0000 (22:24 +0200)]
Convert restconf-api to a JPMS module

This is a simple artifact, make sure it is a proper module. While we are
here, also remove @Beta annotations and seal class hierarchies.

Change-Id: I972fe27f25a84f1f04c261bfed76add59da61fa0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoClean up ApiPathParser.URL_FACTORY 25/106825/1
Robert Varga [Wed, 5 Jul 2023 20:33:53 +0000 (22:33 +0200)]
Clean up ApiPathParser.URL_FACTORY

Use a switch expression and guarantee a @NonNull result.

Change-Id: I8a53c1b358f739aa8f4efeb9d36641a3039145cc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoUse HexFormat instead of custom code 24/106824/1
Robert Varga [Wed, 5 Jul 2023 20:29:51 +0000 (22:29 +0200)]
Use HexFormat instead of custom code

JDK17+ ships with HexFormat, which renders some of our code superfluous.
Migrate over while retaining compatibility.

Change-Id: I608ab71ad0406974a56d60c63de12a198a85d922
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoClean up ReadDataTransactionUtil 22/106822/2
Robert Varga [Wed, 5 Jul 2023 19:28:42 +0000 (21:28 +0200)]
Clean up ReadDataTransactionUtil

Couple of improvements:
- do not rebuild LeafNodes and LeafSetEntryNodes
- use instanceof patterns to eliminate part of the casting
- eliminate use of ImmutableNodes' methods.
- perform strict System(Map,LeafSet) checks

Change-Id: If49ab99f9a1f82d210261173f631a5f18b2ce84f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoFix deprecation warnings in restconf-nb 21/106821/1
Robert Varga [Wed, 5 Jul 2023 19:11:33 +0000 (21:11 +0200)]
Fix deprecation warnings in restconf-nb

NormalizedNode and YangInstanceIdentifier have both new methods, switch
to using those.

Change-Id: If84f273fcb32a3ed2b876ec62209f660ac767482
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoUpdate constructors, remove Optional, add non-null 35/106235/12
Šimon Ukuš [Tue, 30 May 2023 06:36:31 +0000 (08:36 +0200)]
Update constructors, remove Optional, add non-null

It is not advised to use Optional in constructors.
Remove Optionals with DOMSchemaService in constructors.

Add non-null annotations with requireNonNull check to avoid NPE,
since DOMSchemaService is being used.
The same applies to custom basePath

JIRA: NETCONF-998
Change-Id: I2b02be7438355b5ca0e75a3dc54bb7e5f2a675ab
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
11 months agoConvert transport-api into a JPMS module 19/106819/1
Robert Varga [Wed, 5 Jul 2023 16:55:32 +0000 (18:55 +0200)]
Convert transport-api into a JPMS module

This is a simple APi. Fix its dependencies and convert it to a proper
module.

Change-Id: I65cf64e461ea8f3751318bdcea07b9776488842b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoConvert netconf-dom-api to a JPMS module 18/106818/1
Robert Varga [Wed, 5 Jul 2023 16:13:57 +0000 (18:13 +0200)]
Convert netconf-dom-api to a JPMS module

This is a simple artifact, convert it to a module and fix its
dependencies to eliminate warnings.

Change-Id: I320a15d9a7227b95b7ba1ed7476bef0e66873808
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoConvert netconf-api into a module 17/106817/2
Robert Varga [Wed, 5 Jul 2023 16:03:57 +0000 (18:03 +0200)]
Convert netconf-api into a module

This is a simplistic module, convert it to JPMS. Also correct dependency
declarations to fix warnings.

Change-Id: I84549eb24ed5c1977ef23b8c0432d8cab6fc8ad4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoAdd Automatic-Module-Name to RFC6241 model 16/106816/1
Robert Varga [Wed, 5 Jul 2023 15:54:05 +0000 (17:54 +0200)]
Add Automatic-Module-Name to RFC6241 model

This is a standard model and hence we use the usual module naming from
MD-SAL.

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