netconf.git
5 months agoFix NoSuchElementException for callhome topology node 20/109220/1
Ruslan Kashapov [Fri, 8 Dec 2023 10:23:52 +0000 (12:23 +0200)]
Fix NoSuchElementException for callhome topology node

Call-home to topology integration uses dynamically composed
Node in order to initialize Netconf layer. Some parameters
were omitted resulting NoSuchElementException on NetconfNodeHandler
instantiation. Set of required parameters was restored to prior
implementation in order to fix this.

JIRA: NETCONF-1183
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Change-Id: I94df8aa1f77580bb2d379f6c3d4e2046c13b35a6

5 months agoFix Call-Home services start failure 93/109193/3
Ruslan Kashapov [Thu, 7 Dec 2023 11:22:43 +0000 (13:22 +0200)]
Fix Call-Home services start failure

- reconfigured services to start automatically on feature install
- fixed NPE on TLS service start due to missing status recorder

JIRA: NETCONF-1183
Change-Id: I0c3bd91d0f81fc9343037ae9b06962c9929edf43
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
5 months agoFix NPE on logging topology node with no credentials 97/109197/3
Ruslan Kashapov [Thu, 7 Dec 2023 11:52:51 +0000 (13:52 +0200)]
Fix NPE on logging topology node with no credentials

When netconf topology node is passed for connection
it's configuration is logged with credentials masking.
However, it wasn't taken into account credentials
value could be null (tcp-only, tls and call-home
integration cases) resulting NPE on direct unconditional
toString() invocation.

Fix makes credentials masking conditional. It's performed
only if logging is enabled and credentials are defined.

JIRA: NETCONF-1204
Change-Id: Ie628b2c06dc014624cb17a6bb8a9bb03d7d8b359
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
5 months agoFix implementation of create-device RPC 94/109194/2
Peter Suna [Thu, 7 Dec 2023 11:18:46 +0000 (12:18 +0100)]
Fix implementation of create-device RPC

Store NetconfNode instead of NetconfNodeTopology in createDevice method
created from the parameter CreateDeviceInput. This modification allows
storing data augmented from the netconf-node-optional model.
Without this change, configuration from IgnoreMissingSchemaSources
would be lost.

JIRA: NETCONF-1192
Change-Id: Iff006fcfe2a41b40e8e41fca5c8a59fc9a55efcb
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
5 months agoAllow YANG PATCH to communicate ETag/Last-Modified 65/109165/1
Robert Varga [Wed, 6 Dec 2023 11:39:51 +0000 (12:39 +0100)]
Allow YANG PATCH to communicate ETag/Last-Modified

PATCH methods should communicate ETag/Last-Modified where applicable.
Introduce DataYangPatchResult to communicate these for YANG PATCH.

JIRA: NETCONF-1207
Change-Id: Ie98423c6615dc0ef2d19349d19e937f72ed03165
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoRepair testDeleteNonexistentData() 64/109164/2
Robert Varga [Wed, 6 Dec 2023 11:36:12 +0000 (12:36 +0100)]
Repair testDeleteNonexistentData()

Our refactoring forgot to delegate to assertTestDeleteNonexistentData(),
leading to far too few assertions. Fix that and add more assertions.

JIRA: NETCONF-1107
Change-Id: If0a0bbb60fbcee08c398da365e2536e4e4b08869
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoAllow plain PATCH to communicate ETag/Last-Modified 62/109162/2
Robert Varga [Wed, 6 Dec 2023 10:49:56 +0000 (11:49 +0100)]
Allow plain PATCH to communicate ETag/Last-Modified

PATCH methods should communicate ETag/Last-Modified where applicable.
Introduce DataPatchResult to communicate these for plain PATCH.

JIRA: NETCONF-1207
Change-Id: I3ed2e80385f2b5acdd90c04adab49b491ebd5a79
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoAllow dataPUT() to control ETag/Last-Modified 57/109157/3
Robert Varga [Wed, 6 Dec 2023 08:15:43 +0000 (09:15 +0100)]
Allow dataPUT() to control ETag/Last-Modified

When creating or replacing a data resource, the underlying strategy
should be free to indicate ETag/Last-Modified headers.

Allow this information to be communicated via DataPutResult and pick it
up when generating a Response.

JIRA: NETCONF-1207
Change-Id: I86b726fcaa5bfb7d762483f007d6de77b894f802
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoAllow dataPOST() to control Etag/Last-Modified 56/109156/3
Robert Varga [Wed, 6 Dec 2023 07:58:28 +0000 (08:58 +0100)]
Allow dataPOST() to control Etag/Last-Modified

In Create Resource Mode, each RestconfStrategy should be able to
communicate ETag and Last-Modified headers.

Retrofit DataPostResult.CreateResource to implement
ConfigurationMetadata and propagate its content when generating the HTTP
response.

JIRA: NETCONF-1207
Change-Id: I6b4440f018c17a41887fecc19b220542f360e2c6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoShift ETag/Last-Modified generation to RestconfStrategy 55/109155/4
Robert Varga [Wed, 6 Dec 2023 07:40:27 +0000 (08:40 +0100)]
Shift ETag/Last-Modified generation to RestconfStrategy

We should not be faking headers, but rather let them be controlled by
RestconfStrategy.

This patch introduces ConfigurationMetadata, as the baseline interface
capturing the two headers and DataGetResult as the container allowing
them to be communicated from RestconfServer.dataGET() methods.

JIRA: NETCONF-1207
Change-Id: I2c2b11a60eea0c6c868f2e82f88c002e702fdbc5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoRemove obsolete NetconfClientDispatcher 94/108894/11
Ruslan Kashapov [Thu, 9 Nov 2023 12:40:08 +0000 (14:40 +0200)]
Remove obsolete NetconfClientDispatcher

Removed obsolete NetconfClientDispatcher interface,
implementation, related components and tests

JIRA: NETCONF-1108
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Change-Id: I24efa1deb8a4dffff51ac68f1f8a91cff1771d01

5 months agoCall-Home provider migration to transport-api 81/108881/13
Ruslan Kashapov [Wed, 1 Nov 2023 08:57:22 +0000 (10:57 +0200)]
Call-Home provider migration to transport-api

- new implementation of callhome-server (using on transport-api)
  replacing callhome-protocol
- callhome-provider updated to use callhome-server
- status update for call-home devices no longer uses change
  listener of topology data tree as connection status source,
  uses implementation of CallHomeStatusReporter instead
- call-home data tree sync moved from
  IetfZeroTouchCallHomeServerProvider to CallHomeMountStatusReporter
- configuration provided for OSGI services serving as call-home servers

JIRA: NETCONF-1183
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Change-Id: I8aa57413acbbe5e7cb7f3ebd4ce6a662f1d668ea

5 months agoClean up data{DELETE,PATCH}() 48/109148/2
Robert Varga [Sat, 2 Dec 2023 10:04:53 +0000 (11:04 +0100)]
Clean up data{DELETE,PATCH}()

While we know what we are going to do with the ApiPath, split the lookup
and interpretation.

JIRA: NETCONF-1157
Change-Id: Ife099f18e3600194f7c922a9455d4a493ee9a28f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoClean up exception handling 46/109146/1
Robert Varga [Sat, 2 Dec 2023 09:30:33 +0000 (10:30 +0100)]
Clean up exception handling

There are a number of places where we allow RestconfDocumentedException
to be thrown, but we are returning a RestconfFuture. Make sure we catch
the exception and propagate it through the future.

JIRA: NETCONF-1157
Change-Id: Ia3a67e9469179302c0a9aabbc420a7a05fc8f08d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoEliminate InstanceIdentifierContext 70/109070/16
Robert Varga [Tue, 28 Nov 2023 18:42:41 +0000 (19:42 +0100)]
Eliminate InstanceIdentifierContext

Rework the way we lookup strategies and generally resolve ApiPath to
actual request paths.

The primary logic now rests with RestconfStrategy, which has a way to
recursively deal with yang-ext:mount steps, resulting in a strategy +
ApiPath tail.

These are then picked up by MdsalRestconfServer and routed to the target
strategy's actual method -- which then interprets the tail ApiPath as
appropriate.

JIRA: NETCONF-1157
Change-Id: I8a6391f5538ba5662bad1bef79186e9a1e08ae81
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoGeneralize ResourceBodyTest 28/109128/4
Robert Varga [Thu, 30 Nov 2023 10:53:42 +0000 (11:53 +0100)]
Generalize ResourceBodyTest

Use proper payloads instead of mucking with internals. This shows that
negative case is completely unreachable.

JIRA: NETCONF-1157
Change-Id: I88371fe99362bec68462f6872e874bb7bbf89e5a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRemove duplicate container in network-topology 23/109123/2
Peter Suna [Wed, 29 Nov 2023 08:32:57 +0000 (09:32 +0100)]
Remove duplicate container in network-topology

Task NETCONF-670 resolves a failed request to create a device
using the RPC create-device. This task added the grouping
"netconf-node-augmented-optional-fields" to the required RPC
"create-device" but unintentionally to the augmentation for
the list "node" in the network-topology model.

The same augmentation is already done in the
"netconf-node-optional" model.

This results in preparing the same augmentation from
two different models.

JIRA: NETCONF-1192
Change-Id: Ief7a449ffdaff5d42eb52856fac41e87a8e0274a
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
6 months agoGeneralize validTopLevelNodeName() test 14/109114/1
Robert Varga [Tue, 28 Nov 2023 22:08:05 +0000 (23:08 +0100)]
Generalize validTopLevelNodeName() test

Assert the same violation in JSON/XML tests, which shows this method is
that XML is doing its own thing.

Since these are exercising this code path as they should, we can hide
the method and inline it.

Change-Id: I43d172283f4c0089726271e830b7e62f54b7db0c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoInline json_sub_container.json 13/109113/1
Robert Varga [Tue, 28 Nov 2023 21:36:13 +0000 (22:36 +0100)]
Inline json_sub_container.json

This is a simple resource, inline it to its two callers and eliminate
obsolete method which gets freed up.

Change-Id: I706dd3cf59e65e5feda0b787ef658bc41d77c922
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoInline xml_sub_container.xml 12/109112/1
Robert Varga [Tue, 28 Nov 2023 21:30:46 +0000 (22:30 +0100)]
Inline xml_sub_container.xml

This is a simple document, inline it directly in tests.

Change-Id: Ib0bbc244f9b599c1cdc5f4073fe0c361041cae16
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoInline foo.xml 11/109111/1
Robert Varga [Tue, 28 Nov 2023 21:25:50 +0000 (22:25 +0100)]
Inline foo.xml

This is a simplistic XML fragment, inline it.

Change-Id: I817fb9f29757d5e3a23a068699667138dcedbfc2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoMigrate AbstractResourceBodyTest to JUnit5 10/109110/1
Robert Varga [Tue, 28 Nov 2023 21:18:32 +0000 (22:18 +0100)]
Migrate AbstractResourceBodyTest to JUnit5

Clean up test interactions and migrate to JUnit5.

Change-Id: I4a62a1a980552205712b10552bb64229ead95b83
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoDo not hide DataGetParams.EMPTY 09/109109/1
Robert Varga [Tue, 28 Nov 2023 17:58:38 +0000 (18:58 +0100)]
Do not hide DataGetParams.EMPTY

This is a simple constant, do not hide it, as we are already a
transparent record-based DTO.

JIRA: NETCONF-773
Change-Id: I103cdc4e8341f53078204fc0c9f4192f80df65c6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoInline RestconfApplication 08/109108/1
Robert Varga [Tue, 28 Nov 2023 17:25:44 +0000 (18:25 +0100)]
Inline RestconfApplication

Use an anonymous Application subclass to initialize the servlet, which
makes it obvious JaxRsNorthbound has now mdsal.dom.api dependencies.

JIRA: NETCONF-773
Change-Id: I25aea4b6fdfc3d6d3561387956f2e92ff057c6e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRefactor ReceiveEventsParams 07/109107/1
Robert Varga [Tue, 28 Nov 2023 17:08:01 +0000 (18:08 +0100)]
Refactor ReceiveEventsParams

This is a simple request DTO. Move it to restconf.server.api, where it
really belongs. Also rename it to EventStreamGetParams in keeping with
package naming.

JIRA: NETCONF-773
Change-Id: I06ca58bcf5dde64b9e8787b4d467a384a960596e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoCleanup restconf-nb dependencies 06/109106/1
Robert Varga [Tue, 28 Nov 2023 17:05:36 +0000 (18:05 +0100)]
Cleanup restconf-nb dependencies

We have accumulated some warnings, clean them up.

JIRA: NETCONF-773
Change-Id: I69058c298a63b2f084c1ab2cce46474b71bd6c51
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRefactor ReadDataParams 04/109104/2
Robert Varga [Tue, 28 Nov 2023 16:40:28 +0000 (17:40 +0100)]
Refactor ReadDataParams

Rename these to DataGetParams in keeping with restconf.server.api
package, where this DTO belongs.

JIRA: NETCONF-773
Change-Id: Ie11b1e09d8a45c392d57e5e69c5857aae88b8935
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoReorder QueryParams 05/109105/2
Robert Varga [Tue, 28 Nov 2023 16:45:05 +0000 (17:45 +0100)]
Reorder QueryParams

odl-pretty-print is our extension, make sure it is filed in its
appropriate place.

JIRA: NETCONF-773
Change-Id: Ib57987e9cf33fe3e0959c6c4e14d23e94f92406d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoMove RestconfSchemaSourceUrlProvider 03/109103/1
Robert Varga [Tue, 28 Nov 2023 16:21:19 +0000 (17:21 +0100)]
Move RestconfSchemaSourceUrlProvider

This component is part of dealing with yang-library content, similar to
what we are doing for ietf-restconf, as both really should be transient
state.

Move it to restconf.server.mdsal, so it is co-located with other
datastore state-keeping components.

JIRA: NETCONF-773
Change-Id: I03da2c230123dbcbe04547e7304413c356f116b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRefactor root resource discovery 02/109102/1
Robert Varga [Tue, 28 Nov 2023 16:16:56 +0000 (17:16 +0100)]
Refactor root resource discovery

RootResourceDiscoveryServiceImpl is a mouthful and it is in a legacy
package.

Rename it to JaxRsWebHostMetadata, which is really what we are doing
here. Also eliminate RootFoundApplication by making it an anonymous
class in its sole user.

JIRA: NETCONF-773
Change-Id: I2dcaf136f5e8a324b5f31b72ad9bf5bcd7edbcd4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRemove SSEApplication 01/109101/1
Robert Varga [Tue, 28 Nov 2023 16:08:20 +0000 (17:08 +0100)]
Remove SSEApplication

Use an anonymous Application subclass to tightly bind to the single
user.

JIRA: NETCONF-773
Change-Id: I38ae98f2c8e720785fbd7687ba8766e86419f6f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRemove yang.model.api fakes for /restconf/operations 00/109100/1
Robert Varga [Tue, 28 Nov 2023 15:55:24 +0000 (16:55 +0100)]
Remove yang.model.api fakes for /restconf/operations

We are not emitting operatiions content through NormalizedNodes and
thefore do not need to mock anything.

For MD-SAL binding this use case is already handled by the parser,
which creates the magic nodes as needed.

For NETCONF binding this can potentially be lacking, as the remote
EffectiveModelContext may not even have ietf-restconf -- it might be
useful there, but we will re-introduce it if need be.

JIRA: NETCONF-773
Change-Id: Ia3f0f07804702d8046a775634a861e92c1761593
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoClean up ParserIdentifierTest 99/109099/1
Robert Varga [Tue, 28 Nov 2023 15:05:44 +0000 (16:05 +0100)]
Clean up ParserIdentifierTest

At this point this class tests InstanceIdentifierContext. Clean it up,
rename it and move it to the same package.

JIRA: NETCONF-1157
Change-Id: I3d0f6836d248a1255aeb619943761162e4e83168
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoEliminate ParserIdentifier 98/109098/2
Robert Varga [Tue, 28 Nov 2023 14:54:35 +0000 (15:54 +0100)]
Eliminate ParserIdentifier

This is a useless class now. Move its sole method into
ParserIdentifierTest pending further specialization.

JIRA: NETCONF-1157
Change-Id: I6ae765a3934cac2d1139056a76d2f197d15bee59
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoEliminate IdentifierCodec 97/109097/1
Robert Varga [Tue, 28 Nov 2023 14:50:19 +0000 (15:50 +0100)]
Eliminate IdentifierCodec

This is now a mostly-useless indirection to
YangInstanceIdentifierSerializer. Eliminate it by inlining serialization
into callers and tests in YangInstanceIdentifierSerializerTest.

JIRA: NETCONF-1157
Change-Id: I6a560a3ce520570e63ea6b4add335bafe36c4438
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoClean up YangInstanceIdentifierSerializer 95/109095/2
Robert Varga [Tue, 28 Nov 2023 14:25:14 +0000 (15:25 +0100)]
Clean up YangInstanceIdentifierSerializer

Turn this class into a proper object, retaining DatabindContext and
having a serializePath() method.

JIRA: NETCONF-1157
Change-Id: I5c1b04346b17274c790fd02eb48cb0b952646f73
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRefactor YangInstanceIdentifierDeserializer 94/109094/1
Robert Varga [Tue, 28 Nov 2023 11:42:10 +0000 (12:42 +0100)]
Refactor YangInstanceIdentifierDeserializer

This class is really all about normalizing ApiPath into a
YangInstanceIdentifier (and related information).

Rename it to ApiPathNormalizer and move it to restconf.server.spi, where
so it can be used any and all RestconfServer implementations.

JIRA: NETCONF-1157
Change-Id: I593b5c468650535aca2423724557c0b2aabe8aa0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRemove an obsolete FIXME 92/109092/1
Robert Varga [Tue, 28 Nov 2023 11:30:30 +0000 (12:30 +0100)]
Remove an obsolete FIXME

We already have ApiPath here, the FIXME is no longer relevant.

JIRA: NETCONF-773
Change-Id: I1c46c86d4e84b2193e4ce374cbf5d9b2a81be795
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRemove unused InstanceIdentifier factory methods 90/109090/1
Robert Varga [Tue, 28 Nov 2023 08:59:44 +0000 (09:59 +0100)]
Remove unused InstanceIdentifier factory methods

ofMountPoint{Path,Root}() are not used anywhere, remove them.

JIRA: NETCONF-1157
Change-Id: I33a4a653aab4b30add917e07bf7f9ecd25c55dce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoAdd DataPatchPath 89/109089/1
Robert Varga [Tue, 28 Nov 2023 04:11:51 +0000 (05:11 +0100)]
Add DataPatchPath

This is a minimal capture of state we need, allowing us to reuse codecs.

Change-Id: Iefa54fef563ab1adac3a0cedd166d5aedbd45588
JIRA: NETCONF-1157
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoIntroduce DataPutPath 88/109088/1
Robert Varga [Tue, 28 Nov 2023 03:45:38 +0000 (04:45 +0100)]
Introduce DataPutPath

We need a way to identify resources, the PUT operation on top of /data
provides the semantics. This again allows us to share codecs.

JIRA: NETCONF-1157
Change-Id: I7099ce5e48d080b734705005c6331bd9a11a173c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoAdd OperationsPostPath 87/109087/3
Robert Varga [Tue, 28 Nov 2023 03:11:13 +0000 (04:11 +0100)]
Add OperationsPostPath

This is a nice capture of DatabindContext and the logic we need to
decode OperationInputBody -- using which we can reuse JSON/XML codecs.

JIRA: NETCONF-1157
Change-Id: I6a7136c1c54293be22a85ef015992cc2fb349971
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoIntroduce restconf.server.api.DataPostPath 84/109084/3
Robert Varga [Tue, 28 Nov 2023 01:33:37 +0000 (02:33 +0100)]
Introduce restconf.server.api.DataPostPath

DataPostPath is a state capture of the context we get parsing the
ApiPath. Define in in restconf.server.api and use it in ChildBody.

This has the immediate benefit of reusing JSON/XML codecs.

JIRA: NETCONF-1157
Change-Id: I4177f963b09a732929c61617f56fd1fb24d55396
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoPromote OperationOutput to restconf.server.api 86/109086/1
Robert Varga [Tue, 28 Nov 2023 02:14:48 +0000 (03:14 +0100)]
Promote OperationOutput to restconf.server.api

If we rename this to OperationsPostResult, this goes very nicely with
OperationsGetResult.

JIRA: NETCONF-773
Change-Id: Idcc8d43fac0a7b0125dad692a70c60c9f7158bcd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoUse ActionEffectiveStatement.input() 85/109085/1
Robert Varga [Tue, 28 Nov 2023 01:52:53 +0000 (02:52 +0100)]
Use ActionEffectiveStatement.input()

Do not use YangConstants, just refer to the effective model.

Change-Id: Id232bbb57de131bfe39991a80ef18ceaa30ec255
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoPromote DatabindContext to restconf.server.api 83/109083/1
Robert Varga [Tue, 28 Nov 2023 00:26:53 +0000 (01:26 +0100)]
Promote DatabindContext to restconf.server.api

The furst cut at our output will typically have NormalizedNode
structures and related DatabindContext, so so these can be driven home.

Duplicate DatabindProvider.currentContext() with
DatabindAware.databind().

JIRA: NETCONF-773
Change-Id: I62d10e8a912dfd62bbccaaa0cc52466caca7caa1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoDrop a FIXME 82/109082/1
Robert Varga [Tue, 28 Nov 2023 00:28:54 +0000 (01:28 +0100)]
Drop a FIXME

RestconfDocumentedExceptionMapper should end up being transmogrified
into a better error reporting tool. Drop a FIXME to that effect.

JIRA: NETCONF-1188
Change-Id: I58cd32b5c85c92cd3af8979037aa4bc199d25beb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoUse DatabindContext in instance identifier serialization 81/109081/2
Robert Varga [Mon, 27 Nov 2023 23:20:55 +0000 (00:20 +0100)]
Use DatabindContext in instance identifier serialization

The first thing this path does is create a DataSchemaContextTree -- so
let's pass a DatabindContext, which has that readily available.

JIRA: NETCONF-1157
Change-Id: Ia66d13e4489b00a28404274c9841f227391876ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoUse DatabindContext in deserialization path 80/109080/2
Robert Varga [Mon, 27 Nov 2023 23:04:16 +0000 (00:04 +0100)]
Use DatabindContext in deserialization path

Rather than passing a naked EffectiveModelContext, from which we create
a DataSchemaContextTree, pass down the readily-available
DatabindContext -- which provides the tree very cheaply.

JIRA: NETCONF-1157
Change-Id: I68c8478845392c9a1e2fc9fbeb92ed4803d93a5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRemove InstanceIdentifierContext.getSchemaContext() 79/109079/2
Robert Varga [Mon, 27 Nov 2023 22:31:18 +0000 (23:31 +0100)]
Remove InstanceIdentifierContext.getSchemaContext()

Use databind().modelContext() in callers, as they will want to be
shifting to using DatabindContext in some cases.

JIRA: NETCONF-1157
Change-Id: I2ec63f5b8e677f5806dafad5c2076dc8aba8fbf0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoUse DatabindContext in InstanceIdentifierContext 78/109078/4
Robert Varga [Mon, 27 Nov 2023 21:31:13 +0000 (22:31 +0100)]
Use DatabindContext in InstanceIdentifierContext

We are moving towards elimination of InstanceIdentifierContext, but
before we do that we need to make sure surrounding code passes around
DatabindContext instead of EffectiveModelContext.

This brings immediate an immediate benefit to YANG Patch body parsing,
as it can pick up the DataSchemaContextTree from DatabindContext.

JIRA: NETCONF-1157
Change-Id: I240cc150a7feab6e7344beefc863eb761d8e30d1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoEliminate DOMDatabindProvider 77/109077/3
Robert Varga [Mon, 27 Nov 2023 13:20:40 +0000 (14:20 +0100)]
Eliminate DOMDatabindProvider

We really need to integrate SourceResolve into RestconfStrategy, as we
really need to drive resolution from MdsalRestconfServer (and have
DatabindProvider really work only with EffectiveModelContext).

This also means RestconfStrategy has access to DatabindContext, which
brings immediate benefit of reusing DataSchemaContextTree instances
without a lookup-by-EffectiveModelContext.

JIRA: NETCONF-1157
Change-Id: I6954c1d168fa25d4ce6d261ae1fe1a23b1b0f6b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoDisconnect WriterFieldsTranslator from InstanceIdentifierContext 69/109069/3
Robert Varga [Sun, 26 Nov 2023 15:10:54 +0000 (16:10 +0100)]
Disconnect WriterFieldsTranslator from InstanceIdentifierContext

We only need an EffectiveModelContext and target node. Communicate them
explicitly.

JIRA: NETCONF-1157
Change-Id: I5ac371b0086b19bcee06b0bfc5f9857267fb599a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoAdd DatabindContext.schemaTree() 71/109071/2
Robert Varga [Sun, 26 Nov 2023 16:35:53 +0000 (17:35 +0100)]
Add DatabindContext.schemaTree()

We need DataSchemaContextTree during binding of the URL. Retain a
reference in DatabindContext

JIRA: NETCONF-1157
Change-Id: If50b1880299f8b233f60e4198b77f7f11047e1dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoMove DatabindProvider 68/109068/1
Robert Varga [Sun, 26 Nov 2023 13:00:48 +0000 (14:00 +0100)]
Move DatabindProvider

Promote DatabindProvider to restconf.server.spi package, which is closer
to where it needs to sit (which is probably server.api, depending on
use).

Change-Id: If73dba2479d87b86c77893b71021dd30bab4e459
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoHide ParserIdentifier 67/109067/1
Robert Varga [Sun, 26 Nov 2023 12:28:59 +0000 (13:28 +0100)]
Hide ParserIdentifier

We now only have a single production use or ParserIdentifier. Hide the
class and migrate out-of-package users.

JIRA: NETCONF-1157
Change-Id: I78b246cdb843e10bbb9d661c7a36aba1b4c3f46e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRemove ParserConstants 66/109066/1
Robert Varga [Sun, 26 Nov 2023 11:46:50 +0000 (12:46 +0100)]
Remove ParserConstants

This class is not referenced anywhere, remove it.

JIRA: NETCONF-773
Change-Id: I3075910010fb9ca4dc48894a83b1ac9668c1a549
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoClean up RestconfSchemaSourceUrlProvider 65/109065/1
Robert Varga [Sun, 26 Nov 2023 11:41:31 +0000 (12:41 +0100)]
Clean up RestconfSchemaSourceUrlProvider

Explicitly annotate injection constructor and instantiate it only when
needed.

Change-Id: I07014f4106cf604681c9bbdb63da05dfc7d6bc3b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRefactor modulesGET() methods 63/109063/6
Robert Varga [Sun, 26 Nov 2023 08:34:23 +0000 (09:34 +0100)]
Refactor modulesGET() methods

Make sure mountPath is passed to RestconfServer as ApiPath and make
source revision passed as a query parameter. This ends up
eliminating one reference to ParserIdentifier.

JIRA: NETCONF-1157
Change-Id: I4de5293126d3dc0c68b8ee132e5bfa56a1264008
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoEliminate RestconfSchemaServiceImpl 52/109052/5
Robert Varga [Thu, 23 Nov 2023 10:47:33 +0000 (11:47 +0100)]
Eliminate RestconfSchemaServiceImpl

RestconfSchemaServiceImpl is serving YANG/YIN schema sources. While this
capability is not standardized, integrate it into RestconfServer as
modules{Yin,Yang}GET().

This turns out to be a major refactor, as the implementation was shoddy
-- it required local DOMSchemaService to expose
DOMYangTextSourceProvider extension and then it used that when talking
to mount points.

This refactor integrates the ability to lookup sources into
DatabindContext, with the corresponding DOMDatabindProvider wiring. If
no DOMYangTextSourceProvider is present, we call back to using
YangTextSnippet.

JIRA: NETCONF-773
Change-Id: I57689b2915eda0486c0bb5d5ba6de992b3107c0b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoFix channel inactive handling for SSH transport 46/109046/5
Ruslan Kashapov [Wed, 22 Nov 2023 10:21:05 +0000 (12:21 +0200)]
Fix channel inactive handling for SSH transport

Channel inactive handler require to re-transfer the event
down the pipeline in order for subsequent handler to be
triggered as well. SSH transport pipeline did contain two
channel inactive handlers both terminating the event
resulting *NetconfSession not handling channel termination
properly.

Fixed, case covered by test.

JIRA: NETCONF-1200
Change-Id: I2a78709909e1b8509b562a8fa0bf640c45c91432
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoEliminate JaxRsApiPath 59/109059/3
Robert Varga [Fri, 24 Nov 2023 17:06:15 +0000 (18:06 +0100)]
Eliminate JaxRsApiPath

Bouncing through JaxRsApiPath is not entirely optimal, as we need to
expose that class -- which really is an implementation detail.

Eliminate the class in favor of JaxRsRestconf implementing
ParamConverterProvider for ApiPath.

While we could provide this support as an external component, inlining
it in JaxRsRestconf, which is the only relevant user, has the added
benefit of suppressing Jersey warnings about the resource not providing
any provider interfaces.

JIRA: NETCONF-1157
Change-Id: Id3d1cc5acf764bc03a46f792b3d8c2bf72c5bd85
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoFix /operations indexing 61/109061/2
Robert Varga [Fri, 24 Nov 2023 17:44:48 +0000 (18:44 +0100)]
Fix /operations indexing

Guava's Table does not work for indexing here, as it cannot support null
keys, which we require for storing Revision. Switch to using explicit
nested maps.

JIRA: NETCONF-773
Change-Id: I5812191a070eb9e631afd962ecf1d99e537f3fc3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoAdd FIXMEs 60/109060/2
Robert Varga [Fri, 24 Nov 2023 17:22:48 +0000 (18:22 +0100)]
Add FIXMEs

ETag and Last-Modified should be part of the response payload maintained
on RestconfServer side. Add FIXMEs to reflect that.

JIRA: NETCONF-773
Change-Id: Ice8369fb6545569477a137079691c79e55f32927
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoFix operations{Json,Xml}GET definition 58/109058/4
Robert Varga [Fri, 24 Nov 2023 15:55:26 +0000 (16:55 +0100)]
Fix operations{Json,Xml}GET definition

AsyncResponse should be @Suspended, otherwise we get a warnings from
Jersey that "A HTTP GET method, ..., should not consume any entity."

JIRA: NETCONF-773
Change-Id: I6ad989ae7bd8cd6a0303945d2bf6040c6fea8a5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoFix JaxRsApiPath declaration 57/109057/4
Robert Varga [Fri, 24 Nov 2023 15:42:09 +0000 (16:42 +0100)]
Fix JaxRsApiPath declaration

We are using this class to define our mapping, which means its
constructor must be public. Fixes Jersey reporting "No injection source
found for a parameter of type" fatal message.

JIRA: NETCONF-1157
Change-Id: I75031376ce3ee453d9a5d60b7917c34e57c831fe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoApiPath is a HierarchicalIdentifier 43/109043/4
Robert Varga [Wed, 22 Nov 2023 03:05:30 +0000 (04:05 +0100)]
ApiPath is a HierarchicalIdentifier

ApiPath is essentially a counterpart to YangInstanceIdentifier -- hence
it should provide same services.

JIRA: NETCONF-773
Change-Id: I1d35e43723c484a99c2630f81129ee43222c60b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoSwitch RestconfSchemaServiceImpl to RestconfFuture 48/109048/5
Robert Varga [Wed, 22 Nov 2023 04:47:34 +0000 (05:47 +0100)]
Switch RestconfSchemaServiceImpl to RestconfFuture

We want to have async execution as we really can execute async method --
for example from SchemaSources. This is the first step, converting to
use RestconfFuture.

JIRA: NETCONF-718
Change-Id: Icf1c6bb505ba8dc37d78a248fe400690d49dfc3b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRelocate ParserIdentifier methods 44/109044/4
Robert Varga [Wed, 22 Nov 2023 03:18:34 +0000 (04:18 +0100)]
Relocate ParserIdentifier methods

Vast majority of methods here are implementation details of
RestconfSchemaServiceImpl. Move them there.

JIRA: NETCONF-773
Change-Id: I95836e3f6ee99f91c755f19ced3b3205ab2f7b56
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoClean up SchemaExportContext 42/109042/3
Robert Varga [Wed, 22 Nov 2023 01:55:54 +0000 (02:55 +0100)]
Clean up SchemaExportContext

SchemaExportContext is an output payload and we certainly can implement
it better than we have so far.

This is a first pass doing two things:
- disconnecting SchemaExportContext from mdsal.dom.api
- switches to use EffectiveStatements instead of SchemaNodes

Change-Id: Ic8cba496d8667fedffb92f5c1c482b5070719f01
JIRA: NETCONF-773
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoMigrate RestconfValidationTest to JUnit5 41/109041/4
Robert Varga [Tue, 21 Nov 2023 17:18:40 +0000 (18:18 +0100)]
Migrate RestconfValidationTest to JUnit5

Migrate tests cases and improve assertions.

Change-Id: I8266abb1cbbcbb72a4a7635a0c21d26ac9a48c12
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoEliminate nb.rfc8040.rests.services.api 40/109040/4
Robert Varga [Tue, 21 Nov 2023 16:38:17 +0000 (17:38 +0100)]
Eliminate nb.rfc8040.rests.services.api

This package contains just a specification and we can simply inline it
-- and move SchemaExportContext to nb.rfc8040.legacy pending further
refactor.

JIRA: NETCONF-773
Change-Id: Ia11b36dd66ca050cf8213d87e8d281250cd4de99
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRestconfServer requires ApiPath identifiers 70/107370/18
Robert Varga [Sun, 19 Nov 2023 20:37:21 +0000 (21:37 +0100)]
RestconfServer requires ApiPath identifiers

Parsing the request URL is the responsibility of the caller, hence we
should accept an ApiPath, not a plain String.

JAX-RS implementation uses JaxRxApiPath's default constructor to bind
with @PathParam semantics and report BadRequestException if anything
goes wrong.

JIRA: NETCONF-1157
Change-Id: Ie9dc79d30cbb4ea52643403f2762090a5e3b3aeb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRemove ParserIdentifier.makeQNameFromIdentifier() 39/109039/2
Robert Varga [Tue, 21 Nov 2023 16:28:49 +0000 (17:28 +0100)]
Remove ParserIdentifier.makeQNameFromIdentifier()

This method is used only in its associated tests, remove it and the
tests.

JIRA: NETCONF-1157
Change-Id: I15dc458ff6153376fd3eec22ab7cd6abd4e6e204
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoClean up ParserIdentifierTest 38/109038/5
Robert Varga [Tue, 21 Nov 2023 15:36:48 +0000 (16:36 +0100)]
Clean up ParserIdentifierTest

Clean up and improve assertions.

JIRA: NETCONF-1157
Change-Id: I15559113861fadd09f0feb8ad2781901f9d507dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoImprove RestconfSchemaServiceTest 37/109037/2
Robert Varga [Tue, 21 Nov 2023 15:26:57 +0000 (16:26 +0100)]
Improve RestconfSchemaServiceTest

Add more assertions and perform general clean ups.

JIRA: NETCONF-1157
Change-Id: I3decca5b6dfeca2ab35adebbafdc73b086dbdb07
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoCreate tests for PUT "insert" query parameter 96/108296/9
Yaroslav Lastivka [Thu, 5 Oct 2023 10:49:45 +0000 (13:49 +0300)]
Create tests for PUT "insert" query parameter

Created UT for PUT requests with: insert=last, insert=first,
insert=before, insert=after query parameters.

JIRA: NETCONF-1163
Change-Id: I80f55f0d3f5d91535dccce7c43e7581b3de6feb5
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
6 months agoUse Timer in NetconfNodeHandler 85/108985/4
Robert Varga [Thu, 16 Nov 2023 12:40:03 +0000 (13:40 +0100)]
Use Timer in NetconfNodeHandler

We are using ScheduledExecutorService to scheduler timers. Since we are
already passing down Timer to other timeouts, also migrate
NetconfNodeHandler to use it.

JIRA: NETCONF-1106
Change-Id: I7b231cd4c91b67eff8c8937124a04338ffc8bbe0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoEliminate space escaping 30/109030/6
Robert Varga [Mon, 20 Nov 2023 13:41:36 +0000 (14:41 +0100)]
Eliminate space escaping

We want to be spec-compliant, and a simple space is not a special
character, so we should not be escaping it on output.

Fixup tests which require us escaping spaces and convert them to JUnit5.

JIRA: NETCONF-1157
Change-Id: Id550a4f9d17b77bec3fbb12de89bbf1f775b8e8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoUse Timer for KeepaliveSalFacade 82/108982/6
Robert Varga [Wed, 15 Nov 2023 17:10:42 +0000 (18:10 +0100)]
Use Timer for KeepaliveSalFacade

Our timers typically do not get to fire, which means our performance is
dominated by task setup/teardown.

Improve this by using a Netty Timer, which is optimized for timeouts
which do not typically occur.

JIRA: NETCONF-1199
Change-Id: Iabb89f863a8c447f0e9fcc6981127893f8aa255f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoEstablish ietf-yang-library revision from model context 17/108917/11
Robert Varga [Fri, 10 Nov 2023 13:46:55 +0000 (14:46 +0100)]
Establish ietf-yang-library revision from model context

Rather than hard-coding, report the latest revision available in the
context.

JIRA: NETCONF-773
Change-Id: I0981b6efba576b393eea1f43db5417df4cf3b527
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
6 months agoAdd ApiPath.toString() 28/109028/3
Robert Varga [Mon, 20 Nov 2023 10:21:46 +0000 (11:21 +0100)]
Add ApiPath.toString()

We are about to push ApiPath deeper into stack. This requires reporting
ApiPath values to end user -- for which we need a toString() method.

This rehosts PERCENT_ESCAPER, as we really need it to emit key values.

JIRA: NETCONF-1157
Change-Id: Ia602dacc78eb9f6b0edd9801998dcc5bd60817ea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoOpenApi: Do not introduce JUnit 4 31/109031/3
Ivan Hrasko [Mon, 20 Nov 2023 13:48:15 +0000 (14:48 +0100)]
OpenApi: Do not introduce JUnit 4

Do not use JUnit 4 AfterClass annotation with our JUnit 5 test cases.

JIRA: NETCONF-938
Change-Id: Ie959671a110ba37da6f87410edbd4493766d6612
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
6 months agoUpdate ietf-yang-library to 2019-01-04 81/108981/9
Ivan Hrasko [Wed, 15 Nov 2023 16:43:57 +0000 (17:43 +0100)]
Update ietf-yang-library to 2019-01-04

Update ietf-yang-library to 2019-01-04 where needed.
It is also required to add ietf-datastores, ietf-inet-types
and ietf-yang-types as its dependency.

Remove ietf-yang-library YANG model where the module is not needed.
It means its not required in effective model context and/or not
expected by tests.

Change-Id: I34c854cebabeedd19ce4ec3a5ab1d7ef2eb91b24
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
6 months agoOpenApi: Rework tests to parameterized 07/108707/5
lubos-cicut [Fri, 27 Oct 2023 21:10:59 +0000 (23:10 +0200)]
OpenApi: Rework tests to parameterized

Reworked tests which are expecting JSON output to paramaterized and
reduced code duplications.

JIRA: NETCONF-938
Change-Id: I98d5d4725811da42c630f779f65d4c447afc7fdc
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
6 months agoOpenApi: Improve test coverage 86/108686/7
lubos-cicut [Thu, 26 Oct 2023 13:55:22 +0000 (15:55 +0200)]
OpenApi: Improve test coverage

Created new tests which are expecting JSON outputs. Created suites for
models we are using in current unit tests.

JIRA: NETCONF-938
Change-Id: I8445ac3754b9e4cb604be36f517f1b75abfc27e6
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
6 months agoRestconfServer is strictly asynchronous 26/109026/3
Robert Varga [Sun, 19 Nov 2023 19:23:40 +0000 (20:23 +0100)]
RestconfServer is strictly asynchronous

Make sure all methods are returning RestconfFuture, meaning everything
is potentially asynchronous and every call fail in a well-documented
way.

Take the time to create an assertion framework in AbstractRestconfTest,
which makes testing easy and understandable.

JIRA: NETCONF-718
Change-Id: I852f78568ed14ba527284cf835bfdee5ec024452
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoAnnotate RestconfFuture returns 25/109025/2
Robert Varga [Sun, 19 Nov 2023 19:22:29 +0000 (20:22 +0100)]
Annotate RestconfFuture returns

Both of() and failed() are returing a non-null instance, annotate that
fact.

Change-Id: I1462b99224d0ec5a2ee8f613f314817ef5e5db9e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoMove DOMDatabindProvider 22/109022/3
Robert Varga [Sat, 18 Nov 2023 04:41:55 +0000 (05:41 +0100)]
Move DOMDatabindProvider

DOMDatabindProvider is a logical part of MD-SAL-based server, move it to
server.mdsal. Also document restconf.server.mdsal package a bit.

JIRA: NETCONF-773
Change-Id: Idf72b75eeadf9953d69caf5925f276261e380600
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoSplit up MediaTypes 21/109021/3
Robert Varga [Sat, 18 Nov 2023 04:34:04 +0000 (05:34 +0100)]
Split up MediaTypes

We really want two sets of independent constants:
- plain Strings in restconf.api.MediaTypes
- JAX-RS MediaTypes in restconf.nb.jaxrs

JIRA: NETCONF-773
Change-Id: I11fcf0694bd2d7d3d8f75024b3aa5a43f84c6b31
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoIntroduce restconf.nb.jaxrs package 20/109020/3
Robert Varga [Sat, 18 Nov 2023 04:06:49 +0000 (05:06 +0100)]
Introduce restconf.nb.jaxrs package

We have reached a place where we can clean up JAX-RS northbound
components without worrying about weird dependencies.

Refactor RestconfImpl into restconf.nb.jaxrs.JaxRsRestconf.

JIRA: NETCONF-773
Change-Id: I75dbe87f2276be12157616779ec78b988863daac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoMove MdsalRestconfServer 19/109019/4
Robert Varga [Sat, 18 Nov 2023 02:31:30 +0000 (03:31 +0100)]
Move MdsalRestconfServer

MdsalRestconfServer is now properly isolated, move it to
restconf.server.mdsal.

This hides getStrategy() from tests, which is forcing us to convert them
to proper end-to-end integration tests.

JIRA: NETCONF-773
Change-Id: I5e2729f2b9113d610886972cb7a50f28e40bcd4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoIntroduce RestconfServer.dataPOST() 18/109018/3
Robert Varga [Sat, 18 Nov 2023 02:01:23 +0000 (03:01 +0100)]
Introduce RestconfServer.dataPOST()

POST on /data has two modes, Invoke Operation and Create Resource,
which we can neatly capture in RestconfServer.

This eliminates the final bits of RestconfDataServiceImpl, completing
indirection through RestconfServer.

JIRA: NETCONF-773
Change-Id: I7338d6f49688bc2769a1fc5e952553478566965a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoAdd DataPostResult 17/109017/4
Robert Varga [Fri, 17 Nov 2023 23:44:19 +0000 (00:44 +0100)]
Add DataPostResult

POST to /data can result in multiple different results. Add
DataPostResult encapsulate the possiblities.

Also introduce CreateResource, which is the result of POST in Operation
Create Mode -- moving some of the worries away from JAX-RS layer's
postData().

JIRA: NETCONF-773
Change-Id: I56dcde72630d53290f002e9b6258924175bb3072
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoMore NetconfCommandUtils cleanup 23/109023/2
Robert Varga [Sat, 18 Nov 2023 07:52:34 +0000 (08:52 +0100)]
More NetconfCommandUtils cleanup

We have forgotten a commented-out block of code. Eliminate it and
simplify isIpValid().

Change-Id: I051d1114f142f92a91eb429ff036f5985476b046
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRename OperationsContent 16/109016/2
Robert Varga [Fri, 17 Nov 2023 23:08:07 +0000 (00:08 +0100)]
Rename OperationsContent

A better name for this interface is OperationsGetResult, mirroring
DataPutResult.

JIRA: NETCONF-773
Change-Id: Ic00d867373fd635ac2d7de78d6d87100a8a433c3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoIntroduce RestconfServer.dataPUT() operations 15/109015/3
Robert Varga [Fri, 17 Nov 2023 21:46:07 +0000 (22:46 +0100)]
Introduce RestconfServer.dataPUT() operations

Migrate PUT operations on /data to MdsalRestconfServer/RestconfImpl.
This temporarily duplicates Insert parsing logic, which will be
eliminated in a follow-up patch.

JIRA: NETCONF-773
Change-Id: I8692fede3238cdcca283dfc7d9bc8e123b18aea7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoIntroduce RestconfServer methods for YANG Patch 14/109014/2
Robert Varga [Fri, 17 Nov 2023 19:50:11 +0000 (20:50 +0100)]
Introduce RestconfServer methods for YANG Patch

YANG Patch is a quite simple request, easily defined by RestconfServer.
This allows us to rehost JAX-RS methods to RestconfImpl.

JIRA: NETCONF-773
Change-Id: I8532685a52f7b4989125f52c758c956faebe41ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoClean up getStatusCode() 13/109013/5
Robert Varga [Fri, 17 Nov 2023 19:10:32 +0000 (20:10 +0100)]
Clean up getStatusCode()

Do not use else branches and simplify error evaluation. Rename it ot
statusOf() and put it into JaxRsCallback which is using it.

JIRA: NETCONF-773
Change-Id: I8e40f87f174a1ab62b6c5d9188f202a5f85f6028
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoAdd RestconfServer.dataPATCH() 12/109012/2
Robert Varga [Fri, 17 Nov 2023 19:02:33 +0000 (20:02 +0100)]
Add RestconfServer.dataPATCH()

Plain patch method is a rather simple operation, define it in
RestconfServer and migrate JAX-RS implementation to RestconfImpl.

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