netconf.git
3 days agoAdd MapBodyOrder 64/111464/6 master
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>
5 days 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>
5 days 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>
7 days 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>
7 days 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>
8 days 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>
8 days 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>
8 days 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>
8 days 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>
8 days 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>
9 days 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>
9 days 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>
10 days 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>
12 days 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>
12 days 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>
13 days 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>
13 days 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>
13 days 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>
13 days 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>
13 days 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>
13 days agoFix JaxRsFormattableBodyWriter 56/111356/2
Robert Varga [Thu, 11 Apr 2024 11:21:25 +0000 (13:21 +0200)]
Fix JaxRsFormattableBodyWriter

We should be checking for JaxRsFormattableBody.

JIRA: NETCONF-1294
Change-Id: I821181ec6749c4558a135bcfe7aaf98ff65065b4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 days agoFix NPE with QNameModule 52/111352/1
Robert Varga [Thu, 11 Apr 2024 09:47:16 +0000 (11:47 +0200)]
Fix NPE with QNameModule

QNameModule.of() requires a non-null revision, but we have a nullable.
Use QNameModule.ofRevision() to fix that.

JIRA: NETCONF-1285
Change-Id: Ic583707699930ce235d1e53d9eeceeef3e6ece2e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSimplify HttpStatusCode.toString() 44/111344/2
Robert Varga [Tue, 9 Apr 2024 22:49:38 +0000 (00:49 +0200)]
Simplify HttpStatusCode.toString()

Use plain 'code( phrase)?' string, which makes it easier to compare.

JIRA: NETCONF-1188
Change-Id: Idf62b672a38e8a6d1f25b5055b54f5954f123de7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoEliminate FormatParameters 43/111343/1
Robert Varga [Tue, 9 Apr 2024 21:21:28 +0000 (23:21 +0200)]
Eliminate FormatParameters

We are just dancing around the pretty-print parameter. Let's ditch the
wrapping and use the parameter all around.

JIRA: NETCONF-773
Change-Id: I469c2f364956506578655bdc40bcbd3004a1c96a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoIntroduce HttpStatusCode 42/111342/1
Robert Varga [Tue, 9 Apr 2024 20:35:33 +0000 (22:35 +0200)]
Introduce HttpStatusCode

RESTCONF fall into two categories a success, indicating a 20x status or
a failure, indicating a 40x status. RestconfDocumentedException acts as
a wrapper for the latter case, with the additional twist of being able
to report multiple errors via the 'yang-errors' template.

All failure modes in RESTCONF end up being driven by a YANG ErrorTag,
hence our server-size response structure really wants to be split along
success/failure lines.

This patch takes the first step towards that split, defining a
restconf.api.HttpStatusCode, which acts as a semantic capture of a HTTP
Status Code and use that in error mapping logic.

While we are visiting here, we make the status code for data-missing
configurable for each northbound instance -- rather than our previous
use of a global property.

JIRA: NETCONF-1188
Change-Id: I1365256f9fad4ffe66358e6e9da4dfa337a755fd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRework body formatting wiring 39/111339/3
Robert Varga [Mon, 8 Apr 2024 21:03:35 +0000 (23:03 +0200)]
Rework body formatting wiring

Output formatting is a policy decision of a particular HTTP endpoint,
not of a RestconfServer implementation.

This patch performs some very invasive surgery to rehost this
information which minimizing method churn to express prepare the code
for fitting in access control.

FormatParameters are now a simple record encapsulating PrettyPrintParam.
These get routed by JaxRsRestconf through interpretation and
communicated to body writers without passing them directly to
RestconfServer.

ServerRequest is introduced and passed instead of QueryParameters or
QueryParams -- it exposes post-processed QueryParameters.

QueryParameters is turned into an immutable class instead of an
interface + record. This is a tad more convenient and easier to
understand.

Most notably we disconnect WriterParametes from FormatParameters, as
they serve different domains:
- FormatParameters are about formatting any particular content
- WriterParameters are about controlling how we iterate over a
  NormalizedNode (which in turn has two parts, but that's for later)

JIRA: NETCONF-773
Change-Id: I0848ff5deb5dc55ff3b45ef7155f04cfe3ab50f7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdd ApiPath.empty() 22/111322/1
Robert Varga [Mon, 8 Apr 2024 19:19:57 +0000 (21:19 +0200)]
Add ApiPath.empty()

This is a convenience method, making the code flow a bit more organized.

Change-Id: If537750e44c2a113754d8e68c2dfc0688baec59a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSmall improvement in NetconfNodeHandlerTest 20/111320/2
lubos-cicut [Mon, 8 Apr 2024 08:21:28 +0000 (10:21 +0200)]
Small improvement in NetconfNodeHandlerTest

Fix wrong annotation for NetconfNodeHandlerTest#afterClass method.

JIRA: NETCONF-1282
Change-Id: I05edbd3ddd9fa3e1eff092ef3382b81c9bd7e590
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
2 weeks agoIntroduce restconf.server.api.HttpGetResource 13/111313/7
Robert Varga [Sun, 7 Apr 2024 12:54:36 +0000 (14:54 +0200)]
Introduce restconf.server.api.HttpGetResource

HttpGetResource is a useful tool which forces all implementations to
behave in the same manner.

We want httpGet() to return a FormattableBody, which we achieve here for
both OperationsResource and YangLibraryVersionResource.

The latter also gives a useful utility in NormalizedFormattableBody,
which captures the essence of NormalizedNodePayload sans special
handling.

JIRA: NETCONF-773
Change-Id: I48f2c7dec979639c3466024677a36a89919281b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSplit out YangLibraryVersionResource 10/111310/4
Robert Varga [Sun, 7 Apr 2024 12:20:00 +0000 (14:20 +0200)]
Split out YangLibraryVersionResource

Juggle the implementation around, allowing us to capture failure early.

JIRA: NETCONF-773
Change-Id: Ib2a587f3a73698ca2b4da1f6775dc0bdf0436be3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdd QueryParameters.isEmpty() 12/111312/2
Robert Varga [Sun, 7 Apr 2024 12:56:49 +0000 (14:56 +0200)]
Add QueryParameters.isEmpty()

This is a useful invariant, expose it.

JIRA: NETCONF-773
Change-Id: Ie5e0d63c298149af6ff3aa8e9bf4141a236bdf1e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAllow odl-pretty-print to be configured to true 05/111305/8
Robert Varga [Sat, 6 Apr 2024 02:47:31 +0000 (04:47 +0200)]
Allow odl-pretty-print to be configured to true

Expose a configuration knob, pretty-print, which controls the default
value of pretty-printing.

This also cleans up our handling of arguments, as it was all over the
place.

JIRA: NETCONF-1290
Change-Id: Ie4fab3450bceef6d04fc28fe8b908e937a69e4c3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse pretty printing in RestconfDataPatchTest 04/111304/1
Robert Varga [Sat, 6 Apr 2024 02:22:11 +0000 (04:22 +0200)]
Use pretty printing in RestconfDataPatchTest

Demonstrate that the pretty-printing options are honoured by specifying
them in RestconfDataPatchTest. This increases verbosity a bit, but makes
the payloads much more readable.

JIRA: NETCONF-773
Change-Id: Icefc77c7ab1abf1e929acc9e159ecaac697d46e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdd DataYangPatchParams 03/111303/1
Robert Varga [Sat, 6 Apr 2024 02:12:08 +0000 (04:12 +0200)]
Add DataYangPatchParams

YANG Data Patch produces a FormattableBody, create an appropriate
DataYangPatchParams to capture this fact and propagate this information.

JIRA: NETCONF-773
Change-Id: I62ab9a3295b769bea4954ce3f3c08685e1d67738
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoPropagate query parameters to YANG dataPATCH() 02/111302/1
Robert Varga [Sat, 6 Apr 2024 01:42:27 +0000 (03:42 +0200)]
Propagate query parameters to YANG dataPATCH()

We should be honoring odl-pretty-print query parameter, this takes the
first step towards that.

JIRA: NETCONF-773
Change-Id: Id5a1d3445ef632f00d8d33539f76c8e5d420561c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse pretty-printing in YangPatchStatusBodyTest 01/111301/1
Robert Varga [Sat, 6 Apr 2024 01:24:16 +0000 (03:24 +0200)]
Use pretty-printing in YangPatchStatusBodyTest

Now that we have integrated pretty printing, we can use it to make our
tests easier to read.

JIRA: NETCONF-773
Change-Id: I3e00747457dba675e988aabb49aa7a1c3628ca28
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoIntegrate YangPatchStatusBody with FormattableBodySupport 00/111300/1
Robert Varga [Sat, 6 Apr 2024 01:11:08 +0000 (03:11 +0200)]
Integrate YangPatchStatusBody with FormattableBodySupport

Use FormattableBodySupport to acquire properly-configured writers, which
allows for proper pretty printing, once we can pass the query
parameters.

JIRA: NETCONF-773
Change-Id: I0cba89cfbf20007c8bd18fed9003143506d2bba6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoIntroduce YangPatchStatusBody 99/111299/6
Robert Varga [Sat, 6 Apr 2024 00:45:21 +0000 (02:45 +0200)]
Introduce YangPatchStatusBody

Add a dedicated FormattableBody for YANG Patch status, eliminating
the need for dedicated MessageBodyWriters. This has the nice result of
unifying tests as well.

JIRA: NETCONF-773
Change-Id: I06cb44fa4ea88b1e6505e5d3911ba3167503afa2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoReduce use of Status 97/111297/1
Robert Varga [Fri, 5 Apr 2024 23:33:26 +0000 (01:33 +0200)]
Reduce use of Status

Use Response's created()/noContent()/ok() methods instead.

Change-Id: I850f5d40cec147df37b46eaf9b28209dbb58e17f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMake insertWithPointPost() static 96/111296/1
Robert Varga [Fri, 5 Apr 2024 23:29:46 +0000 (01:29 +0200)]
Make insertWithPointPost() static

Eclipse is pointing out this method is not touching state: make it
static.

Change-Id: Ie6291638c2b9ba89e9a72a1aa09ef0ae64354dda
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCentralize AbstractPatchStatusBodyWriter.writeBody() 95/111295/1
Robert Varga [Fri, 5 Apr 2024 23:16:00 +0000 (01:16 +0200)]
Centralize AbstractPatchStatusBodyWriter.writeBody()

We are providing two distinct implementations, let's cut down the
verbosity by having a shared entrypoint into them.

JIRA: NETCONF-773
Change-Id: I86ac22d13f2049201d9833a60c81ee2b45aa0aa9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMove PatchStatus{Context,Entity} 94/111294/1
Robert Varga [Fri, 5 Apr 2024 22:55:11 +0000 (00:55 +0200)]
Move PatchStatus{Context,Entity}

These two classes want to express a FormattableBody on the server side.
Move them out to server.api where they can be evolved further.

An immediate benefit is integration with DatabindContext's codecs.

JIRA: NETCONF-773
Change-Id: I67fe024c3701ab39797db3f6d5afa6f02d1385ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoClean up body implementation placement 93/111293/1
Robert Varga [Fri, 5 Apr 2024 22:32:40 +0000 (00:32 +0200)]
Clean up body implementation placement

OperationOutputBody is a server.spi thing, as we only need the
FormattableBody trait in server.api.

DataPostResult.CreateResource is needlessly nested, as its sibling is
already a top-level construct. Rename it to
server.api.CreateResourceResult.

JIRA: NETCONF-773
Change-Id: I0a8ecb2c6635b6a11ba7836b12cb829bb5a70c72
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoIntroduce restconf.api.ConsumableBody 92/111292/3
Robert Varga [Fri, 5 Apr 2024 21:56:22 +0000 (23:56 +0200)]
Introduce restconf.api.ConsumableBody

The server-side RequestBody contains the idea it is backed by an
InputStream, making it a mirror of a FormattableBody.

Expose ConsumableBody, which captures that essence, making RequestBody
its subclass. We give up use of VarHandles in favor of an
AtomicReference, which is more friendly to static analysis and human
understanding.

JIRA: NETCONF-773
Change-Id: Icc34a60da460c258d13591df7d2fbf68416a9778
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoPromote FormattableBody to restconf.api 91/111291/1
Robert Varga [Fri, 5 Apr 2024 21:31:31 +0000 (23:31 +0200)]
Promote FormattableBody to restconf.api

FormattableBody is not specific to server-side of things. Promote it to
restconf.api along with FormatParameters.

JIRA: NETCONF-773
Change-Id: I31f3426b90483964468dba5d38f73f2c472330f2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRefactor OperationsGetResult 90/111290/3
Robert Varga [Fri, 5 Apr 2024 20:19:19 +0000 (22:19 +0200)]
Refactor OperationsGetResult

We have FormattableBody, which is pretty much what OperationsGetResult
attempts to do with strings.

Move OperationsGetResult to server.spi as OperationsBody, where it is
given out by an OperaetionsResource.

The baseline server.spi footprint then becomes just plain
FormattableBody, which allows us to simplify JaxRsRestconf and
RestconfStrategy.

JIRA: NETCONF-773
Change-Id: Ic54921187e6f83a2477c4126718f053dc366df38
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRefactor pretty printing 89/111289/1
Robert Varga [Fri, 5 Apr 2024 15:56:49 +0000 (17:56 +0200)]
Refactor pretty printing

PrettyPrintParam is a common operation, introduce FormatParameters
to expose it. This interface will be useful for controlling other
parameters as well.

This really makes ReplyBody a FormattableBody, so we perform this
renaming as well and make FormatParameters a required argument.

This flushes out the fact we are not accepting this parameter for invoke
operations. Correctly propagate these parameters, which forces us to
clean up the RPC/action invocation paths -- further simplifying the
interface and creating proper place where these parameters get applied.

JIRA: NETCONF-773
Change-Id: I3382b27c0b4f7d727d792ead5c1ad364bd69624c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSplit out operation output serialization 71/111271/4
Robert Varga [Thu, 4 Apr 2024 15:16:45 +0000 (17:16 +0200)]
Split out operation output serialization

NormalizedNodePayload is quite overloaded, handling a ton of different
options.

This patch renames AbstractBody to RequestBody and creates its
counterpart ReplyBody. The JAX-RS serialization bit is handled through a
pair of MessageBodyWriters, which end up just calling ReplyBody methods.

We then define an OperationOutputBody, which handles the case of
RPC/action invocation result and stop using NormalizedNodePayload for
that purpose.

This also speeds up the entire process, as we can reuse JSON codecs
and not look them up again.

JIRA: NETCONF-773
Change-Id: Ib711451498f9bad485b69d14f6ae8195038ff506
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRefactor transport-http response delivery 67/111267/2
Robert Varga [Thu, 4 Apr 2024 14:16:57 +0000 (16:16 +0200)]
Refactor transport-http response delivery

Using a ListenableFuture brings in lifecycle headache, as the reported
value is retained indefinitely -- forcing us to make copies of the
response.

Rework the APIs in terms of FutureCallback instead -- i.e. we report the
response while having a reference to it and the callback can retain it
if need be (in which case it takes ownership of it).

Also introduce ClientRequestDispatcher to eliminate a bit of duplicate
code.

Change-Id: I350467582b5f5bd67d5241d47a5d4cbaef19adaa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoDocument get module source 19/111219/2
lubos-cicut [Wed, 3 Apr 2024 11:05:55 +0000 (13:05 +0200)]
Document get module source

Document how to get module source.

JIRA: NETCONF-1287
Change-Id: Ica59f07a6086f0b9f17e1228160e7b335780057c
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
2 weeks agoProperly encapsulate PatchBody normalization 54/111254/2
Robert Varga [Thu, 4 Apr 2024 02:54:28 +0000 (04:54 +0200)]
Properly encapsulate PatchBody normalization

Every PatchBody needs to be interpreted in terms of a ResourceContext,
which is capable of resolving sub-resources.

Structuring the code this way disconnects PatchBody from server.spi
contract. The prerequisite wiring is then provided through a
restconf.server.spi.DefaultResourceContext based a Data path and
ApiPathNormalizer.

This makes the semantics crispy-clear, allowing us to ditch a few
re-lookups which are no longer necessary.

JIRA: NETCONF-1288
Change-Id: I37d4903d1cc1bbb8eb3e8db3ac08c2142f661c88
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoEliminate restconf.nb.rfc8040.utils package 53/111253/3
Robert Varga [Thu, 4 Apr 2024 01:20:17 +0000 (03:20 +0200)]
Eliminate restconf.nb.rfc8040.utils package

Move WriterFieldsTranslator to restconf.nb.rfc8040.rests.transactions,
exposed for testing. This eliminates the utils package, simplifying
layout a bit.

Change-Id: I2a5e79aa5c942bd9226b9c5b981f89ffe0e96865
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoHide NetconfFieldsTranslator 52/111252/2
Robert Varga [Thu, 4 Apr 2024 01:16:11 +0000 (03:16 +0200)]
Hide NetconfFieldsTranslator

There is only one user of this class, move it to the same package and
hide it by inlining it into NetconfRestconfStrategy.

Change-Id: Ib614b046bd6dcdf51e4b09d8b7cdec3b43c16629
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoSplit out ApiPathCanonizer 47/111247/1
Robert Varga [Thu, 4 Apr 2024 00:32:21 +0000 (02:32 +0200)]
Split out ApiPathCanonizer

ApiPathNormalizer has grown quite complicated, simplify it by splitting
canonicalize() into ApiPathCanonizer.dataToApiPath().

JIRA: NETCONF-1288
Change-Id: Ia7f36de2f27d511fb6e2230d1c8a83b443a09f11
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoImprove ApiPathNormalizer.normalizeSubResource() 37/111237/2
Robert Varga [Wed, 3 Apr 2024 20:37:52 +0000 (22:37 +0200)]
Improve ApiPathNormalizer.normalizeSubResource()

Split out the normalization logic so that we can restart at a given
point -- which conveniently is pretty much covered by the semantics of
DatabindPath.Data.

This allows us to skip the canonicalize()/parse() step and proceed to
normalization directly.

JIRA: NETCONF-1288
Change-Id: I642dd0286dea60efa1fade3b7edc37fbb4f0536c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoMove patch target resolution 36/111236/1
Robert Varga [Wed, 3 Apr 2024 20:13:54 +0000 (22:13 +0200)]
Move patch target resolution

We now have a lingua franca between PatchBody and ApiPathNormalizer.
Take advantage of that and define the normalizeSubResource() utility
method.

JIRA: NETCONF-1288
Change-Id: Ie3aa238be767918a7c4c795fda04649823aa2824
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRemove OperationsPostPath 35/111235/3
Robert Varga [Wed, 3 Apr 2024 17:24:02 +0000 (19:24 +0200)]
Remove OperationsPostPath

DatabindPath.OperationPath provides a more powerful tool, use that
instead.

JIRA: NETCONF-1288
Change-Id: If234477cf6f304945c4e0dc574c59f0e2983d725
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRemove DataPostPath 34/111234/3
Robert Varga [Wed, 3 Apr 2024 16:49:00 +0000 (18:49 +0200)]
Remove DataPostPath

We have a more powerful tool in DatabindPath.Data, use that instead.

JIRA: NETCONF-1288
Change-Id: I80e1e122aebec9348d83b0a8d28cd82cea7ad840
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoEliminate DataPatchPath 33/111233/2
Robert Varga [Wed, 3 Apr 2024 16:27:21 +0000 (18:27 +0200)]
Eliminate DataPatchPath

We have DatabindPath.Data, which is exactly what we are getting from
normalization, only more powerful. Use that instead.

JIRA: NETCONF-1288
Change-Id: I095f7080585d30dd29b2afcf94dea9544bea574a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoEliminate DataPutPath 32/111232/2
Robert Varga [Wed, 3 Apr 2024 16:17:21 +0000 (18:17 +0200)]
Eliminate DataPutPath

This interface has been useful, but now we have DatabindPath.Data, which
is a more powerful tool with equivalent semantics.

JIRA: NETCONF-1288
Change-Id: Ie135a1f7e6260bec0b6190fc331dc3ad559879f4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoPromote ApiPathNormalizer.Path to server.api.DatabindPath 31/111231/2
Robert Varga [Wed, 3 Apr 2024 15:45:44 +0000 (17:45 +0200)]
Promote ApiPathNormalizer.Path to server.api.DatabindPath

A DatabindPath is an ApiPath bound to a DatabindContext, having the
corresponding databind() method.

This naturally fix into server.api, as it provides a semantic capture of
the request, which we already do in this package.

JIRA: NETCONF-1288
Change-Id: I55552caf24d999d5523c51b872ff77e7bcc0aece
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoBump versions to 7.0.5-SNAPSHOT 23/111223/1
Robert Varga [Wed, 3 Apr 2024 14:46:09 +0000 (16:46 +0200)]
Bump versions to 7.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: I54909500c90cca82c3d8440e4fe0241789029594
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRelease netconf v7.0.4
jenkins-releng [Wed, 3 Apr 2024 12:22:55 +0000 (12:22 +0000)]
Release netconf

3 weeks agoRework YangInstanceIdentifier/URI path conversion 73/111073/24
lubos-cicut [Tue, 26 Mar 2024 14:27:41 +0000 (15:27 +0100)]
Rework YangInstanceIdentifier/URI path conversion

YangInstanceIdentifierSerializer has a rather ambiguous name and
description, but essentially it does what it advertizes: it takes a
YangInstanceIdentifier and creates a String corresponding to
ApiPath.parse().

Unfortunately this process handles values through String.valueOf(),
which obviously does the wrong thing for non-trivial values, such as
identityref and instance-identifier.

We already have a component handling ApiPath -> YangInstanceIdentifier
conversion, the ApiPathNormalizer.

This patch completely replaces
YangInstanceIdentifierSerializer.serializePath() with
ApiPathNormalizer.canonicalize(). It essentially does the same thing,
but returns an ApiPath as the result. Users can use ApiPath.toString()
to then get the String representation, if needed.

JIRA: NETCONF-1264
Change-Id: I1093eb2cbd84ae269430f918e48b98cc2fb4e805
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRequire ApiIdentifier to be instantiated with Unqualified 15/111215/5
Robert Varga [Wed, 3 Apr 2024 08:56:34 +0000 (10:56 +0200)]
Require ApiIdentifier to be instantiated with Unqualified

We are using Unqualified internally, require users to pass it down.

JIRA: NETCONF-1264
Change-Id: I273a384331c175a34621c634071e46bb6cd035ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoFix full lists removal for remote devices via Restconf. 25/109125/14
Ruslan Kashapov [Thu, 30 Nov 2023 07:59:17 +0000 (09:59 +0200)]
Fix full lists removal for remote devices via Restconf.

When full list removal by yang instance identifier is
requested via restconf on remote device (topology node)
the command wasn't properly translated into netconf message,
because there is no single XML node which describes whole
list, the 'remove' or 'delete' operation can be assigned to.
Invalid netconf message constructed did cause parse error
on device side.

The fix converts list removal command into list elements
removals one by one, with instance identifier of each item
defined explicitly.

JIRA: NETCONF-1245
Change-Id: I78e008845b486aeb011530123b9fe081af482fdf
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
3 weeks agoFix serializeMapWithOneKeyTest() 12/111212/1
Robert Varga [Tue, 2 Apr 2024 17:21:19 +0000 (19:21 +0200)]
Fix serializeMapWithOneKeyTest()

Yet again we are passing the wrong key, fix this up before the test
starts failing due to correct serialization.

JIRA: NETCONF-1264
Change-Id: I71f30735174383e5914253490d9912779802e6b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoFix serializeNoPercentEncodingTest() 10/111210/1
Robert Varga [Tue, 2 Apr 2024 17:19:00 +0000 (19:19 +0200)]
Fix serializeNoPercentEncodingTest()

We do not specify the correct key here. Fix this mistake, as the test
will start failing once we do proper encoding.

JIRA: NETCONF-1264
Change-Id: I8c8eafcd221535a4d1e011bcb2f0096cad4f3409
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoFix serializeMapWithMultipleKeysTest() 09/111209/1
Robert Varga [Tue, 2 Apr 2024 17:13:31 +0000 (19:13 +0200)]
Fix serializeMapWithMultipleKeysTest()

The keys are expected to be Uint8 and Boolean, not strings. Fix this up,
as the test will start failing when we perform proper encoding.

JIRA: NETCONF-1264
Change-Id: I29f141984550a787a6f8837bef0467d0ab0d426e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoFix serializePercentEncodingTest() 08/111208/1
Robert Varga [Tue, 2 Apr 2024 16:56:15 +0000 (18:56 +0200)]
Fix serializePercentEncodingTest()

The test is passing the wrong QName for key leaf, which should be
'name'. Fix this as this test will start failing when we perform proper
encoding.

JIRA: NETCONF-1264
Change-Id: Ida98ac1e0c486a25bcb02d2728f6ea389d297538
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoExpose ListInstance.of() methods 06/111206/1
Robert Varga [Tue, 2 Apr 2024 15:59:52 +0000 (17:59 +0200)]
Expose ListInstance.of() methods

ListInstance assumes there is at least one item. Static factory methods
to create ListInstances which validate this invariant. Parser code uses
the now-private-again constructor.

JIRA: NETCONF-1264
Change-Id: I969df7f60c89cf7259830dae584d833f1217d949
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoFix serializeLeafListTest() 05/111205/1
Robert Varga [Tue, 2 Apr 2024 15:43:56 +0000 (17:43 +0200)]
Fix serializeLeafListTest()

leaf-list-0 has 'type boolean' and hence 'instance' is not a valid
value. This test demonstrates that YangInstanceIdentifier is not
validating values, letting garbage in.

This test will start failing once we process values correctly, hence fix
it up ahead of time.

JIRA: NETCONF-1264
Change-Id: I23c7e21eb4e0ca3474debe7faafd7a22aa7f5103
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoOpenAPI: do not generate duplicated schemas 10/111010/4
Samuel Schneider [Mon, 25 Mar 2024 17:23:05 +0000 (18:23 +0100)]
OpenAPI: do not generate duplicated schemas

Skip processing of node if it was already processed.
Currently, we generate multiple schemas with different name
for the same node and the last one is used.

JIRA: NETCONF-1270
Change-Id: I817f5d5db9183b0162b663bd2e80f5971ea8366a
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
3 weeks agoExpose ListInstance constructor 70/111170/2
Robert Varga [Tue, 2 Apr 2024 07:45:19 +0000 (09:45 +0200)]
Expose ListInstance constructor

The only way to create a ListInstance is through parsing. Expose the
constructor so it can be externally instantiated, just like
ApiIdentifier.

JIRA: NETCONF-1264
Change-Id: I917b18266cc1acda5bc5c4108df228c368c4ff33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoUpdate swagger UI to version 5.13.0 73/111173/2
Oleksandr Zharov [Tue, 2 Apr 2024 08:25:20 +0000 (10:25 +0200)]
Update swagger UI to version 5.13.0

It seems that some bugs in the Swagger UI caused problems with
missing action input and output. This is fixed by simply updating
Swagger to a newer version.

Updated Swager UI from 5.11.8 to latest current version:
https://github.com/swagger-api/swagger-ui/releases/tag/v5.12.0
https://github.com/swagger-api/swagger-ui/releases/tag/v5.13.0

JIRA: NETCONF-1286
Change-Id: I47c2982f3d475a1523ec83683b83d6d3b2eea99e
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
3 weeks agoTurn ApiPath into a record 63/111163/2
Robert Varga [Mon, 1 Apr 2024 21:31:21 +0000 (23:31 +0200)]
Turn ApiPath into a record

Expose the canonical constructor and adjust callers to use ApiPath.of().

JIRA: NETCONF-1264
Change-Id: I74f0e17b15d363f096cb7d4a369519a7ba879e7a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoMake leaf-list parsing explicit 62/111162/2
Robert Varga [Mon, 1 Apr 2024 20:28:13 +0000 (22:28 +0200)]
Make leaf-list parsing explicit

We have an implicit fall-through which assumes leaf-list value. Make
that assumption explicit, along with the requirement to have exactly one
item.

JIRA: NETCONF-1264
Change-Id: Iab5638ccf76a8471050411835d9dd80146d93b01
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoEliminate ApiPathNormalizer.modelContext 61/111161/1
Robert Varga [Mon, 1 Apr 2024 20:14:37 +0000 (22:14 +0200)]
Eliminate ApiPathNormalizer.modelContext

The EffectiveModelContext is a DatabindContext-invariant, eliminate the
intermediate field and defer to DatabindContext.modelContext().

Change-Id: Ie3f7b5d37cd20c154758e0c58594e908bd418009
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoFix ApiPathNormalizer value handling 55/111155/3
Robert Varga [Mon, 1 Apr 2024 16:20:23 +0000 (18:20 +0200)]
Fix ApiPathNormalizer value handling

RESTCONF API resources' values are defined in terms of RFC7951, plus
perscent escapes. Percent-escaping for values is already handled by
ApiPathParser, hence we can just pass the values to the codec,
simplifying ApiPathNormalizer quite a bit.

JIRA: NETCONF-1264
Change-Id: Ie97dfbf2a156dd2441c71d6333527a9ddcb71834
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoDocument ApiPathNormalizer 58/111158/1
Robert Varga [Mon, 1 Apr 2024 17:15:18 +0000 (19:15 +0200)]
Document ApiPathNormalizer

Document and improve the ApiPathNormalizer contract, part one. We
document the intent and the contract, moving implementation records
to Path.{Data,Action,Rpc}.

Change-Id: Ic3eac676d94f1dff2b3a8a3d0ff5331239afce20
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoSimplify upgradeCodecFactory() 39/111139/2
Robert Varga [Thu, 28 Mar 2024 13:32:26 +0000 (14:32 +0100)]
Simplify upgradeCodecFactory()

The lamda we return here is a simple if-else return.

JIRA: NETCONF-1248
Change-Id: Ia772eba569ccf9c0559abfab086772dbf31dce1b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoFix transport-http dependency 38/111138/2
Robert Varga [Thu, 28 Mar 2024 13:31:31 +0000 (14:31 +0100)]
Fix transport-http dependency

We have a missing netty-handler dependency, eliciting a warning. Fix
that.

JIRA: NETCONF-1248
Change-Id: I8021408a56a22855b85c3417d010454058854e3e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoShare codepath in ServerChannelInitializer 37/111137/2
Robert Varga [Thu, 28 Mar 2024 12:36:26 +0000 (13:36 +0100)]
Share codepath in ServerChannelInitializer

The failure path shares the same epilogue as the success path. Dispatch
to onSuccess() to share the actual code.

JIRA: NETCONF-1248
Change-Id: I34f9bf37e3652fab6a1a5691ceabedf4132b4124
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoBump upstreams 53/111153/1
Robert Varga [Mon, 1 Apr 2024 08:24:01 +0000 (10:24 +0200)]
Bump upstreams

Adopt:
- controller-9.0.2
- aaa-0.19.3

Change-Id: I239feed92922e9616a3191ec910cdd24cbe3798f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoFix POST request with insert parameter 96/109196/14
Samuel Schneider [Thu, 7 Dec 2023 11:53:59 +0000 (12:53 +0100)]
Fix POST request with insert parameter

Fix the issue when Fix POST request with insert parameter
were incorrectly trying to add data to parent of the parent
element. POST requests inherently operate on parent resources
in the path.

Add tests for this behavior.

JIRA: NETCONF-1178
Change-Id: I4bf3218321cf3348b1ecef2f841899c3f7dbf1d6
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
4 weeks agoHTTP transport implementation 91/110191/20
Ruslan Kashapov [Thu, 8 Feb 2024 11:48:57 +0000 (13:48 +0200)]
HTTP transport implementation

HTTP Client and Server implementation using Netty's
HTTP codecs. Existing TCP and TLS transport layers are used
as underlay. HTTP/2 and Basic Authentication support provided.

JIRA: NETCONF-1248
Change-Id: If02446a24f174663ff497148bde436923f73c8a6
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoKeystore Plaintext Storage API and Local File implementation 89/110389/14
Ruslan Kashapov [Tue, 20 Feb 2024 09:47:23 +0000 (11:47 +0200)]
Keystore Plaintext Storage API and Local File implementation

Data is being persisted into local file with AES-GCM-SIV encryption
using 16 or 32 byte key and dynamically generated nonce.

New feature artifact includes plaintext storage api, local file
storage implementation and karaf shell commands (cli) to access
and modify the data.

JIRA: NETCONF-1257
Change-Id: I841d255c4bcda5ecee7560b28330e568591f8833
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
4 weeks agoFix OpenAPI explorer redirection URL 65/111065/2
Yaroslav Lastivka [Tue, 26 Mar 2024 13:30:09 +0000 (15:30 +0200)]
Fix OpenAPI explorer redirection URL

Previously, the redirection path was incorrectly leading to
a non-existent URL, causing the OpenAPI explorer to fail to load.

The redirection path in getApiExplorer method has been updated
to reflect the correct URL structure.

JIRA: NETCONF-1281
Change-Id: I2eec3b841c00de324d59d24267281beb2025ddf0
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
4 weeks agoRemove json-unit-assertj dependency 09/111009/2
Ivan Hrasko [Mon, 25 Mar 2024 15:48:39 +0000 (16:48 +0100)]
Remove json-unit-assertj dependency

We are not using json-unit-assertj dependency.
Remove it.

Change-Id: I03eb652257098212e91245c0c0213c29085e9f61
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
4 weeks agoFix TCPServer javadoc 12/111012/1
Ivan Hrasko [Tue, 26 Mar 2024 07:37:52 +0000 (08:37 +0100)]
Fix TCPServer javadoc

Fix javadoc for TCPServer#listen method.

Change-Id: I485dc2a0833dd7409bc1d7f0050d3566178902dd
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
4 weeks agoFix topology-singleton Import-Packages 94/110994/1
Robert Varga [Fri, 22 Mar 2024 15:05:40 +0000 (16:05 +0100)]
Fix topology-singleton Import-Packages

javax.annotation is optional, hence it should be marked as such.

JIRA: NETCONF-1280
Change-Id: I9aff41421ab56b82844b57f817c28be23b3670e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoFix parsing of union values 86/110986/5
Robert Varga [Thu, 21 Mar 2024 14:11:17 +0000 (15:11 +0100)]
Fix parsing of union values

TypeDefinitionAwareCodec is no longer handling unions because it cannot
reliably do so -- because they may indirect through leafref, or end up
being a complex type.

Since we are already handling leafref, identityref and
instance-identifier correctly, complete the translation by adding
explicit handling for unions.

JIRA: NETCONF-1265
Change-Id: I88980ba18df8e52d3395d5f0bcf8b8ef0c187949
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoSplit up prepareValueByType() 85/110985/4
Robert Varga [Thu, 21 Mar 2024 13:49:47 +0000 (14:49 +0100)]
Split up prepareValueByType()

This method does some heavy lifting in an atomic unit. Split out
DataSchemaNode type checking and clarify leafref resolution.

JIRA: NETCONF-1265
Change-Id: I7be50b5692ea7f33af5444688fc462edb2b591ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoFix instance-identifier ApiPath normalization 65/110965/7
Robert Varga [Thu, 21 Mar 2024 11:05:26 +0000 (12:05 +0100)]
Fix instance-identifier ApiPath normalization

ApiPathInstanceIdentifierCodec is a distraction which should not be
used.

ApiPathNormalizer acts as a ApiPath->YangInstanceIdentifier conversion
utility and therefore can handle instance identifiers internally, by
parsing them into ApiPath and invoking normalizeDataPath().

JIRA: NETCONF-1265
Change-Id: If9dca1a8b7f14f64ed7cf3f704b2bd9356922ed0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoBump versions to 7.0.4-SNAPSHOT 81/110881/1
Robert Varga [Tue, 19 Mar 2024 23:59:26 +0000 (00:59 +0100)]
Bump versions to 7.0.4-SNAPSHOT

This starts the next development iteration.

Change-Id: I406a944f630c9be6738586bfa576e0fe3afe6836
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoRelease netconf v7.0.3
jenkins-releng [Tue, 19 Mar 2024 20:15:14 +0000 (20:15 +0000)]
Release netconf

5 weeks agoFixup YangLibraryContentBuilderUtil javadoc 66/110866/1
Robert Varga [Tue, 19 Mar 2024 12:05:44 +0000 (13:05 +0100)]
Fixup YangLibraryContentBuilderUtil javadoc

Clean up missing parameters and update wording a bit.

JIRA: NETCONF-1277
Change-Id: I2fadfb2ae8cd4dfe5ee7ce2702f7af96d2da959f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoAlways clean up modules-state 62/110862/2
Robert Varga [Tue, 19 Mar 2024 07:54:03 +0000 (08:54 +0100)]
Always clean up modules-state

Make sure we clean up module-state even when we are not writing it.

JIRA: NETCONF-1277
Change-Id: Ia65340f790f5ceefe8208f73df424f7d2f6f58d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoUse yanglib-mdsal-writer is a cluster-wide singleton 61/110861/2
Robert Varga [Tue, 19 Mar 2024 06:34:43 +0000 (07:34 +0100)]
Use yanglib-mdsal-writer is a cluster-wide singleton

Writing to ietf-yang-library could be a source of datastore conflicts in
a cluster. Make sure we register run the updates only on one of the
cluster nodes.

JIRA: NETCONF-1277
Change-Id: I4fa03ea01fd205cb8e48497db3c93f3b8c58218e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoUse transaction in YangLibraryWriter 57/110857/2
Robert Varga [Tue, 19 Mar 2024 06:21:58 +0000 (07:21 +0100)]
Use transaction in YangLibraryWriter

Rapid updates could see us issue concurrent transaction, which in turn
would fail. Improve the situation by maintaining a transaction chain.

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