netconf.git
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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
10 months agoAdd sonarcloud badges to README 92/107192/8
Matej Sramcik [Tue, 1 Aug 2023 14:10:37 +0000 (16:10 +0200)]
Add sonarcloud badges to README

Add sonarcloud badges: Reliability Rating, Quality Gate Status,
Technical Debt, Coverage, Lines of Code, Code Smells, Maintainability
Rating, Security Rating, Vulnerabilities and Duplicated Lines.

JIRA: NETCONF-1091
Change-Id: Ic9fdd1435b1773446b1bfa0de7fd01ad0f41d8b5
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoAdd maven, javadoc and license badges to README 48/106948/8
Matej Sramcik [Fri, 21 Jul 2023 08:18:18 +0000 (10:18 +0200)]
Add maven, javadoc and license badges to README

Add maven central, javadoc and license badges to README.

JIRA: NETCONF-1091
Change-Id: If090ad34aeb103a08e6a01ad8d7ea39f9e94ca9d
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoDisconnect PostDataTransactionUtil from JAX-RS 67/107367/3
Robert Varga [Tue, 8 Aug 2023 13:53:05 +0000 (15:53 +0200)]
Disconnect PostDataTransactionUtil from JAX-RS

We are only creating a location from the passed-in UriInfo. This should
really be done in RestconfDataServiceImpl.

JIRA: NETCONF-1126
Change-Id: I3faa4fa6d494032cbfa7b7322ecf16fc342f1ffc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoUpdate RestconfDataServiceImplTest assertions 66/107366/4
Robert Varga [Tue, 8 Aug 2023 12:39:35 +0000 (14:39 +0200)]
Update RestconfDataServiceImplTest assertions

We are exercising the main API entrypoint here based on JAX-RS Response.
Add an explicit test for posting a keyed list item.

JIRA: NETCONF-1126
Change-Id: I99895dde662e4bb51627f5153f2e14624fb9c8b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoUse {JUKEBOX,GAP}_IID 65/107365/3
Robert Varga [Tue, 8 Aug 2023 13:17:23 +0000 (15:17 +0200)]
Use {JUKEBOX,GAP}_IID

We have AbstractJukeboxTest provides pre-built constants for these
constructs. Use those instead rolling our own.

Change-Id: I30319f0af86971fe69f47c8e6860e4496068d41d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoDisconnect PutDataTransactionUtil from JAX-RS 63/107363/2
Robert Varga [Tue, 8 Aug 2023 09:32:16 +0000 (11:32 +0200)]
Disconnect PutDataTransactionUtil from JAX-RS

The only information being conveyed here through response are the two
possible outcomes. Capture those outcomes in CreateOrReplaceResult
and let RestconfDataServiceImpl turn them into appropriate Responses.

JIRA: NETCONF-1125
Change-Id: Ia6303d3ed7e8e02aaba5403cce8b4482bf775660
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoRemove RestDocgenUtil#resolveNodesName method 74/107374/1
Ivan Hrasko [Wed, 9 Aug 2023 10:53:21 +0000 (12:53 +0200)]
Remove RestDocgenUtil#resolveNodesName method

Remove deprecated and not used RestDocgenUtil#resolveNodesName method.

JIRA: NETCONF-1129
Change-Id: I74695908b733964f8fb6f0f568cb5adc8403cba2
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoTest Path with single module vs all modules 43/106943/9
Šimon Ukuš [Fri, 21 Jul 2023 09:48:04 +0000 (11:48 +0200)]
Test Path with single module vs all modules

There are differences between Paths that are constructed
when building OpenApiObject for single module of a mounted
device "/mounts/{instance}/{module}({revision})" vs
when requesting it for all modules of the device "/mounts/{instance}".
The differences are are in summary value and tags value, where
the deviceName was missing when building OpenApiObject for single
module.

Tests are provided to check whether the summary is created as expected
and also to verify that there is no difference in the paths field
of the OpenApiObject between the two ways of requesting it (single
module vs all modules).

JIRA: NETCONF-1090
Change-Id: I577629e91a58383a38c73bd27847f5dadd27e115
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoConsolidate methods called once in OpenApi 30/106930/6
Šimon Ukuš [Mon, 17 Jul 2023 12:58:31 +0000 (14:58 +0200)]
Consolidate methods called once in OpenApi

Previous change, which prevented the deviceName from being null,
reduced the number of calls to some private methods to one call.

This change moves the contents of those methods to the caller.

JIRA: NETCONF-1089
Change-Id: I6c05f8ac8e20c193e33dffe574b9e8a367d10eb4
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
10 months agoRework tags creation in OpenApi 32/106932/17
Šimon Ukuš [Tue, 18 Jul 2023 12:21:00 +0000 (14:21 +0200)]
Rework tags creation in OpenApi

The tags values inside Operation object, according to Swagger spec
https://swagger.io/specification/#operation-object, do not have
any specific requirement. We are storing them in an ArrayNode,
which adds unnecessary overhead.

This change replaces the ArrayNode for List<String>.

JIRA: NETCONF-1087
Change-Id: I3a75b57f885503780867702a400d1be1c3ec6567
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
10 months agoMake deviceName not to be null 25/106925/12
Šimon Ukuš [Mon, 17 Jul 2023 11:37:59 +0000 (13:37 +0200)]
Make deviceName not to be null

We are passing null value of deviceName to methods only if the request,
for swagger document, is for controller (not a mounted device).
In that case we want "Controller" in place of the deviceName.

This change removes @Nullable annotations around String deviceName
and reworks the calls to methods, to pass "Controller" instead of
null value.

JIRA: NETCONF-1089
Change-Id: I5b37419f81c12c21f4ef65cc90e7b8dceb79995c
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoFix deviceName with specific module request 26/106926/12
Šimon Ukuš [Mon, 17 Jul 2023 12:58:31 +0000 (14:58 +0200)]
Fix deviceName with specific module request

When requesting swagger document for a specific module under a specific
mounted device, the deviceName was ignored and not included in the
summary of the paths.

This change makes the deviceName part of the summary of the paths.

JIRA: NETCONF-1090
Change-Id: I1c50ecc6c69c82fd110d1ba5b67d631df1b95337
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoFix build when GID exceeds 2097151 62/107362/3
matus.matok [Tue, 8 Aug 2023 11:03:18 +0000 (13:03 +0200)]
Fix build when GID exceeds 2097151

Fixed the build of the netconf-testtool module for users whose primary group id is greater than 2097151.

JIRA: NETCONF-1127
Change-Id: Ib9331a9d57e31bf3f78adfb7493ce21bca674d0c
Signed-off-by: matus.matok <matus.matok@pantheon.tech>
10 months agoAdd keys into configuration lists 57/106957/5
Ivan Hrasko [Fri, 21 Jul 2023 12:00:37 +0000 (14:00 +0200)]
Add keys into configuration lists

According to RFC 7950 configuration list MUST have key statement.

Fix restconf-openapi test models accordingly.

JIRA: NETCONF-1082
Change-Id: Ibc8c202f55886a69bb217bb1e7a3a6b9854c094e
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
10 months agoEliminate duplicate logic for anyXml/anyData 92/106892/12
Matej Sramcik [Wed, 12 Jul 2023 12:51:57 +0000 (14:51 +0200)]
Eliminate duplicate logic for anyXml/anyData

Methods processAnydataNode and processAnyXMLNode were almost
identical.
Methods are merged into single method processUnknownDataSchemaNode,
which can process both AnyxmlSchemaNode and AnydataSchemaNode.

JIRA: NETCONF-1079
Change-Id: Ied831a543b40f8876503eb78788c11e93b6e87cc
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
10 months agoAdd value "all" to content query parameter 74/106974/7
Šimon Ukuš [Fri, 21 Jul 2023 13:05:33 +0000 (15:05 +0200)]
Add value "all" to content query parameter

The query parameter content can be omitted or used with values:
"config", "nonconfig", "all".

We are not showing the "all" value in OpenApi, which is fixed here.

When at place eliminate one-time constants.

JIRA: NETCONF-1094
Change-Id: Ic42bdcfec0e6db486f54e4fdc45debc49e9ebd50
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoRemove OpenApiObject builder 79/106479/42
Oleksandr Zharov [Wed, 14 Jun 2023 08:45:03 +0000 (10:45 +0200)]
Remove OpenApiObject builder

Removed builder for OpenApiObject and changed all affected methods
according to new logic.

Refactored code to avoid mutating schemas and paths.

JIRA: NETCONF-1052
Change-Id: I949dbdf79705a9e95353ce92b6c6ff8e321db4fe
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoRemove createOpenApiObjectBuilder method 76/106476/36
Oleksandr Zharov [Tue, 13 Jun 2023 16:17:15 +0000 (18:17 +0200)]
Remove createOpenApiObjectBuilder method

Removing this method in prepare for next patch where
we will remove OpenApiObject#Builder.

JIRA: NETCONF-1052
Change-Id: I1f50bd1d9717b1d98215c6f1bc5b71b64fb1eca6
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoRefactor getOpenApiSpec method 66/106466/25
Oleksandr Zharov [Tue, 13 Jun 2023 12:24:26 +0000 (14:24 +0200)]
Refactor getOpenApiSpec method

Refactored BaseYangOpenApiGenerator#getOpenApiSpec.

This method did more than one thing thus it has been divided into
getSchemas and getPaths methods.

JIRA: NETCONF-1052
Change-Id: If0f3ab19597c5fcdc767b51a295750ef65541dc5
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoMigrate to restconf-common to JUnit5 83/107283/2
Robert Varga [Mon, 7 Aug 2023 09:05:18 +0000 (11:05 +0200)]
Migrate to restconf-common to JUnit5

This is a straightforward migration to a parameterized test.

Change-Id: Ibf6aed9810e9872777d4f322c5f3c4b5a2adc809
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoMigrate restconf-api to JUnit5 82/107282/2
Robert Varga [Mon, 7 Aug 2023 08:57:56 +0000 (10:57 +0200)]
Migrate restconf-api to JUnit5

Automated conversion, with some hand-editing to ditch hamcrest.

Change-Id: I337912a5ee06d74caf29ab67a351800a9fbae872
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 months agoRemove "config" prefix from OpenApi 95/106895/11
Peter Suna [Thu, 13 Jul 2023 15:55:39 +0000 (17:55 +0200)]
Remove "config" prefix from OpenApi

Remove "config" prefix from OpenApi schemas node.

It is no longer required as configurational data and operational
data are not being created multiple times.

JIRA: NETCONF-982
Change-Id: I56be54dcb9a36cc41c4955ae40aa9f94b701bd83
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
10 months agoEliminate putIfNonNull(ObjectNode, String, Number) 61/107261/8
Ivan Hrasko [Fri, 4 Aug 2023 14:36:36 +0000 (16:36 +0200)]
Eliminate putIfNonNull(ObjectNode, String, Number)

Eliminate DefinitionGenerator#putIfNonNull(ObjectNode, String, Number)
method because:
- range type is always Integer
- com.google.common.collect.Range is designed to reject null values
- key is never null - we have passed it into the method

JIRA: NETCONF-1120
Change-Id: If5eed0da8b5cb461c024315bde0d286d7d1ab3ea
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
10 months agoFix NetconfNodeHandler interactions 20/107020/14
Robert Varga [Sat, 5 Aug 2023 23:08:28 +0000 (01:08 +0200)]
Fix NetconfNodeHandler interactions

There are a couple of failures in interacting with RemoteDeviceHandler
API (which is completely undocumented).

The API design (and interactions in implementations) assume that:
- onDeviceConnected()/onDeviceDisconnected() manage a reconnecting
  process -- i.e. when 'disconnected' it is assumed the device might
  come back again
- onDeviceFailed() is the hard alternative, indicating the node is node
  coming back

This is then picked up and routed through NetconfTopologyDeviceSalFacade
to NetconfDeviceTopologyAdapter, which makes assumptions and propagates
them to the datastore.

JIRA: NETCONF-1097
Change-Id: Ib148a617b52e775261212aa3a809d1ab450d7d13
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>