netconf.git
16 months agoAdd Builder for Operations 37/106437/4
OleksandrZharov [Fri, 9 Jun 2023 14:35:42 +0000 (16:35 +0200)]
Add Builder for Operations

Added nested Builder for Operations. It help us to limit usage
of null and increase readability.

JIRA: NETCONF-1050
Change-Id: Iaf931433872b82f0a36ca32847cc9da4baec2a3d
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
16 months agoOpenAPI: Eliminate ListPathBuilder interface 04/106404/4
Yaroslav Lastivka [Wed, 7 Jun 2023 14:09:05 +0000 (17:09 +0300)]
OpenAPI: Eliminate ListPathBuilder interface

ListPathBuilder interface has been eliminated.

JIRA: NETCONF-1048
Change-Id: Ia1b602ca7a3a740a78249b8bb17f8d8a05303a28
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
16 months agoEliminate createUniquePathParamName method 02/106402/3
Yaroslav Lastivka [Wed, 7 Jun 2023 13:00:57 +0000 (16:00 +0300)]
Eliminate createUniquePathParamName method

The method 'createUniquePathParamName' has been eliminated.

Instead, use a new logic using a variable named 'discriminator'.
This variable increments on each occurrence of parameter name.

JIRA: NETCONF-1047
Change-Id: I512bed32f27e4eb4ad51afc6e90fd484793cb2fb
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
16 months agoSet example for enum type 52/105652/9
Ivan Hrasko [Tue, 25 Apr 2023 12:12:58 +0000 (14:12 +0200)]
Set example for enum type

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

Set "default" only when enum has defined default value in YANG model.
Otherwise set "example" as a first element of enumeration.

JIRA: NETCONF-999
Change-Id: I1873115deacb3f7b06537d1427c1b2e3d4ea82cd
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
16 months agoReplace Guava's ImmutableList by java.util.List 81/106481/5
Ivan Hrasko [Wed, 14 Jun 2023 12:24:31 +0000 (14:24 +0200)]
Replace Guava's ImmutableList by java.util.List

Use java.util.List.of/copyOf instead of Guava's ImmutableList.of/copyOf
in RestconfDocumentedException class.

Change-Id: I7a7abe0e56f5b06becfa4bbe8099025b11fb4d8b
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
16 months agoFix Broken refresh in network-topology-singleton 25/106425/6
Peter Suna [Thu, 8 Jun 2023 11:20:56 +0000 (13:20 +0200)]
Fix Broken refresh in network-topology-singleton

Add missed functionality from patch:
https://git.opendaylight.org/gerrit/c/netconf/+/104177

Revert NetconfTopologyManagerTest.
Use refresh method instead of instantiateServiceInstance method.

JIRA: NETCONF-1046
Change-Id: I351e4248928f3c49253a8ccefc414ee8f1a104ce
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoRemove ObjectMapper from BaseYangOpenApiGenerator 29/106429/3
Ivan Hrasko [Thu, 8 Jun 2023 13:15:51 +0000 (15:15 +0200)]
Remove ObjectMapper from BaseYangOpenApiGenerator

Its unfortunate to use heavy ObjectMapper for logging purposes.

Change-Id: I6357d4bd768065144dc8dee2d4f0b722278b5994
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoRemove ObjectMapper from OpenApiServiceImplTest 28/106428/2
Ivan Hrasko [Thu, 8 Jun 2023 13:12:01 +0000 (15:12 +0200)]
Remove ObjectMapper from OpenApiServiceImplTest

There is no need to simulate JSON serialization. We can just
assert that fields have desired values.

Change-Id: I40109512feff449c1c9b64e7e9e9ec6ddad830cc
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoAdd odl-netconf-transport 72/105772/8
Robert Varga [Tue, 2 May 2023 11:06:17 +0000 (13:06 +0200)]
Add odl-netconf-transport

Package the rest of the transport-level features, so that individual
users may depend on this feature to provide all the transports
available.

JIRA: NETCONF-590
Change-Id: Ie3091c2ba29df287a7b374768e25ef100ff54e67
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
17 months agoBump upstreams 35/106435/1
Robert Varga [Thu, 8 Jun 2023 18:07:53 +0000 (20:07 +0200)]
Bump upstreams

Adopt:
- yangtools-10.0.8
- mdsal-11.0.11
- controller-7.0.8
- aaa-0.17.10

Change-Id: I806bd7edfc2e0d80d6d0f0a4685abb4283562880
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoRemove redundant local variable 26/106426/1
Ivan Hrasko [Thu, 8 Jun 2023 11:51:29 +0000 (13:51 +0200)]
Remove redundant local variable

Local variable openApiObject is redundant we can directly return
from method.

Change-Id: I3497f4461d0b75498aeb5bdb8721e52fc9758687
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoIntroduce Operation object 90/106390/7
OleksandrZharov [Tue, 6 Jun 2023 11:02:50 +0000 (13:02 +0200)]
Introduce Operation object

Created model for Operations.
All affected logic was adapted to use this model instead of JsonNode.

JIRA: NETCONF-1050
Change-Id: If4c06fd66c4c4487978541aaf372dbc6a20158d9
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoRemove redundant local variable 97/106397/1
Ivan Hrasko [Wed, 7 Jun 2023 10:49:23 +0000 (12:49 +0200)]
Remove redundant local variable

Local variable doc is redundant we can directly return from method.

Change-Id: Idaac58e387bcceb85bffec5eefb5d2e2e35c4bb5
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoSet SECURITY into OpenApiObject.Builder 95/106395/2
Ivan Hrasko [Wed, 7 Jun 2023 10:46:24 +0000 (12:46 +0200)]
Set SECURITY into OpenApiObject.Builder

We have lost SECURITY in the previous commit. Fix it.

JIRA: NETCONF-1041
Change-Id: I8d3b06515426f6fba71bad33f8da5224c84e8b7d
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoTransform domain classes to Java records 71/106171/11
Yaroslav Lastivka [Fri, 26 May 2023 11:34:49 +0000 (14:34 +0300)]
Transform domain classes to Java records

All domain Java classes in org.opendaylight.restconf.openapi.model
have been converted into Java records and builders have been created
in case we need to mutate them.

JIRA: NETCONF-1041
Change-Id: Ifd0cdeb07e60210af6247548694a7f415df122a1
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoImprove examples in developer guide 40/106340/2
OleksandrZharov [Thu, 1 Jun 2023 09:35:53 +0000 (11:35 +0200)]
Improve examples in developer guide

Replaced Optional#get with better Optional#orElseThrow in
examples for developer-guide.rst.

JIRA: NETCONF-1045
Change-Id: I5a94d3252e26f8e4907b828f026b4426531cd511
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
17 months agoMigrate callers of Optional#get 38/106338/2
OleksandrZharov [Thu, 1 Jun 2023 09:22:55 +0000 (11:22 +0200)]
Migrate callers of Optional#get

Replaced Optional#get with better Optional#orElseThrow.

JIRA: NETCONF-1045
Change-Id: Ib940e923d040b2d960a594b1c84f0e7403b602df
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
17 months agoMove select definition to new line 50/106150/9
OleksandrZharov [Wed, 24 May 2023 20:51:44 +0000 (22:51 +0200)]
Move select definition to new line

If the pixel width of the screen is lower than 1200px,
move the 'Select a definition' dropdown in Swagger UI to a new line.

JIRA: NETCONF-1033
Change-Id: I7aa69bd6e00c1a7913f262d87928cbb699a3dad8
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
17 months agoUse java.util.function.Predicate 89/106389/1
Ivan Hrasko [Tue, 6 Jun 2023 08:41:02 +0000 (10:41 +0200)]
Use java.util.function.Predicate

Use java.util.function.Predicate instead of Guava's Predicate
in YangLibProvider.java.

Change-Id: I25144169355c3d3160ea04c0d4de4fa68c89e962
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoRefactor schema retrieval exception messages 01/106301/5
Šimon Ukuš [Wed, 31 May 2023 09:06:08 +0000 (11:06 +0200)]
Refactor schema retrieval exception messages

Improve excpetion messages for better clarity.

JIRA: NETCONF-964
Change-Id: Ia9e1e39a727980c2b1fe36897c3e523e7a87f830
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
17 months agoThrow NotFoundException on MissingSchemaSource 00/106300/7
Šimon Ukuš [Wed, 31 May 2023 08:48:03 +0000 (10:48 +0200)]
Throw NotFoundException on MissingSchemaSource

Throwing NotFoundException, instead of a more general
WebApplicationException, will return 404 status code to the client,
rather than 500 with the WebAppException.

JIRA: NETCONF-964
Change-Id: Ic72b068a477a98f618bf303c43d7deca94254f3e
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
17 months agoRefactor exception handling 67/105867/8
Šimon Ukuš [Tue, 9 May 2023 13:14:16 +0000 (15:14 +0200)]
Refactor exception handling

Replace IllegalStateException with WebApplicationException when
the process of retrieving yang model fails.

This change has no impact on the status code being sent back
to the user, but changes the status reason phrase from
"Request failed" to "Internal Server Error".

JIRA: NETCONF-964
Change-Id: I7934141c481ddb01dab410d4d04d4b23555212ab
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
17 months agoMake Select definition larger 30/106130/3
OleksandrZharov [Tue, 23 May 2023 11:29:28 +0000 (13:29 +0200)]
Make Select definition larger

Made "Select a definition" drop down list larger.
Now we are able to actually see what is currently
selected there.

JIRA: NETCONF-1033
Change-Id: Ie3b5e9de25dc44e1da5c7eb94f49da45ecc353d6
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
17 months agoRemove _XML and _POST containers from OpenApi 42/105042/20
Peter Suna [Mon, 27 Mar 2023 11:38:29 +0000 (13:38 +0200)]
Remove _XML and _POST containers from OpenApi

There is no need to create containers for XML since OpenAPI
can convert the provided data to XML format. Additionally,
containers with the "_POST" extension are identical to those
without it, so creating them only consumes memory
resources unnecessarily.

JIRA: NETCONF-938
Change-Id: I14ac602df087c5115d78daa1425841fd5a54e577
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
17 months agoClean-up OpenApiGeneratorRFC8040Test 61/106361/2
Ivan Hrasko [Fri, 2 Jun 2023 11:33:12 +0000 (13:33 +0200)]
Clean-up OpenApiGeneratorRFC8040Test

Remove one-time constants. Use them directly at the place.

Change-Id: I2a6a2fe9b1110ea08a4d8302f92cd287b094999b
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoPrepare tests for OpenApi generated Objects 89/105089/24
Peter Suna [Tue, 28 Mar 2023 12:22:03 +0000 (14:22 +0200)]
Prepare tests for OpenApi generated Objects

Create a test to validate the created operations and
the containers reference related to them.

Verify the created containers and the amount of containers.

JIRA: NETCONF-938
Change-Id: I26d5a57152c151c13d0404babc1edee1c7383f4a
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoRemove refresh test from MountPointEndToEndTest 53/106353/3
Peter Suna [Thu, 1 Jun 2023 15:42:46 +0000 (17:42 +0200)]
Remove refresh test from MountPointEndToEndTest

Remove test to show that refresh is not working properly
in current implementation.

JIRA: NETCONF-1046
Change-Id: I4afc50ac1f2b1cbad62726752a3164e48ef6e010
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoBump upstreams 47/106347/1
Robert Varga [Thu, 1 Jun 2023 12:17:46 +0000 (14:17 +0200)]
Bump upstreams

Adopt:
- odlparent-12.0.6
- infrautils-5.0.5
- yangtools-10.0.7
- mdsal-11.0.10
- controller-7.0.7
- aaa-0.17.9

Change-Id: I3d44fcb19eafb8a9fcb2c82db394864bb03c622b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoRework unit test infrastructure 58/106258/3
OleksandrZharov [Tue, 30 May 2023 09:15:11 +0000 (11:15 +0200)]
Rework unit test infrastructure

Changed AbstractOpenApiTest class into util class named
OpenApiTestUtils.

Copied contents of BeforeClass to each affected test.
This allow us configure resources for each test more freely.

JIRA: NETCONF-1040
Change-Id: I80392d46495b443a56ac568755716511c7e97298
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoBump conf.yaml versions to Potassium 46/106146/3
Ivan Hrasko [Wed, 24 May 2023 13:21:52 +0000 (15:21 +0200)]
Bump conf.yaml versions to Potassium

Change NetConf configuration to Potassium in order to see
correct version at:
https://docs.opendaylight.org/projects/netconf/en/latest/.

JIRA: NETCONF-1038
Change-Id: I37df01503fd2886a26e460f7bb202165499d52d9
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoOpenAPI: Change openapi URLs 49/106149/3
Yaroslav Lastivka [Wed, 24 May 2023 14:19:50 +0000 (17:19 +0300)]
OpenAPI: Change openapi URLs

The URL structure for accessing the OpenAPI documentation and
API endpoints did not align with the name of module and feature.

URL contextPath "apidoc" was changed to "openapi".

JIRA: NETCONF-1032
Change-Id: Ifa09544f53963065a974466e8a7f4eb3262326f0
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoSecure all apidoc paths 18/106218/1
Ivan Hrasko [Mon, 29 May 2023 07:44:53 +0000 (09:44 +0200)]
Secure all apidoc paths

Make sure we secure all paths under apidoc.

JIRA: NETCONF-1032
Change-Id: Ia8f14a3c9a9f387500d732467f9905ea9d40e635
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoAdd JsonProperty for Schema's reference 55/106155/2
Ivan Hrasko [Thu, 25 May 2023 14:36:16 +0000 (16:36 +0200)]
Add JsonProperty for Schema's reference

We have to add JsonProperty to Schema's ref object to have it in
correct format "$ref". Otherwise we get swagger validation errors.

JIRA: NETCONF-1024
Change-Id: If5fb1372a804588ec4ea424b726eb97073c7b012
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoRemove RemoteDeviceConnector class 77/104177/30
OleksandrZharov [Thu, 26 Jan 2023 16:03:57 +0000 (17:03 +0100)]
Remove RemoteDeviceConnector class

Removed duplicate code with AbstractNetconfTopology.

Reworked NetconfTopologyContext to use NetconfTopologySingletonImpl
extending AbstractNetconfTopology instead of using
RemoteDeviceConnector.

JIRA: NETCONF-1039
Change-Id: Ic445a9a84becf9607b512a749e167a18f5929084
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
17 months agoMissed required parameters in swagger schema 41/106141/4
Yaroslav Lastivka [Mon, 22 May 2023 16:07:11 +0000 (19:07 +0300)]
Missed required parameters in swagger schema

Logic of BaseYangOpenApiGenerator#addPaths creates
an invalid schema for models which contain lists with nested containers.

We have to clear parameters array as final step of every recursion
and add parameters from parent recursion.

JIRA: NETCONF-1022
Change-Id: If5046817c62ad7d0a71fff6980342467061b0b37
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
17 months agoFix invalid swagger schema 98/105698/17
Yaroslav Lastivka [Wed, 26 Apr 2023 07:49:27 +0000 (10:49 +0300)]
Fix invalid swagger schema

We put nodes to parameters which do not belong to a particular request.
This logic produces invalid schemas.

We have to clear parameters array as final step of every recursion.

JIRA: NETCONF-996
Change-Id: I440689575b790009680b41211c94ad7668ce0b93
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoSimplify adding config/non-config paths 60/105860/5
Ivan Hrasko [Tue, 9 May 2023 09:10:55 +0000 (11:10 +0200)]
Simplify adding config/non-config paths

Simplify the process of adding config and non-config paths
by reusing the same blocks of code.

This can be done when we remove if condition
and use node.isConfiguration() directly as method parameter.

JIRA: NETCONF-1037
Change-Id: I36e1ae3f484a940bf6114d99bd7227c553fadf65
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
17 months agoFix retrieving operations resource 69/103969/36
Yaroslav Lastivka [Tue, 10 Jan 2023 09:39:21 +0000 (11:39 +0200)]
Fix retrieving operations resource

Fix retrieving operations resource from controller and mount points
by adapting getOperationsJSON/XML to accept identifiers and enhancing
its functionality with ability to match exact operation.

This way we enhance solution proposed by NETCONF-822 to cover
all use cases and avoid error 500.

JIRA: NETCONF-928
JIRA: NETCONF-929
Change-Id: Ic8f0ca5b07e060d36747a110f9049d3d9a2b96c8
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
17 months agoFix netconf README 21/106121/4
OleksandrZharov [Mon, 22 May 2023 13:56:55 +0000 (15:56 +0200)]
Fix netconf README

Fixed links and typos in netconf README.

JIRA: NETCONF-1035
Change-Id: I3de42dbcad4c0f73b7ded895e0d650e6fef5f6c0
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoAdd unit test for request parameters 96/105896/18
OleksandrZharov [Fri, 12 May 2023 09:21:41 +0000 (11:21 +0200)]
Add unit test for request parameters

Added unit test that checks for correct amount of parameters in
requests.

JIRA: NETCONF-1023
Change-Id: I9a448173c5d066ff019cf6b3d07b720d75a73e40
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoUpdate ParameterAwareNormalizedNodeWriter 99/106099/7
Robert Varga [Sun, 21 May 2023 13:05:36 +0000 (15:05 +0200)]
Update ParameterAwareNormalizedNodeWriter

Three distinct changes are being made here:

- use instanceof patterns to remove explicit casts
- reduce instanceof() checks by taking into account ordering
- eliminate childSizeHint() and use directly-exposed size()

Change-Id: If0ffaf9c34575ed4d7fef3a5a7c0dc13ce6ba687
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoDo not use mocks in NodeWriterFields tests 11/106111/6
Robert Varga [Mon, 22 May 2023 06:49:07 +0000 (08:49 +0200)]
Do not use mocks in NodeWriterFields tests

Use Builders to create fully functional test objects instead of mocking
internals.

Change-Id: I7c287e174f5afbbc7395514bf146f33edcd1b0ea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoGet rid of JsonUtil#copy 73/105873/8
Ivan Hrasko [Wed, 10 May 2023 10:35:30 +0000 (12:35 +0200)]
Get rid of JsonUtil#copy

We can use ArrayNode#addAll method instead of JsonUtil#copy.

This means we no more need JsonUtil class.

JIRA: NETCONF-1023
Change-Id: Ia6bbca83c4e5f0b11740d8dff627f41135b29077
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
17 months agoBump SSHD to 2.10.0 49/105949/4
Robert Varga [Mon, 15 May 2023 11:13:51 +0000 (13:13 +0200)]
Bump SSHD to 2.10.0

https://github.com/apache/mina-sshd/blob/master/docs/changes/2.10.0.md

Change-Id: I173b317909ece001843cab8cce269cc02f758a5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoRemove NetconfUtil.newWriter() 36/105736/3
Robert Varga [Fri, 28 Apr 2023 13:35:46 +0000 (15:35 +0200)]
Remove NetconfUtil.newWriter()

This is a internal utility method which is no longer needed, as YANG
tools correctly handles null path.

Change-Id: Id7e7754f33fe76eb2a68eb0a78cbe54b67594f6d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoRework README to markdown 67/106067/3
OleksandrZharov [Fri, 19 May 2023 16:12:09 +0000 (18:12 +0200)]
Rework README to markdown

.rst files are not parsed by GitHub thus for correct display
of our README we should translate it into .md format.

JIRA: NETCONF-1035
Change-Id: I0416dbd4ca22bd66a490a486c48f223cfe499a91
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
17 months agoAdd odl-yanglib into experimental features 97/105897/8
Šimon Ukuš [Fri, 12 May 2023 09:37:30 +0000 (11:37 +0200)]
Add odl-yanglib into experimental features

During reorganizing of netconf features we have lost odl-yanglib
feature.

Create features-netconf-experimental which installs odl-yanglib.

JIRA: NETCONF-1028
Change-Id: I8f9ecb9d498d04d7edbb2d8c75ddebbcbf6ab371
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoRemove "Generex" dependency 73/104973/26
Yaroslav Lastivka [Tue, 21 Mar 2023 12:39:19 +0000 (14:39 +0200)]
Remove "Generex" dependency

Removed "Generex" and replaced with direct usage of "Automaton"
to generate random strings as "Genegex" seems to be no longer
actively developed project.

In fact the previous logic to generate example strings was broken.
We have fixed it by using RegularExpressionString instead of
JavaPatternString.

Now we have the same examples generated every run which helps us
to write better tests with assertions.

JIRA: NETCONF-980
Change-Id: I52e6d9d1a0f0cf43eb17b99309d9101c32d75a42
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoRename restconf bundles 30/106030/2
Ivan Hrasko [Thu, 18 May 2023 10:41:28 +0000 (12:41 +0200)]
Rename restconf bundles

Rename restconf bundles to get rid of MD SAL mention and reflect
actual state of codebase (Rest Api Doc -> openapi).

JIRA: NETCONF-1034
Change-Id: If8a150f9f67f94b3b6641f9c651904e5b8f9c84a
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoOpenAPI: Eliminate JsonUtil#addFields method 21/106021/3
OleksandrZharov [Tue, 16 May 2023 10:30:38 +0000 (12:30 +0200)]
OpenAPI: Eliminate JsonUtil#addFields method

JsonUtil#addFields method is no more used.
addFields method was removed.

JIRA: NETCONF-1025
Change-Id: Ia95cb0aaa9273f6735f59f000005f5b4fd789b69
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoRename convertToJsonSchema method 32/106032/6
Ivan Hrasko [Thu, 18 May 2023 13:13:27 +0000 (15:13 +0200)]
Rename convertToJsonSchema method

We are no more returning JSON ObjectNode but Map of Schema.
Rename method accordingly.

JIRA: NETCONF-1024
Change-Id: Ib1d03f2be463c754a0eda2564b50162a9eb9ab45
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoUse Java Schema object instead of JsonNode 89/105989/12
OleksandrZharov [Tue, 16 May 2023 10:30:38 +0000 (12:30 +0200)]
Use Java Schema object instead of JsonNode

Created Schema.java object and replaced ObjectNode schemas inside
Components class with Map<String, Schema>. This allowed us remove
JsonUtil#addFields method which is addressed by another issue.

JIRA: NETCONF-1024
Change-Id: I13477fae13298b782df4af6e100fe9f807b331bd
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoRemove unused "resourcePath" parameter 34/106034/2
Ivan Hrasko [Thu, 18 May 2023 13:21:52 +0000 (15:21 +0200)]
Remove unused "resourcePath" parameter

This parameter is not used. Remove it.

Change-Id: I4fa8799b98a8ba1c7906a24fb8c098d06511baf6
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoRename odl-mdsal-apidocs feature to odl-restconf-openapi 90/105990/3
Yaroslav Lastivka [Tue, 16 May 2023 13:35:57 +0000 (16:35 +0300)]
Rename odl-mdsal-apidocs feature to odl-restconf-openapi

Accordingly to renaming implementation of OpenApi to restconf-openapi,
odl-mdsal-apidocs was renamed to odl-restconf-openapi.

JIRA: NETCONF-1029
Change-Id: If6bf59644b5e4334513b8ad6f28deffbbf351776
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
17 months agoOpenAPI: Avoid null values in JSON 18/105918/6
Yaroslav Lastivka [Fri, 12 May 2023 08:54:49 +0000 (11:54 +0300)]
OpenAPI: Avoid null values in JSON

The resulted JSON from Restconf openapi endpoints
contain null values for unset fields.

Jackson annotations were aded to ignore null fields.

JIRA: NETCONF-1027
Change-Id: Ia56790b951ba8db649c0bcb0ce688071de70fac7
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoMove openapi test utilities 10/106010/1
Ivan Hrasko [Wed, 17 May 2023 10:35:21 +0000 (12:35 +0200)]
Move openapi test utilities

AbstractOpenApiTest and DocGenTestHelper are meant to be
in org.opendaylight.restconf.openapi package.

We have accidentally changed their position. Fix it now accordingly.

JIRA: NETCONF-1011
Change-Id: I2c1ed7282642e430af24fa1a57345f6bc31dd734
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoRefactor org.opendaylight.netconf.sal.rest.doc.util 70/105870/8
OleksandrZharov [Tue, 9 May 2023 13:34:35 +0000 (15:34 +0200)]
Refactor org.opendaylight.netconf.sal.rest.doc.util

Renamed package org.opendaylight.netconf.sal.rest.doc.util to
org.opendaylight.restconf.openapi.util.

JIRA: NETCONF-1011
Change-Id: Ia75829170a18bb0eda0e42bc28779dd96fb7eb17
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoRefactor org.opendaylight.netconf.sal.rest.doc.openapi 69/105869/5
OleksandrZharov [Tue, 9 May 2023 13:18:47 +0000 (15:18 +0200)]
Refactor org.opendaylight.netconf.sal.rest.doc.openapi

Renamed package org.opendaylight.netconf.sal.rest.doc.openapi to
org.opendaylight.restconf.openapi.model.

Renamed openapi package to model because openapi is now a module
name and we are expressing that we are storing here Java classes
that are used to model OpenAPi objects.

JIRA: NETCONF-1011
Change-Id: I1324f1858ee424b354e5f04b758edb19c801b74a
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
17 months agoRefactor org.opendaylight.netconf.sal.rest.doc.mountpoints 66/105866/6
OleksandrZharov [Tue, 9 May 2023 12:30:32 +0000 (14:30 +0200)]
Refactor org.opendaylight.netconf.sal.rest.doc.mountpoints

Renamed package org.opendaylight.netconf.sal.rest.doc.mountpoints to
org.opendaylight.restconf.openapi.mountpoints.

JIRA: NETCONF-1011
Change-Id: I4f359419c7297eb2e7f561a3266e043699b1db68
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoRefactor org.opendaylight.netconf.sal.rest.doc.model.builder 65/105865/5
OleksandrZharov [Tue, 9 May 2023 12:25:06 +0000 (14:25 +0200)]
Refactor org.opendaylight.netconf.sal.rest.doc.model.builder

Renamed package org.opendaylight.netconf.sal.rest.doc.model.builder to
org.opendaylight.restconf.openapi.model.builder.

JIRA: NETCONF-1011
Change-Id: I97075d87129996114e75cf7c150ff5e854e00cb9
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
17 months agoRefactor org.opendaylight.netconf.sal.rest.doc.jaxrs 64/105864/6
OleksandrZharov [Tue, 9 May 2023 10:42:24 +0000 (12:42 +0200)]
Refactor org.opendaylight.netconf.sal.rest.doc.jaxrs

Renamed package org.opendaylight.netconf.sal.rest.doc.jaxrs to
org.opendaylight.restconf.openapi.jaxrs.

JIRA: NETCONF-1011
Change-Id: I0e70e36a0bdacb7efeb8458ae3172767260f190e
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoRefactor org.opendaylight.netconf.sal.rest.doc.impl 63/105863/6
OleksandrZharov [Tue, 9 May 2023 10:59:13 +0000 (12:59 +0200)]
Refactor org.opendaylight.netconf.sal.rest.doc.impl

Renamed package org.opendaylight.netconf.sal.rest.doc.impl to
org.opendaylight.restconf.openapi.impl.

JIRA: NETCONF-1011
Change-Id: I0f0fef987a5150903e1cee3f508960e89f7ef120
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoRefactor org.opendaylight.netconf.sal.rest.doc.api 62/105862/8
OleksandrZharov [Tue, 9 May 2023 10:42:24 +0000 (12:42 +0200)]
Refactor org.opendaylight.netconf.sal.rest.doc.api

Renamed package org.opendaylight.netconf.sal.rest.doc.api to
org.opendaylight.restconf.openapi.api.

JIRA: NETCONF-1011
Change-Id: I681caea35a57e02f445713adf27084fb0c142305
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
17 months agoChange artifactId in sal-rest-docgen 61/105861/6
OleksandrZharov [Tue, 9 May 2023 10:24:36 +0000 (12:24 +0200)]
Change artifactId in sal-rest-docgen

Changed artifactId in sal-rest-docgen pom.xml to be restconf-openapi
and renamed folder accordingly.

JIRA: NETCONF-1011
Change-Id: I7c628396319da6cc2fb4ae5e93c827b39608c39a
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
17 months agoRename *ApiDoc* classess to *OpenApi* classes 30/105830/8
OleksandrZharov [Thu, 4 May 2023 17:26:21 +0000 (19:26 +0200)]
Rename *ApiDoc* classess to *OpenApi* classes

Rename all classes and methods in sal-rest-docgen which have
*ApiDoc* in their name to *OpenApi* instead.

JIRA: NETCONF-1012
Change-Id: I46779d465885d6e8411f8405d10fbf3505efbfde
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
18 months agoDo not create OpenApiObject twice 21/105821/10
Peter Suna [Wed, 3 May 2023 14:29:30 +0000 (16:29 +0200)]
Do not create OpenApiObject twice

Refactor the getMountPointApi method to prevent the creation
of two OpenApiObject instances. Currently,
this duplication occurs because the method is responsible for both
creating the required paths and generating the OpenApiObject.

To improve the code, separate these two functions and use only
the method that creates the data-store paths. This change will make
the code cleaner and more efficient, and help to avoid any potential
issues caused by duplicate objects.

JIRA: NETCONF-1007
Change-Id: I5ff38b706ce34c270f43fd4cf00a98efcbdaf888
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
18 months agoImprove MountPointOpenApiTest 26/105726/19
OleksandrZharov [Thu, 23 Mar 2023 12:45:50 +0000 (13:45 +0100)]
Improve MountPointOpenApiTest

In previous patch there was case when despite successful build
swagger failed to load device. Improved corresponding unit test
to cover blindspot in tests.

JIRA: NETCONF-997
Change-Id: Ie38319f83ac83c1e9ac1dd64a557b129941a4e23
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
18 months agoUse Java Path object instead of JsonNode 62/105462/18
OleksandrZharov [Thu, 23 Mar 2023 12:45:50 +0000 (13:45 +0100)]
Use Java Path object instead of JsonNode

Path object is well described in OpenApi specification.
Thus we can model it using Java.

JIRA: NETCONF-997
Change-Id: Idc6c40a386fdd4124aa79d1f0e8b316d2a247304
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
18 months agoClean-up sal-rest-docgen test classes 27/105827/9
OleksandrZharov [Thu, 4 May 2023 16:10:48 +0000 (18:10 +0200)]
Clean-up sal-rest-docgen test classes

Moved test classes to according packages so now they have same name
as tested classes.

JIRA: NETCONF-1013
Change-Id: I50571453da52bff901801a454709171d8b9f0c7c
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
18 months agoRename SwaggerObjectTest 59/105859/3
OleksandrZharov [Tue, 9 May 2023 09:07:52 +0000 (11:07 +0200)]
Rename SwaggerObjectTest

For some reason we missed out on renaming SwaggerObjectTest
during NETCONF-984. Renamed this class here.

JIRA: NETCONF-984
Change-Id: I82ab9ff279b3ec8864c91feab8be383182cb0c81
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
18 months agoOpenAPI: Add possibility to change base path 68/105868/2
Ivan Hrasko [Tue, 9 May 2023 13:24:02 +0000 (15:24 +0200)]
OpenAPI: Add possibility to change base path

Create new constructor that enables users to configure
OpenAPI base path.

JIRA: NETCONF-1020
Change-Id: I5507a46cca9da24d274d40b6f679da532bbf4a5c
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
18 months agoAdd netconf.api.NamespaceURN 50/105850/1
Robert Varga [Sat, 6 May 2023 10:44:17 +0000 (12:44 +0200)]
Add netconf.api.NamespaceURN

XmlNetconfConstants is a huge constant holder, with very baroque names
for namespaces. Split out NamespaceURN, which holds these namespaces in
the same way CapabilityURN holds capability namespaces.

JIRA: NETCONF-1019
Change-Id: Iae8cd44438fac353877e282a0de451b095dd35e1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoAdd netconf.api.CapabilityURN 48/105848/7
Robert Varga [Fri, 5 May 2023 21:18:56 +0000 (23:18 +0200)]
Add netconf.api.CapabilityURN

We have NETCONF capability strings strewn all over the codebase, in
various forms and at various layers. Centralize the definitions based
on the current contents of the IANA registry (plus the EXI part, which
is just proposed).

Centralize the use of the constants, eliminating a number of
XmlNetconfConstants, i.e. disconnecting code from the XML encoding to a
certain extent.

JIRA: NETCONF-1017
Change-Id: Id03708c24d48fd65547f294827d8c15d9d7dd6e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoFix notification namespace reference 49/105849/4
Robert Varga [Fri, 5 May 2023 23:04:19 +0000 (01:04 +0200)]
Fix notification namespace reference

The code is getting confused here -- it is using the capability URN
instead of namespace URN. Introduce constant to fix that up.

This also fixes the obviously wrong test cases introduced as part of
Ieae248057d890071c6ac5b05b22f1a05a0a98b0c.

JIRA: NETCONF-1018
Change-Id: I4976c24c2e16f11823a64a0ca152ca144d3557a0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoMove netconf.api.capability to netconf.server.api.monitoring 47/105847/3
Robert Varga [Fri, 5 May 2023 20:38:15 +0000 (22:38 +0200)]
Move netconf.api.capability to netconf.server.api.monitoring

Having capabilities in the baseline package is confusing, as they are
only used on the server side. While performing the move, refactor
YangModuleCapability to not require yang-model-api and adjust callers
accordingly.

This allows us to remove odl-yangtools-parser-api from
odl-netconf-api's dependencies, restoring dependency sanity.

JIRA: NETCONF-1016
Change-Id: I081e4b7ffad3e5863863e9353969634a42dc133f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoClean up netconf-client-mdsal dependencies 45/105845/1
Robert Varga [Thu, 4 May 2023 22:23:11 +0000 (00:23 +0200)]
Clean up netconf-client-mdsal dependencies

Fix warnings reported by declaring all used dependencies.

Change-Id: I46fe2fc676b066148dc2cc0ba6e73b6286bcb38c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRename netconf.sal.connect.netconf.sal 44/105844/1
Robert Varga [Thu, 4 May 2023 21:36:31 +0000 (23:36 +0200)]
Rename netconf.sal.connect.netconf.sal

Use netconf.client.mdsal.spi as a stop-gap until we figure out where to
move things around -- which will require a completely separate pass over
the integrations.

JIRA: NETCONF-1006
Change-Id: I8447f8b8e83d8cc9934c6b46774554a39caaf97c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoClean up use of constants 43/105843/2
Robert Varga [Thu, 4 May 2023 21:24:02 +0000 (23:24 +0200)]
Clean up use of constants

We have the names in XmlNetconfContants, use them from there.

JIRA: NETCONF-1006
Change-Id: Ib826f3ef4fdd32d5bb066fcd5c3e8451351c23e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoEliminate netconf.sal.connect.netconf.listener 42/105842/1
Robert Varga [Thu, 4 May 2023 21:18:48 +0000 (23:18 +0200)]
Eliminate netconf.sal.connect.netconf.listener

Integrate this package in netconf.client.mdsal, reducing package
tangles.

JIRA: NETCONF-1006
Change-Id: I12cbafd1bf441d571623c65599023407c5ec72c0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoEliminate NetconfMessageTransformUtil.MESSAGE_ID_ATTR 41/105841/2
Robert Varga [Thu, 4 May 2023 21:14:46 +0000 (23:14 +0200)]
Eliminate NetconfMessageTransformUtil.MESSAGE_ID_ATTR

We have this constant defined in XmlNetconfConstants, eliminate it.

JIRA: NETCONF-1006
Change-Id: I3212f3c7cdf9d12e44bbc2471c0e309c88573f4b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoEliminate NetconfMessageTransformUtil.checkValidReply() 40/105840/2
Robert Varga [Thu, 4 May 2023 21:02:42 +0000 (23:02 +0200)]
Eliminate NetconfMessageTransformUtil.checkValidReply()

This is method is used only by a single caller -- inline it, eliminating
a try/catch block and reducing verbosity.

JIRA: NETCONF-1006
Change-Id: Ie2193156c1d1ab65b577ac261fc401ed52256d17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoEliminate NetconfMessageTransformUtil.checkSuccessReply() 38/105838/2
Robert Varga [Thu, 4 May 2023 20:53:43 +0000 (22:53 +0200)]
Eliminate NetconfMessageTransformUtil.checkSuccessReply()

We have a single caller, who is actually decoding the exception, without
having to remap it. Inline the logic and ditch use of
NetconfDocumentedException, which is a useless wrapper.

JIRA: NETCONF-1006
Change-Id: I600230adbadfa6fbb7d7df8503e47b387147607c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoDo not use FluentFutures needlessly 39/105839/1
Robert Varga [Thu, 4 May 2023 20:55:43 +0000 (22:55 +0200)]
Do not use FluentFutures needlessly

Use Futures, as we only return a ListenableFuture, cutting the
dependencies a bit.

JIRA: NETCONF-1006
Change-Id: I2b6a3be9335a7d8a0fec2a25b8d36bb0737e4c3a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoMove toRpcError/toRpcResult() 37/105837/1
Robert Varga [Thu, 4 May 2023 20:45:40 +0000 (22:45 +0200)]
Move toRpcError/toRpcResult()

These two methods are only used in NetconfDeviceCommunicator, move then
there to reduce the tangle that is NetconfMessageTransformUtil.

JIRA: NETCONF-1006
Change-Id: Idd484ae56e18ebf0255e2a942a5846a49c34f63c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoMove NetconfDeviceCapabilities 36/105836/1
Robert Varga [Thu, 4 May 2023 20:35:11 +0000 (22:35 +0200)]
Move NetconfDeviceCapabilities

This is an immutable DTO referenced by
netconf.client.mdsal.NetconfDevice -- co-locate the two for better
ergonomics.

JIRA: NETCONF-1006
Change-Id: I50926c8a0857b19b22b6a51d22c0739bc0e48925
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoMove NetconfSessionPreferences 35/105835/2
Robert Varga [Thu, 4 May 2023 20:29:53 +0000 (22:29 +0200)]
Move NetconfSessionPreferences

This is a well-known API contract, which is actually an immutable DTO.
Move it to netconf.client.mdsal.api, so it can be readily found.

JIRA: NETCONF-1006
Change-Id: Ia588cfb3479f6631be913c0791017100457cf0be
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRemove sal.connect.netconf.util 34/105834/1
Robert Varga [Thu, 4 May 2023 20:12:52 +0000 (22:12 +0200)]
Remove sal.connect.netconf.util

All these classes are an implementation-internal thing, move them away
from util package, so they are not directly reachable.

JIRA: NETCONF-1006
Change-Id: Ib50cecd6d247b91e3404b29f5fbe0a6c76f25f8a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRemove netconf.sal.connect.util 33/105833/2
Robert Varga [Thu, 4 May 2023 20:06:04 +0000 (22:06 +0200)]
Remove netconf.sal.connect.util

Move MessageCounter into client.mdsal.impl, where it is properly hidden
at least in OSGi and clean it up.

JIRA: NETCONF-1006
Change-Id: I48e8e1fe78b4ff46a8ee88111435d546e3c84575
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoHide SslHandlerFactorImpl 32/105832/1
Robert Varga [Thu, 4 May 2023 19:18:16 +0000 (21:18 +0200)]
Hide SslHandlerFactorImpl

We go through quite some hoops only to instantiate a SslHandlerFactory.
Rather that exposing the implementation directly, hide it behind a
specific interface, which allows us to optimize the dispatch and share
the actual factory instances.

JIRA: NETCONF-1006
Change-Id: I111e3af5d96f238899e0618cfbf4017b2f8554b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoSplit up NetconfKeystoreAdapter 29/105829/2
Robert Varga [Thu, 4 May 2023 16:42:46 +0000 (18:42 +0200)]
Split up NetconfKeystoreAdapter

We have conflated interfaces for constructing KeyStores and looking up
KeyCredential objects. Split these two up, so they can be evolved
separately. This turns CredentialProvider into a very simple class.

JIRA: NETCONF-1006
Change-Id: I600ce21ccceb46ec3e2d5e3b1ccf7fd5022fd2f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoOptimize DefaultNetconfKeystoreAdapter 28/105828/2
Robert Varga [Thu, 4 May 2023 14:11:46 +0000 (16:11 +0200)]
Optimize DefaultNetconfKeystoreAdapter

Use an intermediate utility class to hold our interactions with
java.security. This allows us to cache factories for reuse if we hit
them multiple times.

Also clean up use of intermediate collections, so that the code is quite
straightforward.

JIRA: NETCONF-1010
Change-Id: Ibee1399333b90bf55c390a1b36ebc944068de711
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoSslHandlerFactory.createSslHandler() is a default method 31/105831/1
Robert Varga [Thu, 4 May 2023 18:48:09 +0000 (20:48 +0200)]
SslHandlerFactory.createSslHandler() is a default method

Provide a simple common implementantion, as that is what we end up doing
anyway.

Change-Id: I24c7b29d68402b60daa0d4569d210ed3491bbc21
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRemove locking from DefaultNetconfKeystoreAdapter 24/105824/5
Robert Varga [Wed, 3 May 2023 20:24:13 +0000 (22:24 +0200)]
Remove locking from DefaultNetconfKeystoreAdapter

Encapsulate state into State and perform atomic updates when the
datastore contents changes. Also mark more bits and pieces for
improvement.

JIRA: NETCONF-1010
Change-Id: I98d8b1a10ccbd2c4ced7e7d1a8c9d8381b5bb258
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRefactor NetconfKeystoreAdapter 19/105819/7
Robert Varga [Wed, 3 May 2023 17:37:15 +0000 (19:37 +0200)]
Refactor NetconfKeystoreAdapter

NetconfKeystoreAdapter is being instantiated all over the place, whereas
this really should be a singleton service. Factor out the common API and
provide it as an on-demand service, which is injected into all users.

JIRA: NETCONF-1006
Change-Id: Ib532c130d26fcc68796d401239da7b8e57b39382
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoEliminate convertToServers method 26/105826/3
OleksandrZharov [Thu, 4 May 2023 12:30:10 +0000 (14:30 +0200)]
Eliminate convertToServers method

Removed BaseYangOpenApiGenerator#convertToServers because
is used only once and what is does is useless.

JIRA: NETCONF-1009
Change-Id: Iba105501f42aa0d7642e4d3ffd71d912ff8d9c12
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
18 months agoGet rid of ImmutableList.of in sal-rest-docgen 25/105825/2
OleksandrZharov [Thu, 4 May 2023 10:04:31 +0000 (12:04 +0200)]
Get rid of ImmutableList.of in sal-rest-docgen

Replaced guava’s ImmutableList.of with java’s List.of
in sal-rest-docgen package.

JIRA: NETCONF-1008
Change-Id: Iefa7a20432fbbabda8d67e2166f658bacfe75eb8
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
18 months agoAdd missing slf4j-api dependency to testtool 23/105823/2
Peter Suna [Thu, 4 May 2023 08:23:37 +0000 (10:23 +0200)]
Add missing slf4j-api dependency to testtool

This depenency was removed and causing:
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

Change-Id: Ie20b156d484055a8f0325f9047c284defbf95a32
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
18 months agoRemove privateKey{Path,Passphrase} fields 20/105820/1
Robert Varga [Wed, 3 May 2023 18:00:40 +0000 (20:00 +0200)]
Remove privateKey{Path,Passphrase} fields

These fields are not used, remove them along with their setters.

Change-Id: I982b0374d6989f8ce561f7789f647b1ed2c1e32f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoEliminate sal.connect.netconf.sal.tx package 18/105818/1
Robert Varga [Wed, 3 May 2023 16:49:13 +0000 (18:49 +0200)]
Eliminate sal.connect.netconf.sal.tx package

Transactions in this package are an implementation detail of the
sal.connect.netconf.sal package. Move them and their tests, hiding
them from outside view.

JIRA: NETCONF-1006
Change-Id: I3f3cc23ca54bc1a0e3b25fb4a29f5c75a3d8bd5e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoEliminate action-related constants 17/105817/1
Robert Varga [Wed, 3 May 2023 16:30:34 +0000 (18:30 +0200)]
Eliminate action-related constants

The YANG namespace is a well-known constant in YangConstants, reuse it
from there. Also inline "action" to its sole user.

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