netconf.git
9 months agoSwitch netconf-server to transport-api 88/106788/14
Ruslan Kashapov [Mon, 3 Jul 2023 14:10:19 +0000 (17:10 +0300)]
Switch netconf-server to transport-api

New transport implementation makes NetconfServerDispatcher outdated.
NetconfServerFactory interface and implementation introduced
as replacement. Netconf subsystem factory added to serve netconf
over ssh.

JIRA: NETCONF-1106
Change-Id: Id74cf3511c1129710b231869c089b4339333d7e8
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoFix postData() definition 87/107787/1
Robert Varga [Mon, 11 Sep 2023 12:27:20 +0000 (14:27 +0200)]
Fix postData() definition

The version which posts to top-level of datastore should not take an
identifier. Fix that, preventing an error.

JIRA: NETCONF-1128
Change-Id: I6623c74bf58bfb507b7aabe094128113c62aded4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoCapture ListenersBroker instances 82/107782/2
Robert Varga [Sun, 10 Sep 2023 14:21:08 +0000 (16:21 +0200)]
Capture ListenersBroker instances

Rather than having random code call out to
ListenersBroker.getInstance(), make sure we get the reference in outer
scope, mostly in a field.

JIRA: NETCONF-1104
Change-Id: I88b61e53ee36567d52fe297841e6910dea13d2ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoDo not serialize the unchanged for child-nodes-only 74/107774/2
Sangwook Ha [Fri, 8 Sep 2023 15:52:54 +0000 (08:52 -0700)]
Do not serialize the unchanged for child-nodes-only

Subscribing data change notification with the child-nodes-only mode may
generate notifications with unnecessary data change events for the list
key nodes in the data path.

Serialize only data tree nodes with effective changes. This filters out
unnecessary data change events and prevents notification of data updates
without any real changes.

Also, add missing test cases for the child-nodes-only mode.

JIRA: NETCONF-1153
Change-Id: I2ed388ee2e5c364a96240d8b5a519651cf2f5b47
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
9 months agoRemove unused InstanceIdentifierContext methods 81/107781/1
Robert Varga [Sun, 10 Sep 2023 12:39:47 +0000 (14:39 +0200)]
Remove unused InstanceIdentifierContext methods

With NormalizedNodeBodyReaders gone, we have sufficiently trimmed the
variability on InstanceIdentifierContext invocation paths.

This patch removes almost all of the weird callers who do not provide an
actual YangInstanceIdentifier.

Change-Id: Iea422bec9d61f5c8d5f845ec8e8552a690b64c2a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRemove rpc-{input,output}.json 80/107780/1
Robert Varga [Sun, 10 Sep 2023 12:35:43 +0000 (14:35 +0200)]
Remove rpc-{input,output}.json

These resources are not used anywhere. Remove them, but retain the
content of rpc-input.json in the expanded JsonOperationInputBodyTest.

Change-Id: Ia9947f811bbd2102afaef23c60388aaae7003ae7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRemove rpc-{input,output}.xml 79/107779/1
Robert Varga [Sun, 10 Sep 2023 12:29:04 +0000 (14:29 +0200)]
Remove rpc-{input,output}.xml

rpc-input.xml is used in only a single place, inline it. rpc-output.xml
is not used, as we are asserting just the NormalizedNode structure,
hence it is removed.

Change-Id: Ibb9d3a27582421f3574300ae89b49ddbb8c50b1f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRemove xmldata.xml 78/107778/1
Robert Varga [Sun, 10 Sep 2023 12:25:21 +0000 (14:25 +0200)]
Remove xmldata.xml

This is a single-use simple resource, inline it.

Change-Id: I341377055aff2bfe49796a39753f1f26ed9058df
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRemove bug7933.xml 77/107777/1
Robert Varga [Sun, 10 Sep 2023 12:21:56 +0000 (14:21 +0200)]
Remove bug7933.xml

This is a single-use simple resource, inline it.

Change-Id: I350c0ddaa2233d6821cef6e2b25dac5c267176f1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoInline jsondata.json 76/107776/1
Robert Varga [Sun, 10 Sep 2023 12:20:13 +0000 (14:20 +0200)]
Inline jsondata.json

This is a simple document used in a single place, inline it.

Change-Id: I9adf9807ff33f5a301923a15dc6a526b5809d285
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRemove AbstractNormalizedNodeBodyReader 23/107523/18
Robert Varga [Mon, 28 Aug 2023 09:23:48 +0000 (11:23 +0200)]
Remove AbstractNormalizedNodeBodyReader

We are using this reader only in postData(). Refactor users to
centralized dispatch and move the logic to ChildBody and its
specializations.

This refactor also improves dispatch to datastore resource, as we know
that such POST requests are not action invocations.

Invocation path is using OperationInputBody, so as to share decoding
with the RPC invocation path.

JIRA: NETCONF-1128
Change-Id: Ie632de94dce24d3a194c560ae41e3e86d1e8ac72
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoFix stream prefix 06/107406/1
Robert Varga [Fri, 8 Sep 2023 09:16:23 +0000 (11:16 +0200)]
Fix stream prefix

The change to tie together the strings has missed a path component, fix
that.

JIRA: NETCONF-1151
Change-Id: I09b3fa5d201c5316d0a8a63fa9c6f1b2d2fbaedc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1b88bdb4cde0c2f04ec7a235a887cb8889ffb6c2)

9 months agoCentralize notification XML namespace 54/107754/1
Robert Varga [Thu, 7 Sep 2023 12:12:48 +0000 (14:12 +0200)]
Centralize notification XML namespace

We have a string literal which is not tied to a standard. Replace it
with a NamespaceURN.NOTIFICATION reference.

Change-Id: I2d3968e5a3a492d0455a5b153c8dbfe796672036
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoClean up JSON*Formatter.createText() 40/107740/5
Robert Varga [Wed, 6 Sep 2023 21:24:02 +0000 (23:24 +0200)]
Clean up JSON*Formatter.createText()

Use proper try-with-resources blocks and take advantage of method
returns.

Also improve element ordering, with eventTime being emitted before the
body.

Finally we tie the constants used to model and highlight the problems
that are in the current implementation.

Change-Id: Ie8f8659833d91f87903d9936d8bf2c9fad5b96ff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRefactor EventFormatter interface 36/107736/3
Robert Varga [Wed, 6 Sep 2023 19:58:29 +0000 (21:58 +0200)]
Refactor EventFormatter interface

We are passing a ton of parameters around, where they are really state
captured in EventFormatter, but passed to AbstractWebsocketSerializer.

Split the four booleans we dance around into a separate TextParameters
record, which gets stored in each EventFormatter and passed to the
serializer as appropriate.

Change-Id: Ifa19e99f18a20c705e37ed0135982af9b50da755
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoOptimize AbstractWebsocketSerializer.convertPath() 35/107735/1
Robert Varga [Wed, 6 Sep 2023 20:24:51 +0000 (22:24 +0200)]
Optimize AbstractWebsocketSerializer.convertPath()

The serialization has a couple of classic duplications. Eliminate them
through simple addition of appendQName() utility method.

Also drop FIXMEs to examine the output, as it seems extremely fishy:
the namespace is a URN, which means ':' and '-' are not the same thing
and namespaces can very much differ by these.

Also key values are straight toString()'d which means QNames and similar
go through ODL-specific encoding.

Change-Id: I658e02517c1f155ba65ff9ae345228ee015a70aa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoAdd Child Nodes Only query parameter to SSE events 43/106843/6
Olivier Dugeon [Wed, 21 Jun 2023 08:35:21 +0000 (10:35 +0200)]
Add Child Nodes Only query parameter to SSE events

For SSE or Websocket, events are reported from the root node of the listen
Data Tree or from the modified leafs with the 'odl-leaf-nodes-only=true'
query parameter. This patch introduce a new 'odl-child-nodes-only' query
parameter to get only modified children in a compact form. This new option
could be considered as something in the middle between getting the whole
Data Tree from the root node and a per leaf node report.

JIRA: NETCONF-1076
Change-Id: Ibeda878a38a52f911dd8fbaa0503c4bfb56ea9b7
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoClarify NotificationQueryParams checks 34/107734/2
Robert Varga [Wed, 6 Sep 2023 17:20:45 +0000 (19:20 +0200)]
Clarify NotificationQueryParams checks

Using checkArgument() involves logical negation of the condition with
respect the message. This can get quite daunting when trying to
understand.

Switch to using plain if() statements, which make the logic much
clearer.

Also tie the messages to uri names, so users get clearer guidance.

Change-Id: I659921075fe3c9e4e234a86bceba24a771a1cf89
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoFix stack mismatch in data change event streams 65/106565/11
Sangwook Ha [Fri, 9 Jun 2023 22:17:30 +0000 (15:17 -0700)]
Fix stack mismatch in data change event streams

Data change event stream targeting a list instance requires a special
treatment to avoid mismatch between the writer stack and data.
Wrap the map entry in a map node to avoid the stack mismatch and
serialization error.

Also, add test cases to cover the use case to ListenerAdapterTest and
refactor/clean up the test class to reduce duplicate code and make file
& variable names more consistent.

JIRA: NETCONF-1051
Change-Id: I0e266f04fc77db6add4f1c44e6fd47f208c2e2f9
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRefactor OperationInputBody 31/107731/4
Robert Varga [Wed, 6 Sep 2023 11:23:38 +0000 (13:23 +0200)]
Refactor OperationInputBody

Add utility to extract the ContainerNode rather than streaming them.
Also detect empty body.

JIRA: NETCONF-1128
Change-Id: I06b8366d15353785f0f859fb7d11b927a26c3b76
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoFix XmlResourceBody builder failure 33/107733/1
Robert Varga [Wed, 6 Sep 2023 13:52:47 +0000 (15:52 +0200)]
Fix XmlResourceBody builder failure

The migration patch was not rebased, leading to a mismatch in thrown
exceptions. Fix that up.

JIRA: NETCONF-1128
Change-Id: I939d15fe2fdb61fd55411c4f4753d9a43554dfad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoSpecialize RestconfDataServiceImpl.{put,plainPatch}Data() 68/107368/23
Robert Varga [Tue, 8 Aug 2023 13:56:55 +0000 (15:56 +0200)]
Specialize RestconfDataServiceImpl.{put,plainPatch}Data()

This peels another two uses of *NormalizedNodeBodyReader, where the operation
is:
- create-or-replace, i.e. PUT
- merge, i.e. plain PATCH

In both cases the body is the resource being acted on. These body types
relate directly to target resource, hence they are represented through
ResourceBody.

JIRA: NETCONF-1128
Change-Id: Iabc0ec7e6c3d2aa1044d2fefb5f1f2635e86d094
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRequire parent topology to have been created 13/107713/2
Robert Varga [Tue, 5 Sep 2023 13:27:16 +0000 (15:27 +0200)]
Require parent topology to have been created

There is no point in re-issuing empty merges for topology, just require
it to have been created beforehand (which we already require in the
constructor).

JIRA: NETCONF-1148
Change-Id: Icd804e6d7f95651d2adbfb080171a9f264e21e79
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoProperly synchronize NetconfDeviceTopologyAdapter 96/107696/5
Robert Varga [Mon, 4 Sep 2023 20:53:33 +0000 (22:53 +0200)]
Properly synchronize NetconfDeviceTopologyAdapter

The adapter is using TransactionChain, which should always be guarded.
Make sure we guard that even when callers fail to provide their own
guards.

There is a further bug, where a failed last transaction would not
complete the closeFuture(), leaving callers stack.

Finally we disconnect from AutoCloseable and provide a shutdown()
method, which allows users to decide on how to synchronize the datastore
access. This allows us to concurrently shutdown the mount point and
datastore state and wait for the completion of the latter only after
both actions have been initiated.

JIRA: NETCONF-1146
Change-Id: Ieeb6ca485bed3553224f6845d04ae07d4c5d5176
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoBump upstreams 27/107627/5
Robert Varga [Thu, 31 Aug 2023 09:36:41 +0000 (11:36 +0200)]
Bump upstreams

Adopt:
- odlparent-13.0.4
- infrautils-6.0.2
- yangtools-11.0.1
- mdsal-12.0.1
- controller-8.0.1
- aaa-0.18.1

Change-Id: I7bc5776b8963ebbaa52b961cc3b2cfa6757b0ca3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoFix checkstyle 29/107629/4
Robert Varga [Thu, 31 Aug 2023 10:23:46 +0000 (12:23 +0200)]
Fix checkstyle

Upgraded checkstyle is flushing out new things, fix them up.

Change-Id: I46ac6cf74c243a80a6866d649914628eb19b3576
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoAdd NetconfMessage.of(Document) method 33/107433/16
matus.matok [Tue, 15 Aug 2023 16:24:29 +0000 (18:24 +0200)]
Add NetconfMessage.of(Document) method

Added a new static NetconfMessage.of(Document) factory method, which
takes a document as a parameter and based on its content returns a
correct NetconfMessage subclass or throws an exception.

JIRA: NETCONF-1014
Change-Id: I55d3c29c01df5c7d34d53f372a80729ec129a22c
Signed-off-by: matus.matok <matus.matok@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoFix netconf-server-mdsal dependencies 56/107556/1
Robert Varga [Tue, 29 Aug 2023 17:33:55 +0000 (19:33 +0200)]
Fix netconf-server-mdsal dependencies

We have used undeclared dependencies, fix that.

Change-Id: I1a3aaee271b32fbfcffa00c519d75076c53652fe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRework NetconfStartExiMessage 29/107429/7
matus.matok [Tue, 15 Aug 2023 11:21:00 +0000 (13:21 +0200)]
Rework NetconfStartExiMessage

Renamed NetconfStartExiMessage to NetconfStartExiMessageProvider as
it iss no longer a subclass of NetconfMessage. but instead it provides
a create() method that returns an RpcMessage with specific payload.

JIRA: NETCONF-1014
Change-Id: I9ab387523663854fd40bcd831bd00c0940467780
Signed-off-by: matus.matok <matus.matok@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoMake NotificationMessage constructor private 25/107425/6
matus.matok [Tue, 15 Aug 2023 09:57:37 +0000 (11:57 +0200)]
Make NotificationMessage constructor private

Made NotificationMessage constructor private and added a new static
factory method, ofNotificationContext(), with the same semantics.

This enables adding another static method, where the document will
not be wrapped, if it already represents a valid NotificationMessage.

JIRA: NETCONF-1014
Change-Id: I74ca0bb09be2652d5179956e5b54c17d9c655ab0
Signed-off-by: matus.matok <matus.matok@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoAdd is{Notification,Rpc,RpcReply}Message methods 89/107389/8
matus.matok [Fri, 11 Aug 2023 08:34:35 +0000 (10:34 +0200)]
Add is{Notification,Rpc,RpcReply}Message methods

Added public static methods is{Notification,Rpc,RpcReply}Message(Document) methods
that return true, if the document in the parameter is a NotificationMessage,
RpcMessage or RpcReplyMessage respectively. To be used in the static method
NetconfMessage.of(Document).

JIRA: NETCONF-1014
Change-Id: I61da444487bafcf9bc5e15cf8dbf8b9fa978218e
Signed-off-by: matus.matok <matus.matok@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoIntroduce RpcMessage and RpcReplyMessage 73/107373/13
matus.matok [Tue, 8 Aug 2023 12:09:00 +0000 (14:09 +0200)]
Introduce RpcMessage and RpcReplyMessage

Introduced RpcMessage and RpcReplyMessage both extending NetconfMessage, with
basic wrapping functionality. Added tests to verify correct wrapping.

JIRA: NETCONF-1014
Change-Id: I72d5d03dde6553201d2fca4db1faf5d0a844d872
Signed-off-by: matus.matok <matus.matok@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoAssert reported error 17/107517/1
Robert Varga [Sat, 26 Aug 2023 19:20:29 +0000 (21:20 +0200)]
Assert reported error

We are asserting that an error is throw, but we are not making it clear
which error should be reported. Check all errors for their
getErrorMessage().

JIRA: NETCONF-1128
Change-Id: Idded2736f070216b3c2dc976c8d9ddc601393410
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoClean up JsonBodyReaderTest 16/107516/1
Robert Varga [Sat, 26 Aug 2023 12:31:15 +0000 (14:31 +0200)]
Clean up JsonBodyReaderTest

Introduce useful utility methods.

Change-Id: Ie59e31f3c0d1156b341ee4c26c628f83ef8ff4bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoClean up RestconfDataServiceImplTest 15/107515/1
Robert Varga [Sat, 26 Aug 2023 12:19:02 +0000 (14:19 +0200)]
Clean up RestconfDataServiceImplTest

Constify test data, so that we have proper connections to the model,
reusing constructs where possible.

Change-Id: I24ef54c73c7bbb1af3792cce32b379d073ad49e8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoInline XML patch payloads 14/107514/2
Robert Varga [Sat, 26 Aug 2023 09:02:49 +0000 (11:02 +0200)]
Inline XML patch payloads

Having external XMLs is not nice, inline them as multiline strings.

Change-Id: I9f7eb79fa7691861fdf8a640b8e14422bbbc24ff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoMake resource access explicit 13/107513/2
Robert Varga [Sat, 26 Aug 2023 08:59:33 +0000 (10:59 +0200)]
Make resource access explicit

Rather than providing an InputStream, introduce a method which takes
the resource name and acquires that way.

Change-Id: I8858d193af97143baea399ffa077d5fc4101c080
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoMigrate more JSON patch payloads 12/107512/2
Robert Varga [Sat, 26 Aug 2023 08:43:40 +0000 (10:43 +0200)]
Migrate more JSON patch payloads

Inline test resources as string literals, making tests a lot cleaner.

Change-Id: I575a705167c7981efca977bf6806993fa86ff478
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoImprove reader mocking 11/107511/2
Robert Varga [Sat, 26 Aug 2023 08:32:48 +0000 (10:32 +0200)]
Improve reader mocking

Rather than passing a boolean flag, split POST/PUT method mocking, so as
to identify callers relying on either.

JIRA: NETCONF-1128
Change-Id: I8220b91da162b3a41b298e364f03da41933956fa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoEliminate AbstractBodyReaderTest.mediaType 10/107510/4
Robert Varga [Sat, 26 Aug 2023 07:55:01 +0000 (09:55 +0200)]
Eliminate AbstractBodyReaderTest.mediaType

This field is used only by concrete tests, where its content can be made
constant. Performing the trivial conversion eliminates a constructor
upcall.

JIRA: NETCONF-1128
Change-Id: I8d57ddf6047b2e3ff9d15c9cb19036eb909eb1d8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoIntroduce AbstractBody 09/107509/4
Robert Varga [Sat, 26 Aug 2023 07:23:57 +0000 (09:23 +0200)]
Introduce AbstractBody

We need to be careful about managing our InputStreams, hence unify
handling between PatchBody and StreamableOperationInputBody.

JIRA: NETCONF-1128
Change-Id: If3c3372a9dee328a27bc03b7ce19a78d690a941b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoInline AbstractIdentifierAwareJaxRsProvider 08/107508/4
Robert Varga [Sat, 26 Aug 2023 07:10:25 +0000 (09:10 +0200)]
Inline AbstractIdentifierAwareJaxRsProvider

This class has only AbstractNormalizedNodeBodyReader as its subclass,
merge the two together, allowing us to further evolve interactions.

JIRA: NETCONF-1128
Change-Id: Iad564da8983cbe06541cdbab04343f286bbd0d46
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoEliminate AbstractPatchBodyReader 47/107447/16
Robert Varga [Thu, 17 Aug 2023 20:44:59 +0000 (22:44 +0200)]
Eliminate AbstractPatchBodyReader

This patch refactors RestconfDataServiceImpl to not rely on JAX-RS for
parsing YANG Patch body. Instead of that we introduce PatchBody backed
by an InputStream and two specializations to handle parsing from
JSON/XML.

JIRA: NETCONF-1128
Change-Id: Ia7363d641ac8e3c3719bb19e8a311a9452f79a86
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoDisconnect JsonPatchBodyReader state 07/107507/1
Robert Varga [Fri, 25 Aug 2023 20:46:22 +0000 (22:46 +0200)]
Disconnect JsonPatchBodyReader state

The parser bits are independent of the class, make sure have that
expressed.

JIRA: NETCONF-1128
Change-Id: I98e27622e0101ed7772ae3e82ad9df6fa59f85c8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoPeel out AbstractInstanceIdentifierTest 06/107506/1
Robert Varga [Fri, 25 Aug 2023 20:17:12 +0000 (22:17 +0200)]
Peel out AbstractInstanceIdentifierTest

We are parsing the same context in three different tests. Centralize its
creation.

JIRA: NETCONF-1128
Change-Id: I19c32ca5de6a2ebb62c9569841d947e1c6666762
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoClarify patchData() naming 05/107505/1
Robert Varga [Fri, 25 Aug 2023 17:45:46 +0000 (19:45 +0200)]
Clarify patchData() naming

We have three methods with deal with HTTP PATCH, but they are defined in
different standards. Make this obvious in method names, lowering
reader's mental overload.

JIRA: NETCONF-1128
Change-Id: Icdd296bca23ada97d0197037d5558e26cc5a5d0d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoInline some JSON patch test files 04/107504/1
Robert Varga [Fri, 25 Aug 2023 16:43:58 +0000 (18:43 +0200)]
Inline some JSON patch test files

There is just no point in keeping these files separate, integrate them
into tests.

JIRA: NETCONF-1128
Change-Id: I2e9ab971c13dfb5eea168f5847da2adab03ccb91
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoUnify *PatchBodyReader(MountPoint)Tests 03/107503/4
Robert Varga [Fri, 25 Aug 2023 15:44:34 +0000 (17:44 +0200)]
Unify *PatchBodyReader(MountPoint)Tests

We have thorough duplication of tests here, refactor the class hierarchy
to keep us from duplicating things.

JIRA: NETCONF-1128
Change-Id: I541d708d0e00940cbd703d6dec3dacf2cf30e935
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoIntroduce AbstractPatchBodyReaderTest 02/107502/3
Robert Varga [Fri, 25 Aug 2023 15:15:38 +0000 (17:15 +0200)]
Introduce AbstractPatchBodyReaderTest

Eliminate the explicit dependency of AbstractBodyReaderTest on
PatchContext by introducing an intermediate superclass.

Also clean up references for resource loading, using the local class
name instead of a superclass.

JIRA: NETCONF-1128
Change-Id: Ie0c7a7d7f868863a27ca14d700aa0dc67190222f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoClean up moduleDataTest() 98/107498/2
Robert Varga [Fri, 25 Aug 2023 13:22:51 +0000 (15:22 +0200)]
Clean up moduleDataTest()

Make sure this test is as close as possible to its non-mounpoint
counterpart.

Change-Id: Icfc9e9f0e9f7eb189cd37f3d98cf092976902f27
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoAdd global description 66/107466/6
lubos-cicut [Tue, 22 Aug 2023 05:34:22 +0000 (07:34 +0200)]
Add global description

Add global description (info/description) to OpenApi that
states that we are providing full API for configurational
data because only those can be edited (by POST, PUT, PATCH,
DELETE) and for operational we only provide GET API.

In addition, for majority of request user can see only
config data in examples. That’s because we can show only one
example per request.

The exception when user can see operational data in example
is when data are representing operational (config false)
container with no config data in it.

JIRA: NETCONF-1138
Change-Id: I5c9de0c8780289f4557c7ce9995b8cb5d44e0290
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
9 months agoEliminate TestUtils 97/107497/2
Robert Varga [Fri, 25 Aug 2023 12:13:54 +0000 (14:13 +0200)]
Eliminate TestUtils

The utility methods in this class are not used anywhere: eliminate the
entire class.

Change-Id: Iac4c46b0506a76d51284869a211d5f0b1b32c4da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoEliminate TestUtils.loadSchemaContext() 96/107496/2
Robert Varga [Fri, 25 Aug 2023 12:10:22 +0000 (14:10 +0200)]
Eliminate TestUtils.loadSchemaContext()

There is no need to have this particular method, as we have a
replacement readily available. Also speed up the sole callers by
unifying them in an abstract superclass.

Change-Id: Ifebba4ac3e284d501dfb5867fd38affea0564b16
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoEliminate TestRestconfUtils 93/107493/3
Robert Varga [Fri, 25 Aug 2023 10:41:53 +0000 (12:41 +0200)]
Eliminate TestRestconfUtils

This class is largely unused. Move the single used method to
AbstractBodyReaderTest, adjusting its users.

Change-Id: I26aa4f974c9bc7e3f431a470dc9a05571eebd330
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoEliminate schemaContextLoader() 92/107492/3
Robert Varga [Fri, 25 Aug 2023 10:36:49 +0000 (12:36 +0200)]
Eliminate schemaContextLoader()

This is a superfluous method, replace it with a proper constructor
defaulting to the shared baseline context.

Change-Id: I5629bf33ce2af941693c2ca17b2a4438a2b861fb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRemove superfluous throws 90/107490/3
Robert Varga [Fri, 25 Aug 2023 10:23:04 +0000 (12:23 +0200)]
Remove superfluous throws

There is no point in declaring reflection-related exceptions as thrown,
since we never report them. Clean this particular mess up.

Change-Id: I9c1214420ce62a27b0fd4d7ffe90717ed2598086
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoReduce TestRestconfUtils proliferation 89/107489/3
Robert Varga [Fri, 25 Aug 2023 10:16:16 +0000 (12:16 +0200)]
Reduce TestRestconfUtils proliferation

We are parsing a single resource directory, use the appropriate tool
from yang-test-util.

Change-Id: Ibcb077754dc61e3bc7f35fb6e98d77a0e5bea543
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoSpeed up XmlPatchBodyReader 88/107488/3
Robert Varga [Fri, 25 Aug 2023 09:54:22 +0000 (11:54 +0200)]
Speed up XmlPatchBodyReader

Use local variable type inference to improve binding to
implementations. Also use instanceof pattern to skip duplicate item
lookups.

Change-Id: Ic768fcd171a3d62a02d47de0f36e5bd80bc112cf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRemove unused jsonPatchBodyReader.readFrom() 87/107487/5
Robert Varga [Fri, 25 Aug 2023 09:26:23 +0000 (11:26 +0200)]
Remove unused jsonPatchBodyReader.readFrom()

This method is completely unused, remove it.

JIRA: NETCONF-1128
Change-Id: Ib74ee6a414982ce9432f032eb2a49bf5ff085b37
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoFix restconf capabilities writer 69/107469/4
Yaroslav Lastivka [Wed, 2 Aug 2023 10:39:07 +0000 (13:39 +0300)]
Fix restconf capabilities writer

Using incorrect type of leaf set causes validation failure
on attempt to persist capabilities to datastore. Also fixed
typo in method name.

JIRA: NETCONF-668
Change-Id: Ia87102b069a5a42b69a29c462e912775154c2be7
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
9 months agoAdd test for reduced number of schemas 85/107385/4
Ivan Hrasko [Thu, 10 Aug 2023 15:36:48 +0000 (17:36 +0200)]
Add test for reduced number of schemas

We have lower down the number of schemas used, for example,
now we are using the same schema for all content types of (XML, JSON)
of particular operation.

Add test to reflect this.

JIRA: NETCONF-982
Change-Id: I4e42e08e30fa72fec23c9da92372557ebbaa0351
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
9 months agoFix PATCH target with a single forward slash 37/106937/8
Sangwook Ha [Wed, 19 Jul 2023 01:50:50 +0000 (18:50 -0700)]
Fix PATCH target with a single forward slash

The targetSchemaNode is set to the root in JsonPatchBodyReader if
'target' is '/' regardless of the URI path which causes failure in
processing a PATCH request with 'target' of '/' if the URI goes deeper
than the top level data nodes.

Consolidate the processing of target in ParserIdentifier and update
inference based on the effective target node whether target is '/' or
not. And add test cases to cover the failure scenarios.

JIRA: NETCONF-1095
Change-Id: I8ca81dd47e01805cfd45c45ec3fe795fece62697
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoConvert CredentialServiceAuthProviderTest to JUnit5 63/107463/3
Robert Varga [Mon, 7 Aug 2023 12:01:13 +0000 (14:01 +0200)]
Convert CredentialServiceAuthProviderTest to JUnit5

This is a simplistic test, convert it.

Change-Id: Iaac999d069ae16bf2f118d7c66c68d0166f7f682
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoFix tests formatting in callhome-protocol 96/106796/6
Peter Suna [Tue, 4 Jul 2023 11:15:15 +0000 (13:15 +0200)]
Fix tests formatting in callhome-protocol

- Use final var for variables.
- Move variables closer to their actual usage.
- Use Exception in tests.
- Move class attributes to local variable if it is possible.
- Use 4 tab continuation indent.

Change-Id: Icdae07a71d0f24e38f12bcebb7ea74438e0b11a4
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
9 months agoRefactor NetconfNodeHandlerTest 37/107337/12
Matej Sramcik [Tue, 8 Aug 2023 10:15:32 +0000 (12:15 +0200)]
Refactor NetconfNodeHandlerTest

Address refactoring comments in NetconfNodeHandlerTest.
Create non-null values for onDeviceConnected method parameters in test.

JIRA: NETCONF-1132
Change-Id: I45ac08c8d060ac1f44251919608067f0ca3c7e41
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
9 months agoEnable usage of yanglib-mdsal-writer 10/107210/11
Yaroslav Lastivka [Wed, 2 Aug 2023 10:39:07 +0000 (13:39 +0300)]
Enable usage of yanglib-mdsal-writer

Added new feature 'odl-yanglib-mdsal-writer'.
The 'mdsal-netconf-yang-library' module has been deleted,
and the usage of 'odl-yanglib-mdsal-writer' has been replaced.

JIRA: NETCONF-668
Change-Id: I79d5637f93391f93c1bea9e7da94f566abeb81e3
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
9 months agoStandalone yang library data writer 53/107053/15
Ruslan Kashapov [Tue, 25 Jul 2023 15:14:19 +0000 (18:14 +0300)]
Standalone yang library data writer

Due to yang library data is being written from multiple places
it may cause data inconsistency and/or corruption. New standalone
dedicated module is designed to replace existing writers with
single one.

JIRA: NETCONF-668
Change-Id: I34021ce5b26ee35b9662b8b156423fff5dbd9c80
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
9 months agoUse List and Map in OpenApi security 42/106842/20
Šimon Ukuš [Wed, 12 Jul 2023 10:16:14 +0000 (12:16 +0200)]
Use List and Map in OpenApi security

Swagger specification says "security is an array of hashmaps".

This change replaces the use of ArrayNode for java.util.List
and ObjectNode for java.util.Map.

JIRA: NETCONF-1075
Change-Id: Ic88d0de29d4c4abb2bc37db34033a0ae03434901
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
9 months agoAllow multiple security entries in securitySchema 39/106839/22
Šimon Ukuš [Fri, 7 Jul 2023 10:28:56 +0000 (12:28 +0200)]
Allow multiple security entries in securitySchema

The swagger docs specifies that the securitySchema is a map of entries
with the key being a custom name of the security method and the value
being an instance of a Security Scheme Object.

This change replaces the use of JsonNode etc., which added extra
overhead, for classes from java API and custom records.
It reworks the securitySchemes field in Components to be a map
and introduces an interface SecuritySchemeObject to be implemented
by records that represent the specific security object type.

It also introduces an Http record - an implementation of said interface.
Others might come in the future.

JIRA: NETCONF-1075
Change-Id: I2a53b9002871e19808eef95739a07f5acd958815
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
9 months agoSet default for instance-identifier type 81/105881/35
tobias.pobocik [Wed, 10 May 2023 11:24:34 +0000 (13:24 +0200)]
Set default for instance-identifier type

Assign example value as the first container in a model,
and assign default value from existing yang model default.

JIRA: NETCONF-999
Change-Id: I36450788b4ade0d386d48cf99c17055acdf41e70
Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
9 months agoMove NetconfMessage into netconf.api.messages 60/107360/4
matus.matok [Tue, 8 Aug 2023 10:06:36 +0000 (12:06 +0200)]
Move NetconfMessage into netconf.api.messages

Moved NetconfMessage into netconf.api.messages in order to prepare it for future
changes related to NetconfMessage.

JIRA: NETCONF-1014
Change-Id: I72e59385555a9c4e3b41669cb8bb8ae8f3505126
Signed-off-by: matus.matok <matus.matok@pantheon.tech>
9 months agoEliminate AsyncSshHandlerReader in call home 20/94120/31
Konstantin.Nosach [Thu, 22 Jul 2021 10:35:32 +0000 (13:35 +0300)]
Eliminate AsyncSshHandlerReader in call home

Using AsyncSshHandlerReader don't require ChannelHandlerContext
for reading.

After eliminating AsyncSshHandlerReader, we need to create
a ChannelSubsystem with the ChannelHandlerContext, which we can
only obtain after creating and calling the open listener on the
ChannelSubsystem.

Current solution is to utilize pipelines from MinaSshNettyChannel.

The logic from MinaSshNettyChannel has been moved
to CallHomeSessionContext, where a ChannelOutboundHandlerAdapter
is created and added as the first in the pipeline.

This call will create the ChannelHandlerContext in the pipeline,
and it can be used later inside the ChannelSubsystem.

JIRA: NETCONF-699
Change-Id: I58c702949bc31061b89b12d166f0fa6b8bc383c7
Signed-off-by: Kostiantyn Nosach <kostiantyn.nosach@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
9 months agoConvert SchemaExportContext to Java record 60/107460/5
lubos-cicut [Mon, 21 Aug 2023 10:55:40 +0000 (12:55 +0200)]
Convert SchemaExportContext to Java record

SchemaExportContext Class converted into Java Record. Usage
of methods simplified.

JIRA: NETCONF-1136
Change-Id: Ia2f4ee168ca5e94bb883bbb4075886a91646fad9
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
9 months agoConvert PatchStatusContext to Java record 59/107459/4
lubos-cicut [Tue, 22 Aug 2023 11:26:15 +0000 (13:26 +0200)]
Convert PatchStatusContext to Java record

PatchStatusContext Class converted into Java Record. Usage
of methods simplified.

JIRA: NETCONF-1135
Change-Id: I9e6de67b0c4c31617a708470ce566d7519a48051
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
9 months agoRefactor OperationBuilder class 70/107470/1
Ivan Hrasko [Tue, 22 Aug 2023 11:29:45 +0000 (13:29 +0200)]
Refactor OperationBuilder class

Remove unused method "buildResponse", do not use Optional
as method parameter.

Change-Id: I50b22fc8f4ee084698ec173e63fc1b80d8073086
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
9 months agoOpenApi create required operational data 94/106894/15
Peter Suna [Thu, 13 Jul 2023 13:23:05 +0000 (15:23 +0200)]
OpenApi create required operational data

Create only required operational data to provide example
for operational GET request.
This removed duplicity with configurational and operational nodes
in OpenApi schemas by creating only operational container and lists.

For container and lists are created specific GET request only for
operational data. This patch solves this by creating only required
operational data and not mixing them with configurational data.

JIRA: NETCONF-1142
Change-Id: I4f1f544f9cf65b6f58ad9c2068cec6ac1c0927f0
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
9 months agoSet default for number type 80/105880/30
tobias.pobocik [Wed, 10 May 2023 11:23:35 +0000 (13:23 +0200)]
Set default for number type

We should distinguish between "default" and "example" OpenAPI
property.

Set "default" with "example" since it was misused.

JIRA: NETCONF-999
Change-Id: I2fbb6ab7643c6028219f38da3e07d2e67a8f3049
Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
10 months agoEliminate PatchEditOperation 57/107457/2
Robert Varga [Sun, 20 Aug 2023 16:35:54 +0000 (18:35 +0200)]
Eliminate PatchEditOperation

PatchEditOperation has little added value compared to the generated
Operation enum. Furthermore it is overly-lenient, requiring case
conversion.

Eliminate PatchEditOperation and replace it with Operation. Rehost
isWithValue() into a separate utility method in AbstractPatchBodyReader.

JIRA: NETCONF-1118
Change-Id: Ib3bc102f69ca3a618b7e58d0e537fa485b4ed665
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoUse ImmutableList.Builder for edits 56/107456/1
Robert Varga [Sun, 20 Aug 2023 16:12:13 +0000 (18:12 +0200)]
Use ImmutableList.Builder for edits

Do not pass a List down, just a builder.

JIRA: NETCONF-1128
Change-Id: I0beec35bfae225837bae69b9a864940358562af3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoMove parserPatchTarget() 55/107455/1
Robert Varga [Sun, 20 Aug 2023 16:03:35 +0000 (18:03 +0200)]
Move parserPatchTarget()

This method is only used in AbstractPatchBodyReader specializations,
move it to common superclass.

JIRA: NETCONF-1128
Change-Id: Iea9993606591d80d8247755d3c63a3b4d43a0ade
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoEliminate UriInfo parameters 53/107453/1
Robert Varga [Sat, 19 Aug 2023 15:54:04 +0000 (17:54 +0200)]
Eliminate UriInfo parameters

PATCH requests are not using URI information, hence we do not need to
specify them.

JIRA: NETCONF-1128
Change-Id: Ib3b574039a6e16944d62e21b6a3352b22a66cfd5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoEliminate restconf.common.patch.Patch 52/107452/1
Robert Varga [Fri, 18 Aug 2023 15:17:40 +0000 (17:17 +0200)]
Eliminate restconf.common.patch.Patch

This annotation is completely superfluous, remove it.

JIRA: NETCONF-1141
Change-Id: I42508e6d0b03dfc4571fed906bc074bb257b3229
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoDeprecate @Patch 51/107451/1
Robert Varga [Fri, 18 Aug 2023 15:00:12 +0000 (17:00 +0200)]
Deprecate @Patch

JAX-RS 2.1+ contains a @PATCH annotation, there is no point of brewing
our own.

JIRA: NETCONF-1140
Change-Id: Id27e8936bf50fa90ed5e240ffb9adb08679a28be
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoUse first child in POST payloads 71/107271/15
Yaroslav Lastivka [Fri, 4 Aug 2023 07:40:33 +0000 (10:40 +0300)]
Use first child in POST payloads

Enhanced the logic to generate POST payloads by choosing one
child for both container and list types.
Introduced unit tests to validate the correctness of the
request body generated by this new logic.

JIRA: NETCONF-1054
Change-Id: I8568f570fe77a9ef0b7f20122feef6a85758ccef
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoEliminate TOP schemas 64/107364/13
Oleksandr Zharov [Tue, 8 Aug 2023 12:18:59 +0000 (14:18 +0200)]
Eliminate TOP schemas

Removed TOP schemas from OpenApi object.

JIRA: NETCONF-1057
Change-Id: I88d8d5f5f52f9215d1124a26e54330252580c8f8
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoDo not use TOP schemas in RPC requests 59/107359/14
Oleksandr Zharov [Tue, 8 Aug 2023 10:36:28 +0000 (12:36 +0200)]
Do not use TOP schemas in RPC requests

Refactored RPC operations in order to stop using TOP schemas for
generation of it's request body.

JIRA: NETCONF-1057
Change-Id: Ib5bf2a258a8aa9df515a9a466ddcbc5a99a0dea4
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
10 months agoDo not use TOP schemas in GET requests 63/107263/12
Oleksandr Zharov [Fri, 4 Aug 2023 21:13:14 +0000 (23:13 +0200)]
Do not use TOP schemas in GET requests

Refactored GET operations in order to stop using TOP schemas for
generation of it's request body.

JIRA: NETCONF-1057
Change-Id: I12ad1c9e9b54ec2b7f50f5f5bc2b90ba4327a66e
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
10 months agoDo not use TOP schemas in PATCH requests 38/107238/15
Oleksandr Zharov [Thu, 3 Aug 2023 16:56:35 +0000 (18:56 +0200)]
Do not use TOP schemas in PATCH requests

Refactored PATCH operations in order to stop using TOP schemas for
generation of it's request body.

JIRA: NETCONF-1057
Change-Id: I969e092a27d524d75b5e53d9bbd9b7dce93fc1e1
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoDo not use TOP schemas in PUT requests 23/107223/16
Oleksandr Zharov [Thu, 3 Aug 2023 13:12:47 +0000 (15:12 +0200)]
Do not use TOP schemas in PUT requests

Refactored PUT operations in order to stop using TOP schemas for
generation of it's request body.

JIRA: NETCONF-1057
Change-Id: I7d57fd0ec188091cce983629b7ce37ce8179075e
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoSpecialize RestconfInvokeOperationsServiceImpl.invokeRpc() 32/107332/10
Robert Varga [Mon, 7 Aug 2023 22:45:09 +0000 (00:45 +0200)]
Specialize RestconfInvokeOperationsServiceImpl.invokeRpc()

Do not use NormalizedNodePayload, but instead inline handling, so that
we are in explicit control of how input is interpreted.

For XML case we also side-step the need to go through a org.w3c.Document,
speeding up deconding.

This eliminates out the first of the four uses of *NormalizedNodeBodyReader,
but it does not reduce its complexity due to codepaths being shared with
the action invocation (which goes through POST).

JIRA: NETCONF-1128
Change-Id: I2d36b38236dcddc1849133a13c1bc9766f54fc8b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoFix processTypeDef method call 32/107432/1
Ivan Hrasko [Tue, 15 Aug 2023 15:11:03 +0000 (17:11 +0200)]
Fix processTypeDef method call

We are missing module parameter in processTypeDef method call.
Fix it.

Change-Id: I7abda0dbe90cd62ad1f2489096f064122227140b
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoBump json-unit-assertj to 3.0.0 30/107430/3
Oleksandr Zharov [Tue, 15 Aug 2023 11:33:55 +0000 (13:33 +0200)]
Bump json-unit-assertj to 3.0.0

https://github.com/lukas-krecan/JsonUnit#300-2023-07-05

Change-Id: Ie6413689a5e4f32a5eea5066717e209e81fae440
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
10 months agoBump json to version 20230618 27/107427/2
Ivan Hrasko [Tue, 15 Aug 2023 10:46:26 +0000 (12:46 +0200)]
Bump json to version 20230618

https://github.com/stleary/JSON-java/releases/tag/20230618

Change-Id: Iafb38fc01ec3de6c449beae67f5a9dcbbf313f2b
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoBump json to version 20230227 26/107426/2
Ivan Hrasko [Tue, 15 Aug 2023 10:41:08 +0000 (12:41 +0200)]
Bump json to version 20230227

https://github.com/stleary/JSON-java/releases/tag/20230227

Change-Id: I9548b25ad768d201f26abaaa1a1f10d07efe0667
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoImprove union type processing 34/107334/4
Ivan Hrasko [Tue, 8 Aug 2023 09:02:43 +0000 (11:02 +0200)]
Improve union type processing

Instead of introducing cumbersome logic for union processing,
choose first one.

JIRA: NETCONF-1124
Change-Id: I6f79cfc0edafd9cf3cdd25dff4a751b69ad15953
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
10 months agoMove generateUrlPrefixFromInstanceID method 20/107420/2
Ivan Hrasko [Mon, 14 Aug 2023 13:21:20 +0000 (15:21 +0200)]
Move generateUrlPrefixFromInstanceID method

Move generateUrlPrefixFromInstanceID to MountPointOpenApi class
as it is its only user.

Change-Id: I80c91b989767cb81e05feb3ee09e0505de0d465c
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoOpenaApi: Use empty content for operational GET 47/106747/17
Peter Suna [Wed, 28 Jun 2023 10:29:58 +0000 (12:29 +0200)]
OpenaApi: Use empty content for operational GET

Previously, operational data was included in schemas
to provide a GET example for operational containers and lists.
However, removing this operational data caused an error in
the OpenAPI UI since the expected data was not found.

To address this issue, the operational data can be replaced
with empty content instead. Creating a duplicate schema
specifically for this use case is both memory-intensive
and unnecessary.

This commit solves the problem by adding empty example
for the operational GET data.

JIRA: NETCONF-1061
Change-Id: I1444aad588c42417e5ff21dee46ff91ec0a1a07d
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoConvert DefinitionGenerator into utility class 71/107371/13
lubos-cicut [Thu, 10 Aug 2023 04:26:54 +0000 (06:26 +0200)]
Convert DefinitionGenerator into utility class

DefinitionGenerator was generally being used as it was
utility class. Converted into utility class.

The only instance field topLevelModule has been converted
into method parameter.

JIRA: NETCONF-1122
Change-Id: I5cb76e8b6baa1a8b6f5776a8da1518bae9e5e973
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoOpenApi: Fix module names in Json payload 78/107078/3
Peter Suna [Mon, 24 Jul 2023 10:18:08 +0000 (12:18 +0200)]
OpenApi: Fix module names in Json payload

Ensure the correct module name format MODULE_NAME:NODE_NAME
is used for the first node in the PUT request.
Otherwise, it may result in a 400 error:
"Error parsing input: Choose suitable module name for element..."

JIRA: NETCONF-1083
Change-Id: I9ca3bc62754855a551e8fea4e552b784a8e6c426
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
10 months agoRework summary creation by formatting text blocks 34/106934/13
Šimon Ukuš [Mon, 17 Jul 2023 12:58:31 +0000 (14:58 +0200)]
Rework summary creation by formatting text blocks

We had a dedicated method to construct a basic summary.
Remove the method and use formatted text block to increase readability.

JIRA: NETCONF-1088
Change-Id: I019403b4725c30f0e06ab05d68523bab633f0128
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>