netconf.git
9 months agoSet default for string type 79/105879/26
tobias.pobocik [Wed, 10 May 2023 11:22:11 +0000 (13:22 +0200)]
Set default for string type

Set default value for string type leaf when such value is present.

JIRA: NETCONF-999
Change-Id: Ia0bbecd0913b65b68a3fa30e33485b515964ada6
Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
9 months agoSet default for bits type 78/105878/24
tobias.pobocik [Wed, 10 May 2023 11:20:44 +0000 (13:20 +0200)]
Set default for bits type

Set default bits type leaf value when such value is present.

Dues to constrained nature of bits type its difficult to set
example values.

JIRA: NETCONF-999
Change-Id: I4edccce7699a3b6ce69965779a8651cb3252c564
Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
9 months agoSet default for boolean type 76/105876/23
tobias.pobocik [Wed, 10 May 2023 11:10:29 +0000 (13:10 +0200)]
Set default for boolean type

Set default value for boolean type leaf when such value is present.

JIRA: NETCONF-999
Change-Id: Ie6b5c27742b0f3d8c225a8442430732f2bfdaad6
Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
9 months agoSet default for union type 75/105875/24
tobias.pobocik [Wed, 10 May 2023 11:06:14 +0000 (13:06 +0200)]
Set default for union type

Set default value for union type when such value is present.

When at place added examples values for each of union's types.

JIRA: NETCONF-999
Change-Id: I2ef7d002f8cb44a9c7af858209caf20374a92411
Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
9 months agoSet default for binary type 74/105874/24
tobias.pobocik [Wed, 10 May 2023 10:56:14 +0000 (12:56 +0200)]
Set default for binary type

Set default value for binary type leaf when such value is present.

Due to constrained nature of this type its difficult to set
example value.

JIRA: NETCONF-999
Change-Id: I7f5b3cc30ee1c6adab2d159efea0995f3a3b379f
Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
9 months agoRemove casting from processStringType method 53/107253/3
Ivan Hrasko [Fri, 4 Aug 2023 10:45:15 +0000 (12:45 +0200)]
Remove casting from processStringType method

As a consequence of NETCONF-1112 we can remove casting from
processStringType method and use simplified logic to find
constraints of very original base type.

Change-Id: Ie490ed26bdaff2d0db8090f508fd59858d60cbc5
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
9 months agoEliminate casting in processTypeDef method 46/107246/5
lubos-cicut [Fri, 4 Aug 2023 06:41:57 +0000 (08:41 +0200)]
Eliminate casting in processTypeDef method

Eliminate casting in DefinitionGenerator#processTypeDef method by using
instanceof pattern.

JIRA: NETCONF-1112
Change-Id: I621b0080db35d3db1a9abc0a52a598efaf154047
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
9 months agoRemove onRemoteSessionFailed() 49/107249/4
Robert Varga [Thu, 3 Aug 2023 18:33:28 +0000 (20:33 +0200)]
Remove onRemoteSessionFailed()

This method is only invoked in tests, remove it.

Change-Id: I79a9dda7cc2fc6f181fa881865b4281c66674efc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoMigrate callers of NormalizedNode.getIdentifier() 56/107256/1
Robert Varga [Fri, 4 Aug 2023 11:40:52 +0000 (13:40 +0200)]
Migrate callers of NormalizedNode.getIdentifier()

Use NormalizedNode.name() instead.

Change-Id: Ide0d0fc4c2b6c4921e7cfb36d2f162c84b84fc09
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoBail early from handleSalInitializationSuccess() 55/107255/2
Robert Varga [Fri, 4 Aug 2023 11:29:58 +0000 (13:29 +0200)]
Bail early from handleSalInitializationSuccess()

This is just a minor clean up to make the method a tad more readable.

Change-Id: I204cdac7715de3e8cf119b652dcdd9140a58f9f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoCentralize handleSalInitializationFailure() 48/107248/3
Robert Varga [Fri, 4 Aug 2023 07:55:34 +0000 (09:55 +0200)]
Centralize handleSalInitializationFailure()

We have a single caller, which has a weird interaction. Move the code
together to highlight the issue.

Change-Id: I39452e19ea2cb215b92bfc240a9ee19030f2b8e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoLet logging format the notification message 44/107244/2
Robert Varga [Thu, 3 Aug 2023 17:52:47 +0000 (19:52 +0200)]
Let logging format the notification message

If logging is set above INFO, we should not be formatting the
notification.

Change-Id: Ib81678989814a4a2827a5706874f256d70318bf9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoDo not use LogicalDatastoreType.name() in logging 39/107239/2
Robert Varga [Thu, 3 Aug 2023 17:11:28 +0000 (19:11 +0200)]
Do not use LogicalDatastoreType.name() in logging

Issuing name() has no effect -- it is the same as toString(), and slf4j
will do that for us.

Change-Id: Ibb89475de803bd2f77e190f96264e2cebe0065d4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoUse %X instead of %x + toUpperCase() 34/107234/1
Robert Varga [Thu, 3 Aug 2023 16:18:58 +0000 (18:18 +0200)]
Use %X instead of %x + toUpperCase()

This is a tad more expressive.

Change-Id: I1785a38c80c963f6ec1a7f31315c5e3ac59b842a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoUse EffectiveOperation.xmlValue() in NetconfMessageTransformUtil 33/107233/1
Robert Varga [Thu, 3 Aug 2023 16:07:51 +0000 (18:07 +0200)]
Use EffectiveOperation.xmlValue() in NetconfMessageTransformUtil

Use the well-known constant instead of performing conversions.

Change-Id: I93a8e1b8a78b78d7efe73fb8c17e832f7678b7fe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoImprove RestconfDocumentedException 32/107232/1
Robert Varga [Thu, 3 Aug 2023 16:01:39 +0000 (18:01 +0200)]
Improve RestconfDocumentedException

Use instanceof pattern to remove an explicit cast. Also check incoming
errors and do not allocate an ArrayList if the list is null or empty.

Change-Id: I2201438e0fdb11239dfad071987cdc116f748a48
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoUse ErrorSeverity.elementBody() in RestconfError 30/107230/1
Robert Varga [Thu, 3 Aug 2023 15:51:26 +0000 (17:51 +0200)]
Use ErrorSeverity.elementBody() in RestconfError

ErrorSeverity provides the element body through a dedicated method, do
to use toLowerCase().

Change-Id: I5a036dc65de8b798f2dd0eb1121f27f00c4752c7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRemove a stray FIXME 29/107229/1
Robert Varga [Thu, 3 Aug 2023 15:30:50 +0000 (17:30 +0200)]
Remove a stray FIXME

I26a910d7d20aedcaf3fe4d6cd39d4a21eb7fc6ca already addressed this FIXME,
remove it.

JIRA: NETCONF-1107
Change-Id: I413bfb6cd316dffa63c1cdbb80319d20558bf4bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRemove RestconfDataStreamService 28/107228/1
Robert Varga [Thu, 3 Aug 2023 15:27:20 +0000 (17:27 +0200)]
Remove RestconfDataStreamService

We have only one implementation of this service, integrate it.

JIRA: NETCONF-1117
Change-Id: I6a3ea6c7f9a3687c4d27476f363cfa81825f05b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRemove RestconfInvokeOperationsService 27/107227/3
Robert Varga [Thu, 3 Aug 2023 14:01:19 +0000 (16:01 +0200)]
Remove RestconfInvokeOperationsService

This interface has a single implementation, inline its definition there.

JIRA: NETCONF-1117
Change-Id: I82c1fbda420703dbc23d8d2aefe1ad5e3ff13ec0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRemove RootResourceDiscoveryService 26/107226/2
Robert Varga [Thu, 3 Aug 2023 13:51:54 +0000 (15:51 +0200)]
Remove RootResourceDiscoveryService

This interface has only a single implementation, fold it into the sole
user. Also fixup whitespace formatting and improve the test a bit.

JIRA: NETCONF-1117
Change-Id: I462f541fcce99a178a237762a0d7b544adf6dbf6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRemove RestconfOperationsService 25/107225/2
Robert Varga [Thu, 3 Aug 2023 13:36:55 +0000 (15:36 +0200)]
Remove RestconfOperationsService

This interface is not really useful, inline it into its sole
implementation. Also rename the test to match its name and refactor it a
bit to isolate state.

JIRA: NETCONF-1117
Change-Id: I81d92321bbc06b5aef32981a078565a02b4f2c33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRemove RestconfService 24/107224/1
Robert Varga [Thu, 3 Aug 2023 11:41:26 +0000 (13:41 +0200)]
Remove RestconfService

This interface is not useful, integrate it into the reference
implementation.

JIRA: NETCONF-1117
Change-Id: I371b4c7ce7e6e9e28ff43e1d5fc221cfa81c2a2d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRemove RestconfDataService 18/107218/2
Robert Varga [Thu, 3 Aug 2023 11:37:14 +0000 (13:37 +0200)]
Remove RestconfDataService

Remove the API definition, leave just the the implementation.

JIRA: NETCONF-1117
Change-Id: I31ff867388abec13bd545b14581b82b9152e1142
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoUse AsyncResponse in deleteData/patchData 17/107217/2
Robert Varga [Thu, 3 Aug 2023 10:43:51 +0000 (12:43 +0200)]
Use AsyncResponse in deleteData/patchData

We have the structure support synchronous execution, use it to eliminate
the need to catch/unwrap underlying exceptions.

JIRA: NETCONF-718
Change-Id: I17573f7012de4bbee4c8f1b53c2d7e518cecedbe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoEliminate PlainPatchDataTransactionUtil 14/107214/6
Robert Varga [Wed, 2 Aug 2023 20:08:12 +0000 (22:08 +0200)]
Eliminate PlainPatchDataTransactionUtil

Move the implementation and rework synchronization, so that it occurs in
RestconfDataServiceImpl. Also drop a FIXME for optimization follow-up.

JIRA: NETCONF-1113
Change-Id: I0b4f23ecf71fbd0d5f923972d8333434970e9d19
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoFix parameters to build action paths 22/107222/2
Ivan Hrasko [Thu, 3 Aug 2023 12:50:52 +0000 (14:50 +0200)]
Fix parameters to build action paths

During refactoring done in db4726f577d90c944841e31fdf01e8567309df3f
we have changed the parameters used to build action paths which results
in incorrect schema assigned in buildPostOperation method.

Fix the parameters to original values.

Change-Id: I764d5198eba6c9c1b15ee742b57a48e3f28bfbd2
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoRemove DeleteDataTransactionUtil 12/107212/11
Robert Varga [Wed, 2 Aug 2023 12:44:21 +0000 (14:44 +0200)]
Remove DeleteDataTransactionUtil

DeleteDataTransactionUtil contains only a single method, which is the
request to delete data from the configuration datastore.

Rather than having a free-standing utility, integrate this request into
RestconfStrategy as a well-defined method. The strategy can then
determine what is the appropriate way to implement it.

In the course of this exercise, we introduce RestconfFuture, which is a
ListenableFuture of a non-null value, which can only fail with a
RestconfDocumentedException.

As a side-effect of this, the MD-SAL implementation is made more
performant by removing an intermediate synchronization point when we
check for presence of target data.

JIRA: NETCONF-1111
Change-Id: I984547691baae19f21e8611a14ca50e4d5298c64
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoCreate only config data for OpenApi 43/105043/39
Peter Suna [Mon, 27 Mar 2023 15:58:48 +0000 (17:58 +0200)]
Create only config data for OpenApi

There is no need to create duplicate JSON nodes for operational
data just to provide an example for the Get response.
Instead, we can use an example from the configuration memory,
which is sufficient for demonstration purposes.
Therefore, creating operational example data should be removed.

Remove operational GET request from OpenApi
This commit solves the problem by completly removing Operational
GET request from OpenApi.

JIRA: NETCONF-982
JIRA: NETCONF-1061
Change-Id: I894e6c2860ce622fb5258ea3518c19c853adac39
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoOpenApi simplify processChildNode method 20/106920/6
Peter Suna [Thu, 13 Jul 2023 14:53:18 +0000 (16:53 +0200)]
OpenApi simplify processChildNode method

Use return data provided by method to fill properties
in parent node.
Remove unnecessary check for container/list. This is checked
before calling method.

JIRA: NETCONF-982
Change-Id: I189ad3a3115491869b9fe520486eb6ae4dccd110
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
10 months agoCreate tests for operational data in OpenAPI 46/106746/11
Peter Suna [Wed, 28 Jun 2023 10:24:46 +0000 (12:24 +0200)]
Create tests for operational data in OpenAPI

This commit adds unit tests to ensure the correct association
path reference to schemas in requests involving operational data.

JIRA: NETCONF-1061
Change-Id: I110370ccd2cc16f1b30e8b24152c74f5f7e50220
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
10 months agoDo not use Optional in ParserIdentifier.toInstanceIdentifier() 13/107213/2
Robert Varga [Wed, 2 Aug 2023 14:54:56 +0000 (16:54 +0200)]
Do not use Optional in ParserIdentifier.toInstanceIdentifier()

Specify a @Nullable argument instead.

Change-Id: I7aad6ea4e3891e63abf086f30060347e53462b64
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoEliminate ReadDataTransactionUtilTest 09/107209/2
Robert Varga [Wed, 2 Aug 2023 09:44:08 +0000 (11:44 +0200)]
Eliminate ReadDataTransactionUtilTest

Integrate tests into AbstractRestconfStrategyTest to bring them closer
to where we want the logic to execute.

JIRA: NETCONF-1107
Change-Id: Ia1bf1ced796c38363530b19ce108c5d32d6a4d22
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoEliminate PatchDataTransactionUtilTest 07/107207/2
Robert Varga [Tue, 1 Aug 2023 22:23:22 +0000 (00:23 +0200)]
Eliminate PatchDataTransactionUtilTest

Integrate tests into AbstractRestconfStrategyTest to bring them closer
to where we want the logic to execute.

JIRA: NETCONF-1107
Change-Id: Ia3860063264be30e5e92b15e976c1ee6240330cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoClean up ReadDataTransactionUtilTest 08/107208/2
Robert Varga [Wed, 2 Aug 2023 09:31:00 +0000 (11:31 +0200)]
Clean up ReadDataTransactionUtilTest

Before splitting this test up, perform obvious clean ups.

JIRA: NETCONF-1107
Change-Id: Ib0f7ccb654983123494d28ea092072ecc8eb3969
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoEliminate PlainPatchDataTransactionUtilTest 06/107206/1
Robert Varga [Tue, 1 Aug 2023 20:42:15 +0000 (22:42 +0200)]
Eliminate PlainPatchDataTransactionUtilTest

Move the tests to AbstractRestconfStrategyTest and add proper
specializations. Also adds a few asserts to actually verify things.

JIRA: NETCONF-1107
Change-Id: I64dbfcd10db082d219a4f5e1a25e22319731e8b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoEliminate PostDataTransactionUtilTest 05/107205/2
Robert Varga [Tue, 1 Aug 2023 18:58:57 +0000 (20:58 +0200)]
Eliminate PostDataTransactionUtilTest

Split the test into AbstractRestconfStrategyTest with appropriate
specializations.

JIRA: NETCONF-1107
Change-Id: I0b6634bfe6cf74004499f9ab0bce114460c6d948
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoPublish odl-netconf-model-* features 04/107204/1
Robert Varga [Tue, 1 Aug 2023 18:43:50 +0000 (20:43 +0200)]
Publish odl-netconf-model-* features

We should reference all production features in feature-netconf, update
the stragglers.

Change-Id: Ib52dc3e42e15085ab76a054179baca596f6355c7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoPackage RFC8650 model 03/107203/1
Robert Varga [Tue, 1 Aug 2023 17:54:03 +0000 (19:54 +0200)]
Package RFC8650 model

This patch adds the YANG model for RESTCONF integration of RFC8639.

JIRA: NETCONF-1110
Change-Id: If762949d6edab1cb19a558509eb9c053d4998fcb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoAdd RFC8641 model 02/107202/4
Robert Varga [Tue, 1 Aug 2023 16:37:49 +0000 (18:37 +0200)]
Add RFC8641 model

This adds the model for YANG notifications on datastore updates, along
with its corresponding feature.

JIRA: NETCONF-1109
Change-Id: Ia1a63e741fbc5b923d793afdf20959805abd4623
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoClean up PatchDataTransactionUtilTest 01/107201/1
Robert Varga [Tue, 1 Aug 2023 16:13:20 +0000 (18:13 +0200)]
Clean up PatchDataTransactionUtilTest

We are about to split this test up, clean up constants and other
interactions. This flushes out a weirdness in addressing which will
need to be addressed.

JIRA: NETCONF-1107
Change-Id: Ie76e493a4074036ea8f71de24896c514daa36c4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoClean up PlainPatchDataTransactionUtilTest 00/107200/1
Robert Varga [Tue, 1 Aug 2023 15:42:09 +0000 (17:42 +0200)]
Clean up PlainPatchDataTransactionUtilTest

Use static testing data to eliminate duplicates.

JIRA: NETCONF-1107
Change-Id: Ib135fc93b1ce208ff546462427d10253ed11857b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoEliminate PutDataTransactionUtilTest 99/107199/1
Robert Varga [Tue, 1 Aug 2023 15:33:30 +0000 (17:33 +0200)]
Eliminate PutDataTransactionUtilTest

We want to eliminate PutDataTransactionUtil and integrate it into
RestconfStrategy. This takes the first step, splitting tests by the
strategy they are testing.

JIRA: NETCONF-1107
Change-Id: I230d817f30f69ab1127fbbdb906abeb6d8bdd881
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoEvacuate static methods tests to RestconfDataServiceImplTest 98/107198/1
Robert Varga [Tue, 1 Aug 2023 15:18:29 +0000 (17:18 +0200)]
Evacuate static methods tests to RestconfDataServiceImplTest

Static methods are tested in the wrong test suite, evacuate them. Also
promote relevant static test data to AbstractJukeboxTest.

JIRA: NETCONF-1107
Change-Id: I16883ec236c14261f7432fb8f83fe0c58969d75e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoClean up testPostData() 97/107197/2
Robert Varga [Tue, 1 Aug 2023 14:53:25 +0000 (16:53 +0200)]
Clean up testPostData()

Rework how we prepare test data so that the NormalizedNodePayload is
just something we pass down to the tested method.

JIRA: NETCONF-1107
Change-Id: Ic47c82392d41ba8609cb64fe4e9efd838f5f12f1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoMove PutDataTransactionUtil.readList() 96/107196/2
Robert Varga [Tue, 1 Aug 2023 13:48:59 +0000 (15:48 +0200)]
Move PutDataTransactionUtil.readList()

This is an intermediate step towards properly resolving data lifecycle:
readList() is used only when we already have a transaction, hence we can
route the request appropriately.

JIRA: NETCONF-1107
Change-Id: I40ef1262ff0c48e2bdbf5b266fb716af0733c9a7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoClean up {Post,Put}DataTransactionUtil.submitData() 85/107185/1
Robert Varga [Tue, 1 Aug 2023 12:59:20 +0000 (14:59 +0200)]
Clean up {Post,Put}DataTransactionUtil.submitData()

Use a switch expression on insert() and also dispatch directly.

JIRA: NETCONF-1107
Change-Id: I26a910d7d20aedcaf3fe4d6cd39d4a21eb7fc6ca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoMinimize PostDataTransactionUtilTest.before() 82/107182/1
Robert Varga [Tue, 1 Aug 2023 12:27:49 +0000 (14:27 +0200)]
Minimize PostDataTransactionUtilTest.before()

We are shuffling immutable structures, there is no need to instantiate
them for each test.

Change-Id: I2e8c6e7f5bf9c4bb2c28d073a9453d9018f2bc02
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoMinimize PutDataTransactionUtilTest.before() 81/107181/2
Robert Varga [Tue, 1 Aug 2023 12:17:09 +0000 (14:17 +0200)]
Minimize PutDataTransactionUtilTest.before()

We have static assertion data, there is no need to build for each test
execution.

Change-Id: Ia42c36235c1c444897432c429deb37eaf6f0b08d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoCentralize jukebox constants 80/107180/1
Robert Varga [Tue, 1 Aug 2023 12:05:59 +0000 (14:05 +0200)]
Centralize jukebox constants

We are have multiple places defining the same QNames. Centralize these
in AbstractJukeboxTest.

Change-Id: I1680f0d4c0cba72acab08179b8581c9bcc94e7e1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoSplit up DeleteDataTransactionUtilTest 58/107158/7
Robert Varga [Mon, 31 Jul 2023 18:14:09 +0000 (20:14 +0200)]
Split up DeleteDataTransactionUtilTest

At the end of the day, these tests are really flexing the two
RestconfStrategy implementations. Provide a substrate for testing them
separately as a precondition to integrating DeleteDataTransactionUtil.

JIRA: NETCONF-1107
Change-Id: I6a2de0727274b2e667afbfa15b0a41d7b954b2c3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoRemove addOperations() 55/107155/3
Robert Varga [Mon, 31 Jul 2023 16:15:37 +0000 (18:15 +0200)]
Remove addOperations()

This is a static utility method which builds an object and populates it
to a Map -- but there are only two callers and what gets put and where
and under which name is quite conflated.

Introduce a buildPostPath(), which just returns a Path and use that
instead.

While we are at it, use List.of() to specify empty inherited parameters.

Change-Id: I7d69af0ba96caecae3f1e389dc6f2368409c1b14
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>