netconf.git
8 months agoFix logic of POST schema reference creation 91/107491/1
Yaroslav Lastivka [Wed, 23 Aug 2023 16:59:57 +0000 (19:59 +0300)]
Fix logic of POST schema reference creation

After implementing the 'Use first child in POST payloads' changes,
list child nodes no longer include a 'key' value in example payloads.

Removed unnecessary 'post' prefix from schema references
for lists and containers child nodes in POST requests,
enabling the use of a valid schema.

JIRA: NETCONF-1054
Change-Id: I26a07e1ad04a0d08567c31d48d24f19349dd8022
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
(cherry picked from commit 65c1945627ad388d4239f4a951aa9d4efc2dba74)

8 months agoUse first child in POST payloads 74/107474/1
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>
(cherry picked from commit 257accd8ae1427e5e23df77fcde2cc58ac1a454d)

8 months agoOpenApi: Fix module names in Json payload 98/107398/4
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>
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
(cherry picked from commit 3fabeac2a6362355b3df117b86dde362178517c2)

8 months agoTest paths with single module vs all modules 81/107381/2
Šimon Ukuš [Fri, 21 Jul 2023 09:48:04 +0000 (11:48 +0200)]
Test paths with single module vs all modules

There are differences between path nodes 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.

These differences were removed in previous patch.
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>
(cherry picked from commit 30f60a4569137fdded6f8db54b14501d098b435b)

8 months agoFix deviceName with specific module request 80/107380/2
Š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>
(cherry picked from commit 2b3398d67743baaec39c3562993c914bbf8972a3)

8 months agoAdd value "all" to content query parameter 35/107335/3
Š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>
(cherry picked from commit e9a71d3edd7b5b8ebae3ab1acee90a7281ecd9e5)

9 months agoCreate test for custom base path verification 86/106886/10
Šimon Ukuš [Wed, 7 Jun 2023 10:42:40 +0000 (12:42 +0200)]
Create test for custom base path verification

This patch introduces test that verifies the openapi paths
for modular basePath.

JIRA: NETCONF-1021
Change-Id: I6c5bf49f2c2e0b34a37636886c2848ac904ca0a3
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
(cherry picked from commit 24aa07321be7f0f339cd65f969c299c8c6ff0c59)

9 months agoClean up ApiDocGeneratorRFC8040Test 79/106879/7
Matej Sramcik [Tue, 11 Jul 2023 05:32:01 +0000 (07:32 +0200)]
Clean up ApiDocGeneratorRFC8040Test

We do not require mutability in test assertions. Thus we can get rid of
com.google.common.collect.Lists usage.

Change-Id: Ice34386075b23203ac71e2226883b7a28f742b05
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
9 months agoChange hard-coded actions path 85/106885/5
Šimon Ukuš [Wed, 7 Jun 2023 10:29:47 +0000 (12:29 +0200)]
Change hard-coded actions path

There was an assumption about the basePath ('rests') when creating
path for POST method for actions. The path was incorrect if instead of
the default basePath a custom one was used.

This patch fixes the path creation while not making any assumptions
about the basePath. The path is resolved when needed.

JIRA: NETCONF-1021
Change-Id: I4b4a7f8f69626874d9c9821205d7c726dfe90919
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
(cherry picked from commit 206fb9f0c4b589222fc4a9fc3a47c9e203110d70)

9 months agoEliminate operational concept 10/106910/5
tobias.pobocik [Tue, 18 Apr 2023 08:53:44 +0000 (10:53 +0200)]
Eliminate operational concept

In sal-rest-docgen package there still resist some
remnants of bierman-02 operational data concept.

Now, we have just "data" for both "config" and "nonconfig" data.
By eliminating "config" and "operational" split we can get rid
of some unnecessary logic.

JIRA: NETCONF-992
Change-Id: I6b03e8ce43d75cb53ed14862b783d84fe03e542c
Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
(cherry picked from commit 3da5dc20c14061e061d902bb3b5d30f139717fdd)

9 months agoAdd mandatory node to _post element in OpenApi 37/106737/2
Peter Suna [Wed, 28 Jun 2023 08:58:38 +0000 (10:58 +0200)]
Add mandatory node to _post element in OpenApi

Previous cherry-pick to fix mandatory fields did not account
for the presence of _post elements, which were removed in the master
branch. The change can be found at:
[https://git.opendaylight.org/gerrit/c/netconf/+/106636]

Additionally, this commit addresses the mandatory fields
in _post nodes, ensuring they are fixed as well.

JIRA: NETCONF-976
Change-Id: Ibbaf9dbc0a449b5928be2a528965205bb92ce70a
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
9 months agoRemove TestData and move fields to user 87/106887/2
Šimon Ukuš [Mon, 26 Jun 2023 11:29:11 +0000 (13:29 +0200)]
Remove TestData and move fields to user

The sole purpose of TestData was to hold constants
of ReadDataTransactionUtilTest.

This change moves all the constants to the ReadDataTransactionUtilTest
and removes the TestData.

JIRA: NETCONF-1063
Change-Id: I3104c33a2f2b5284b99ea52c93e4504c6df42b33
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
(cherry picked from commit 83885bf7f9846676772dbf5c34aa8165a94aac6c)

9 months agoCherry-pick unit test into 4.0.x 66/106766/5
Matej Sramcik [Fri, 30 Jun 2023 08:26:07 +0000 (10:26 +0200)]
Cherry-pick unit test into 4.0.x

cherry-picks and adapt tests from:
https://git.opendaylight.org/gerrit/c/netconf/+/105089
for 4.0.x (adapt to NETCONF-1059).

Change-Id: I8573f9325a4ae0c27707e362991d85a0eeca37b3
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
10 months agoFix yanglib data merge 14/105914/1
Ruslan Kashapov [Thu, 22 Jun 2023 08:19:30 +0000 (11:19 +0300)]
Fix yanglib data merge

Explicit definition of ordered mapping node causes
incompatibility with schema based unordered mapping node
generated out of Binding object and yanglib data merge
failure as result.

+ Minor code cleanup

JIRA: NETCONF-1065
Change-Id: I23865e1d543819ae60c1160183986c27595dc999
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
(cherry picked from commit cda37287a5d93bfc9657191537403de815b00f11)

10 months agoFix choice cases usage 22/106722/4
Yaroslav Lastivka [Thu, 23 Mar 2023 10:11:58 +0000 (12:11 +0200)]
Fix choice cases usage

Currently we are generating all cases from choice into payload used
as example in apidoc.
This is incorrect because we can use only one case at the time.
Implemented using first case (or default if specified) node in
apidoc example.

JIRA: NETCONF-983
Change-Id: Ifc32ee00e0de265b4f7e612adb5b8d3783b696a2
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
(cherry picked from commit 710e8f2f88c4cb4dff1900647f8c71e2e6b46b0d)

10 months agoChange schema for GET XML example 51/106651/5
Šimon Ukuš [Wed, 21 Jun 2023 10:17:03 +0000 (12:17 +0200)]
Change schema for GET XML example

The XML example for GET request in OpenApi UI was different
to the one being actually returned. This patch changes the schema
used for that example, making it consistent with what is actually
returned in the response.

We still keep support for OAversion.V2_0, for which the change was
not applied. That is because this version does not support different
schemas for different MIME types

JIRA: NETCONF-1059
Change-Id: Ie2d128b6de43d705c93d509c287cabcbc719e591
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
(cherry picked from commit af6b9fe02a26fdd789470f0e8ab4c9062202c3a9)

10 months agoOpenApi: Add parameters into actions 39/106639/6
Yaroslav Lastivka [Wed, 10 May 2023 11:01:09 +0000 (14:01 +0300)]
OpenApi: Add parameters into actions

Some devices using actions have invalid swagger URLs
generated. The problem is that we do not generate parameters
for actions.

Implemented logic for adding “pathParameters” to path parameters
for actions.

JIRA: NETCONF-860
Change-Id: If01af731770029fb8f7529312417a3ea46fd5841
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
(cherry picked from commit 83ed76f11114c14bf1eb7aec46d4943435d21c82)

10 months agoRemove unrequired testcase from mandatory field 37/106637/3
Peter Suna [Thu, 22 Jun 2023 14:05:23 +0000 (16:05 +0200)]
Remove unrequired testcase from mandatory field

The required field can only be obtained from the schema node.
Checking the inner field is unnecessary.

JIRA: NETCONF-976
Change-Id: I297a6216311c652e7fd460c6efd9cf42a1512add
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
(cherry picked from commit 18564f4bfdacd6df50cd79f2c6b49b9656a71674)

10 months agoOpenApi: Add missing mandatory nodes to required 36/106636/3
Peter Suna [Wed, 21 Jun 2023 15:50:11 +0000 (17:50 +0200)]
OpenApi: Add missing mandatory nodes to required

Add mandatory containers, lists and leaf-lists to
required JSON array in OpenApi if they are mandatory.

Based on RFC7950:
https://www.rfc-editor.org/rfc/rfc7950#page-14

JIRA: NETCONF-976
Change-Id: Ieca56ad9a325b59fdf57438594b89f34e3776e08
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
(cherry picked from commit 34f17c5f8989dc53ae5b7ae1dd7c1c84b9055d5d)

10 months agoOpenApi: Add missing required elements to JSON 35/106635/3
Peter Suna [Fri, 23 Jun 2023 06:12:45 +0000 (08:12 +0200)]
OpenApi: Add missing required elements to JSON

This commit adds missing mandatory nodes to the required
field of the JSON OpenApi data. According to RFC-7950, a node
is mandatory if it is:
A leaf, choice, anydata, or anyxml node with a "mandatory"
statement with the value "true".

See:
https://www.rfc-editor.org/rfc/rfc7950#page-14

The only exception for this patch is the 'choice' node.
If the 'choice' node is mandatory, we cannot require the
'choice' or 'case' name in the body.

Additionally, nodes inside the 'case' should only be required
if they are mandatory.

JIRA: NETCONF-976
Change-Id: I3d1220737a582b27163a9ff8f33ceee1edb94c87
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
(cherry picked from commit 08d93cab539d7abbe045a87ba415a8a1b81637e7)

10 months agoAdd slash symbol into actions request 38/106638/1
Yaroslav Lastivka [Wed, 21 Jun 2023 16:07:03 +0000 (19:07 +0300)]
Add slash symbol into actions request

Some BBF yang devices using actions have invalid swagger URLs generated

Added additional slash symbol before "rests/operations".

JIRA: NETCONF-860
Change-Id: I92c5f67f2f360759d43564870fc248688dfc6caf
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
(cherry picked from commit 93faf8d1929caa4b208ad618ee1b46b30e483d24)

11 months agoBump versions to 4.0.9-SNAPSHOT 55/106355/1
Robert Varga [Fri, 2 Jun 2023 08:20:06 +0000 (10:20 +0200)]
Bump versions to 4.0.9-SNAPSHOT

This starts the next development iteration.

Change-Id: I474326eb16ca6fbbc65b1a476a64eb948ba1d71b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoFix fields processing error for duplicate node names 52/106352/1
Sangwook Ha [Tue, 28 Mar 2023 07:05:55 +0000 (00:05 -0700)]
Fix fields processing error for duplicate node names

NetconfFieldsTranslator saves LinkedPathElement identified by the target
node identifier, hence does not allow keeping track of data nodes with
the same name failing to generate correct paths if such nodes are
included in the fields parameter.

Address the issue by replacing the list of sets to keep track of the
data nodes specified in the fields parameter with a tree of
LinkedPathElement objects keeping track of its parent path element.
This allows generation of all unique paths defined in the fields
parameter and also simplifies the processing.

But this change in the data structure is incompatible with
AbstractFieldsTranslator, and NetconfFieldsTranslator does not inherit
the abstract class.

JIRA: NETCONF-985
Change-Id: I762714f8a25231c1394d75b47e269167b37660f8
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
(cherry picked from commit 8c5bcfc76987e678469d5a4a95ae882bad6fe91a)

11 months agoBump versions to 4.0.8-SNAPSHOT 28/106328/1
Robert Varga [Thu, 1 Jun 2023 07:13:35 +0000 (09:13 +0200)]
Bump versions to 4.0.8-SNAPSHOT

This starts the next development iteration.

Change-Id: I443bc1e97c10e8a59c2bd57dde117bf6da1e8d08
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoRelease netconf v4.0.7
jenkins-releng [Wed, 31 May 2023 13:20:07 +0000 (13:20 +0000)]
Release netconf

11 months agoBump upstrems 04/106304/1
Robert Varga [Wed, 31 May 2023 09:29:07 +0000 (11:29 +0200)]
Bump upstrems

Adopt:
- odlparent-11.0.6
- infrautils-4.0.6
- yangtools-9.0.8
- mdsal-10.0.8
- controller-6.0.9
- aaa-0.16.9

Change-Id: I012dde34672a5460abefb842d0fc069ae9dfbd92
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
11 months agoMissed required parameters in swagger schema 64/106264/2
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>
(cherry picked from commit 3ad4ed5a7ef688dd158aab689240b0065b94ce47)

11 months agoFix invalid swagger schema 54/106254/3
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>
(cherry picked from commit d0cd1ee47c1cc294655e7b9a0e8820f0b1aeb0b6)

11 months agoBump conf.yaml versions to Chlorine 61/106161/3
Matej.Sramcik [Fri, 26 May 2023 07:39:16 +0000 (09:39 +0200)]
Bump conf.yaml versions to Chlorine

Change NetConf configuration to Chlorine

JIRA: NETCONF-1038
Change-Id: I1f344f6adcf13c143083cf10a26aded57f27b218
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
11 months agoFix retrieving operations resource 40/106140/1
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>
11 months agoFix notification namespace reference 52/105852/1
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>
(cherry picked from commit 7c10f9323ef1e097632c2a624a8dfc211782a0cc)
(cherry picked from commit c9c2fa5d4e7532dc7cdfd0e18227a4e4c3520229)

12 months agoPropagate eventTime during notification transformation 88/105688/2
Robert Varga [Tue, 25 Apr 2023 21:13:16 +0000 (23:13 +0200)]
Propagate eventTime during notification transformation

Binding Notification objects expose the time when the event was
generated through an optional EventInstantAware interface. Recognize
when a Notification carries this annotation and propagate it correctly.

JIRA: NETCONF-1001
Change-Id: I06ce94ffbe11bafeedb60aaa28765e151de53b3f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1ad7ad47f032df11ca7b88ded7e2fd3e29eeae0c)
(cherry picked from commit 6338139f1c7eab6c794d4bbebee3b8ae33a3a4ed)

12 months agoFix odl-netconf-test-tools packaging 79/105679/1
Robert Varga [Tue, 25 Apr 2023 17:19:57 +0000 (19:19 +0200)]
Fix odl-netconf-test-tools packaging

This feature should depend on odl-netconf-connector for the southbound
plugin. Fix that, eliminating packaging leaks of:
- mdsal.model/ietf-topology
- netconf/sal-netconf-connector
- netconf/sal-netconf-connector

Change-Id: Iac1951254c31df968d0c9b456ca5adb0edb71a23
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8f11cb0ee097877e33c389b1c85059585a4c22e4)

12 months agoBump versions to 4.0.7-SNAPSHOT 74/105474/1
Robert Varga [Mon, 17 Apr 2023 08:49:50 +0000 (10:49 +0200)]
Bump versions to 4.0.7-SNAPSHOT

This starts the next development iteration.

Change-Id: Ic2e9d3377e5f241a759ffa558c3b66203a767448
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 months agoBump automaton to 1.12-4 43/105443/2
Robert Varga [Wed, 12 Apr 2023 11:51:27 +0000 (13:51 +0200)]
Bump automaton to 1.12-4

There's no functional change.

Change-Id: Iace65d05ef4634feb12084b6397c425fc530a24c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 91f8bbfe9f177e8380a9ddf0bb447acee9734a2d)

12 months agoRefactor and enable linkcheck except for IETF URLs 44/105444/2
guillaume.lambert [Thu, 13 Apr 2023 12:38:19 +0000 (14:38 +0200)]
Refactor and enable linkcheck except for IETF URLs

Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: Ic92f8995e4e388644c951113066cdfbb575fcda3
(cherry picked from commit fbe70146ecbad0127ce90c7916f0044325564787)

12 months agoUpdate NETCONF user guide 81/104781/6
Yaroslav Lastivka [Wed, 8 Feb 2023 17:46:34 +0000 (19:46 +0200)]
Update NETCONF user guide

User guide still contains references to removed bierman-02 paths:
`/restconf/config`, `/restconf/operational` and `restconf/operations`.

Fix them according to RFC 8040.

Make other small changes in order to make documentation up-to-date
with current state: update RFC-7895 link, update requests, default
ports and the netopeer2 usage.

JIRA: NETCONF-946
Change-Id: I94cd1fdf53ff3038a691f43f615d96645df7f023
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
(cherry picked from commit f6ca808c32a2d66858859074117b7b45a0ec1269)

12 months agoBump upstrems 31/105431/2
Robert Varga [Thu, 13 Apr 2023 10:55:10 +0000 (12:55 +0200)]
Bump upstrems

Adopt:
- odlparent-11.0.5
- infrautils-4.0.5
- yangtools-9.0.7
- mdsal-10.0.7
- controller-6.0.8
- aaa-0.16.8

Change-Id: I91a7eabb49277cbadb972ae66f2360fb7dc9dbd5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 months agoDisable linkcheck 38/105438/1
Robert Varga [Wed, 12 Apr 2023 15:02:00 +0000 (17:02 +0200)]
Disable linkcheck

Linkcheck is failing on rfc-editor, as noted in
https://jira.linuxfoundation.org/plugins/servlet/desk/portal/2/IT-25351,
disable it until that issue is fixed.

Change-Id: I30976060f43f5da6b3cc6c3ba0f0bc59f8388591
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 535bcea1d8300a40bce73446dbd5b9790648bccd)

12 months agoRemove empty XML lines 24/105224/2
zw1127 [Thu, 30 Mar 2023 09:19:55 +0000 (17:19 +0800)]
Remove empty XML lines

Java 9+ has changed the way indentation works, which means that unlike
Java 8, we are emitting empty lines, quite similar to what has been
reported in https://bugs.openjdk.org/browse/JDK-8262285.

Use an XSL style sheet to ensure we filter out empty Text nodes during
indenting transform opereations.

JIRA: NETCONF-988
Change-Id: Ia9e614d2c77766126923b9e1af82bb177dfb0c05
Signed-off-by: zw1127 <zw1016@gmail.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e7054b7a1ec0e12a97181180cac89ce80c8163b8)

12 months agoImprove XmlUtil.toString() 23/105223/1
Robert Varga [Tue, 4 Apr 2023 12:19:18 +0000 (14:19 +0200)]
Improve XmlUtil.toString()

Simplify the try-catch block to cover the minimum required scope.

Change-Id: I61b0bf2d104ff7f272ac335207993d432c11c8ed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 208021a60b33a23f8b925ebb3b346ee976e3bbab)

12 months agoModernize XmlUtilTest 22/105222/1
Robert Varga [Tue, 4 Apr 2023 12:10:17 +0000 (14:10 +0200)]
Modernize XmlUtilTest

Use assertThrows() and text blocks to make it clearer as to what
we are doing.

Change-Id: I3ac89a14bc76d4427449aa9f24d820268b709d6e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b70dee56e903aa7de212771c12f16a2df943ad4c)

13 months agoFix schemas not shown for created devices 02/104602/1
OleksandrZharov [Mon, 20 Mar 2023 19:00:29 +0000 (20:00 +0100)]
Fix schemas not shown for created devices

Removed few lines from html template script that prevented
schemas from showing on web page.

JIRA: NETCONF-977
Change-Id: If739e6c331a45784bdd9bd00eb50b93a92a1bdb8
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
(cherry picked from commit 36a53a3171615f4ae4fa38edd0e4887e2ec04a8e)

13 months agoFix YANG patch request for augmented element 96/104696/4
OleksandrZharov [Fri, 26 Aug 2022 15:43:24 +0000 (17:43 +0200)]
Fix YANG patch request for augmented element

When writing JSON data using yangtool's NormalizedNodeStreamWriter
we have to check if the result is instance of Augmentation.

In that case we have to use its child as data. Similar process
is applied in JsonNormalizedNodeBodyReader.

JIRA: NETCONF-747
Change-Id: I2c1d1abcd3cbb483b414408c2c768bdc5731b8ce
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
13 months agoFix YangLib media types 98/104598/1
Ivan Hrasko [Wed, 8 Mar 2023 09:22:03 +0000 (10:22 +0100)]
Fix YangLib media types

Fix YangLib media types to return "application/yang" with default
fallback to "text/plain".

JIRA: NETCONF-972
Change-Id: Ibd7a6939342cfbe4b525442d8606e4c27d3e8b65
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
(cherry picked from commit e7996455d2d0e4a2369c5b40142cad0b0e176d23)

14 months agoEnforce idleTimeout/heartbeatInterval consistency 64/104664/1
Robert Varga [Wed, 1 Mar 2023 12:40:22 +0000 (13:40 +0100)]
Enforce idleTimeout/heartbeatInterval consistency

We should not allow a configuration where we time out before we send a
heartbeat. Enforce this invariant.

JIRA: NETCONF-970
Change-Id: Ic26319d7a3da4db9b28fa0aa2e39cdfe439fd786
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e04ac4e328c7ea1de978ede2426c564f8d0b2190)

14 months agoReduce verbosity of websocket timeout logging 63/104663/1
Robert Varga [Wed, 1 Mar 2023 12:55:56 +0000 (13:55 +0100)]
Reduce verbosity of websocket timeout logging

A websocket timing out is not a big thing, do not log a complete stack
trace when it occurs.

JIRA: NETCONF-970
Change-Id: I04ec6da1957ba13a27561dfbff9c06a10f011083
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f1a717a15be5ff88a509958795c51c7a114b7312)

14 months agoFix web-socket timeout closure exceptions 62/104662/1
Ruslan Kashapov [Wed, 15 Feb 2023 13:58:40 +0000 (15:58 +0200)]
Fix web-socket timeout closure exceptions

As noted in WebSocketSessionHandler.onWebSocketClosed(), there is no
guarantee the session reports isOpen(). Performing the same check in
AbstractCommonSubscriber.removeSubscriber() (via isConnected()) can
therefore result in an ISE.

Fix this by removing the check.

JIRA: NETCONF-970
Change-Id: I6e437d9821e698e3faca121402a97b88ac486229
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
(cherry picked from commit 0d05f5be80762b833acc0b8337b68b353e4c673a)

14 months agoSimplify WebSocketSessionHandler.isConnected() 61/104661/1
Robert Varga [Wed, 1 Mar 2023 12:45:15 +0000 (13:45 +0100)]
Simplify WebSocketSessionHandler.isConnected()

Use a simple expression instead of a if/else.

Change-Id: Ie1a2e26f1731c799fa6e9e1b027563702809eb7f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit ae13eecd3f9863754d5dc9a0feb5a22e708f12d0)

14 months agoReuse ObjectMapper instance 60/104660/1
Yaroslav Lastivka [Mon, 27 Feb 2023 09:01:55 +0000 (11:01 +0200)]
Reuse ObjectMapper instance

It's recommended to reuse ObjectMapper instances but in current codebase
we are recreating it.
ObjectMapper field was made static to prevent multiple object creation.

JIRA: NETCONF-938
Change-Id: If6ed5b5b1959b28d2330e3dc450afb3f20c15c29
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
(cherry picked from commit 83698fa3ec1d5d889f3ece39ebfd1cd54520e609)

14 months agoFix restconf-nb websocket initialization failure on karaf 90/104590/1
Ruslan Kashapov [Wed, 15 Feb 2023 13:58:40 +0000 (15:58 +0200)]
Fix restconf-nb websocket initialization failure on karaf

Websocket servlet is initialized using indirect dependency on
server bundle (string class name in code, dynamic-import in
manifest). This dependency require to be set explicitly. Then
required bundle will be installed with odl-restconf-nb feature
and missing artifacts will be available for restcong-nb
class loader.

JIRA: NETCONF-953
Change-Id: I82e9133af1aeb98518f97a14a3574b82573f92dc
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
(cherry picked from commit af9b71c6837f46cfa324f59467750648ecfa34d3)

14 months agoFix feature install inside scale-util 89/104589/1
Peter Suna [Thu, 16 Feb 2023 07:34:21 +0000 (08:34 +0100)]
Fix feature install inside scale-util

The feature "odl-restconf-nb-rfc8040" has been deprecated
and is no longer available. It has been replaced by
the "odl-restconf-nb" feature.

Change-Id: I5dce4d65fa241ef9453f90b13703612d8e7b5747
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
(cherry picked from commit f529c92c2a7b221ecdcdd1e70584222b54b6fade)

14 months agoUpdate documentation for YangLib feature 91/104391/1
Yaroslav Lastivka [Fri, 3 Feb 2023 08:43:12 +0000 (10:43 +0200)]
Update documentation for YangLib feature

Documentation was updated according to current model and default values.

JIRA: NETCONF-909
Change-Id: I514f3677b8ba6b02e6e146e47fdee09e5791a386
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
(cherry picked from commit 793d1d10337cc6dc4eb498f9a7989d95ea266832)

14 months agoFix odl-yanglib feature usage 90/104390/1
Yaroslav Lastivka [Thu, 19 Jan 2023 11:55:38 +0000 (13:55 +0200)]
Fix odl-yanglib feature usage

The problem is that Initialization stops working correctly and
expect non-empty YanglibConfig provided by blueprint.

Were set default cache-folder to cache/schema, binding-addr to
localhost and binding-port port 8181 by creating new config
file.

JIRA: NETCONF-909
Change-Id: I76455310d014a5ad87051cb0ac749f5ce9f010c1
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 11ced7438f39559415565864c085fc0ec4422f4d)

14 months agoBump json-unit-assertj to 2.36.1 60/104160/1
Ivan Hrasko [Wed, 8 Feb 2023 16:03:21 +0000 (17:03 +0100)]
Bump json-unit-assertj to 2.36.1

Fix CVE-2022-42003 by bumping json-unit-assertj to 2.36.1
which uses fixed jackson-databind version 2.14.0.

Change-Id: I3ab3cb9e03393ea1d223616e0b013f7f10e6a74c
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
(cherry picked from commit 4c0bdb9e23281e579ec9b90a510bd2f0844de502)

15 months agoReuse NetconfClientBuilder in NetconfCallHomeServer 53/104153/1
Peter Suna [Tue, 24 Jan 2023 12:18:07 +0000 (13:18 +0100)]
Reuse NetconfClientBuilder in NetconfCallHomeServer

To prevent issues with connecting to devices that
use old key exchange algorithms, use the default NetconfSshClient
inside the NetconfCallHomeServer.

JIRA: NETCONF-887
Change-Id: I379c26281dcec6df10dcdbe0ccbfa8c3bea7e8f0
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
(cherry picked from commit e3ad7c25673e9c59e750612c83adf73fdb1576a4)

15 months agoMigrate UnresolvedQName.unqualified() callers 64/103264/2
Robert Varga [Mon, 5 Dec 2022 17:24:44 +0000 (18:24 +0100)]
Migrate UnresolvedQName.unqualified() callers

This method has a better replacement, migrate to using it.

Change-Id: Ie8b59777665af8312a4453cf1aa6c8e932e143c6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f58b21d05c3ab30415ac26a086ba49932cae9dca)

15 months agoBump versions to 4.0.6-SNAPSHOT 04/103904/1
Robert Varga [Tue, 3 Jan 2023 11:02:00 +0000 (12:02 +0100)]
Bump versions to 4.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: I187f4f7fa3715bc3c05d70b47bc64152254b3fac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoDo not send 'commit' to the devices without candidate 67/103267/2
Sangwook Ha [Fri, 16 Dec 2022 01:06:05 +0000 (17:06 -0800)]
Do not send 'commit' to the devices without candidate

The 'commit' RPC should not be sent to the devices only with
'writable-running' and without 'candidate' capability.

Override the commit method for the 'Running' NetconfDataTreeService
to immediately return a DomRpcResult without any errors.

JIRA: NETCONF-933
Change-Id: Ic0e51135e3ae347213d8ef8dbc03deb282d47af3
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
(cherry picked from commit 3f566e5d24c17abd9643dd854b11d4345231a2e1)

15 months agoBump upstrems 03/103903/1
Robert Varga [Tue, 3 Jan 2023 09:31:43 +0000 (10:31 +0100)]
Bump upstrems

Adopt:
- odlparent-11.0.4
- infrautils-4.0.4
- yangtools-9.0.6
- mdsal-10.0.6
- controller-6.0.7
- aaa-0.16.7

Change-Id: I3a48c21b1630c28d01b68532544391d38ddaf164
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoDo not use null input for discard-changes 41/103841/2
Sangwook Ha [Wed, 21 Dec 2022 18:27:10 +0000 (10:27 -0800)]
Do not use null input for discard-changes

There is already a NormalizedNode defined in NetconfMessageTransformUtil
for the content of the 'discard-changes' RPC.

Use the static variable instead of 'null'. This would make message
transformation more robust and fix an error caused by an augmentation
to the RPC input while generating NetconfMessage.

JIRA: NETCONF-934
Change-Id: I38777313d74e92bd955248ceea78e765729d9259
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
(cherry picked from commit f3cd4750c64f9002940b3bf20ea6be47a14344c3)

16 months agoFix duplicate in error message 49/103749/1
Ivan Hrasko [Mon, 12 Dec 2022 08:46:47 +0000 (09:46 +0100)]
Fix duplicate in error message

Fix duplicate occurrence of yang-ext:mount in error message
when operation is not found.

JIRA: NETCONF-926
Change-Id: I2d8f9f1e2f1c4257e3802f7e2df983597f34c6c4
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
(cherry picked from commit 8de9afa5d61cc863e216a98d39a950bb300514d0)

16 months agoSimplify OperationsContext with yangtools 7.0.9+ 89/103689/1
OleksandrZharov [Wed, 14 Dec 2022 16:18:23 +0000 (17:18 +0100)]
Simplify OperationsContext with yangtools 7.0.9+

Simplified the logic in OperationsContent class with usage of
features available in yangtools 7.0.9.

Now we use EffectiveModelContext#findModuleStatements to find module
statements already sorted by revision.

JIRA: NETCONF-927
Change-Id: I5f0d3e310ac6cf499cb93c6e47e7142cf8653962
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 45a89bde4d8159468a6a1211b78cb421aab5fbc4)

16 months agoRemove NetconfDeviceFacade.salRegistrations() 54/103654/1
Robert Varga [Thu, 8 Dec 2022 19:56:40 +0000 (20:56 +0100)]
Remove NetconfDeviceFacade.salRegistrations()

This field is unused, remove it.

Change-Id: If7ede429196a5136f8680cef2ba245a4c996cf65
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2e719163dd762200de1b276f3c18d5b75d9eabe3)

16 months agoBump versions to 4.0.5-SNAPSHOT 41/103541/2
Robert Varga [Sat, 3 Dec 2022 09:59:05 +0000 (10:59 +0100)]
Bump versions to 4.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: I06a1ec56ac89a59d4feb9fa91711286f22e8e160
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoBump upstrems 40/103540/2
Robert Varga [Sat, 3 Dec 2022 09:58:17 +0000 (10:58 +0100)]
Bump upstrems

Adopt:
- odlparent-11.0.3
- infrautils-4.0.3
- yangtools-9.0.5
- mdsal-10.0.5
- controller-6.0.5
- aaa-0.16.6

Change-Id: I5243bacf7507ba7703f742ef46cfeb5aa197b79b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoBump SSHD to 2.9.2 52/103252/1
Robert Varga [Wed, 16 Nov 2022 22:30:08 +0000 (23:30 +0100)]
Bump SSHD to 2.9.2

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

Change-Id: I7bc6d261e0666929abde410cad64cfaabf8506e8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6bac0befd20952fc07aab28b9575b690a04c0f06)

17 months agoBump versions to 4.0.4-SNAPSHOT 45/102645/2
Robert Varga [Mon, 7 Nov 2022 00:30:38 +0000 (01:30 +0100)]
Bump versions to 4.0.4-SNAPSHOT

This starts the next development iteration.

Change-Id: I24622b3fecb76ca9471b5556a48435932f637082
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 40199db98ceb28d9e303e9959167d1c6ab6e1355)

17 months agoClean up XML interactions 15/103115/1
Robert Varga [Sun, 6 Nov 2022 21:49:37 +0000 (22:49 +0100)]
Clean up XML interactions

We have a chunk of duplicated code, make sure we provide provide
utilities.

Change-Id: Ibb2b3e14f23c76aa101dcd3766d35aa6a15a5752
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoClean up namespace handling 14/103114/1
Robert Varga [Sun, 6 Nov 2022 21:29:33 +0000 (22:29 +0100)]
Clean up namespace handling

We should tie together namespaces and elements to the generated model,
so that these are kept consistent.

Change-Id: I2d1167e632b6695985bf93d4102794978d2811df
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoAdd missing identifier for list node in fields RESTCONF query 00/99400/12
Peter Puškár [Thu, 20 Jan 2022 08:54:43 +0000 (09:54 +0100)]
Add missing identifier for list node in fields RESTCONF query

Fields filtering is currently completely failing for NETCONF nodes
when the fields query contains any list node, because we need both
NodeIdentifier (for the entire list) and NodeIdentifierWithPredicates
(for a concrete entry) to parse them correctly.

WriterFieldsTranslator provides both already and this is correctly
working on non-NETCONF nodes. Make this behaviour consistent for both.

JIRA: NETCONF-820
Change-Id: I24d6ec1752ba1a2f551fcd4149c6efde04f1a89c
Signed-off-by: Peter Puškár <ppuskar@frinx.io>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoUse switch expression for EventFormatterFactory selection 09/103109/1
Robert Varga [Sun, 6 Nov 2022 18:45:58 +0000 (19:45 +0100)]
Use switch expression for EventFormatterFactory selection

Useing a switch expression removes the unhandled case, promoting to a
compile-time error if things do not match up.

Change-Id: I8688e4bc76419194cb0d910105ff0733cd6d118f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoAdd the concept of a netconf client name 68/97568/9
Peter Puškár [Thu, 13 Oct 2022 13:25:41 +0000 (15:25 +0200)]
Add the concept of a netconf client name

Clients can be optionally named with a simple string, this is then
propagated to AsyncSshHandler and used for logging purposes.

JIRA: NETCONF-896
Change-Id: Iebb6c094c50ff4646b8ef3e9221cebd3dbebe5e3
Signed-off-by: Zdenko Filip <zfilip@frinx.io>
Signed-off-by: Jaroslav Tóth <jtoth@frinx.io>
Signed-off-by: Peter Puškár <ppuskar@frinx.io>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoUse try-with-resources in SSHTest 07/103107/2
Robert Varga [Sun, 6 Nov 2022 17:45:35 +0000 (18:45 +0100)]
Use try-with-resources in SSHTest

SshProxyServer is autocloseable, we should use try-with-resources to
manage it.

Change-Id: I797064a83b793767a7041d51fa1ab507b79b781f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoBump upstrems 80/103080/3
Robert Varga [Fri, 4 Nov 2022 14:40:05 +0000 (15:40 +0100)]
Bump upstrems

Adopt:
- odlparent-11.0.2
- infrautils-4.0.2
- yangtools-9.0.2
- mdsal-10.0.3
- controller-6.0.3
- aaa-0.16.4

Change-Id: I58f8179456cb8f0b2adc300bb0397b2636612d57
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoDo not reference individual builders 46/103046/1
Robert Varga [Thu, 3 Nov 2022 01:24:02 +0000 (02:24 +0100)]
Do not reference individual builders

We are about to hide individual builders, make sure we go through either
Builders or ImmutableNodes.

Change-Id: I9ece3328ffe148e09e5e232e79cc8db24214161b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoBump sshd to 2.9.1 01/101901/9
Robert Varga [Fri, 29 Jul 2022 11:23:16 +0000 (13:23 +0200)]
Bump sshd to 2.9.1

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

JIRA: NETCONF-894
Change-Id: I54ecf8d02d4adfea742ce47ac6e164b1df2f6615
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoUse property setters 14/103014/1
Robert Varga [Wed, 2 Nov 2022 12:23:54 +0000 (13:23 +0100)]
Use property setters

SSHD configuration properties can be nicely set via a type-safe system,
make sure we use that instead of mucking with maps directly.

Change-Id: If1193c70d7057e16430ebf91e4dc78cc1d8f1745
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoFix mdsal-netconf-ssh shutdown 84/102584/6
Ivan Hrasko [Fri, 7 Oct 2022 18:32:15 +0000 (20:32 +0200)]
Fix mdsal-netconf-ssh shutdown

Initialize AsynchronousChannelGroup thread pool with
ForwardingExecutorService with NO-OP shutdown method
in order to prevent throwing UnsupportedOperationException
from OSGiGlobalEventExecutor.

JIRA: NETCONF-900
Change-Id: Ibedb95413bf5476f5d22ae899e71496951fb6ed7
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoReorder dependencies 16/102916/1
Robert Varga [Fri, 28 Oct 2022 09:20:41 +0000 (11:20 +0200)]
Reorder dependencies

Make sure org.json is first, removing the need for exclusions.

Change-Id: I6243ba7663d62c76f34e483dba406c7ed45ddb60
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoBump org.json/json to 20220924 04/102904/2
Robert Varga [Thu, 27 Oct 2022 16:15:42 +0000 (18:15 +0200)]
Bump org.json/json to 20220924

This version is in public domain, resolving potential licensing issues
around "do no evil" restriction. Also update other testing frameworks.

Change-Id: I55c4ba72c53bad8a33ba42c712db84e8bfece57c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoFix docgen failure on multi-level choice definition 75/102875/1
Ruslan Kashapov [Wed, 26 Oct 2022 07:38:35 +0000 (10:38 +0300)]
Fix docgen failure on multi-level choice definition

+ minor refactoring: duplicate code replaced with recursive function

JIRA: NETCONF-883
Change-Id: Ie577f930fe7fc104bc92a93286a2788b93c04ac6
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
18 months agoClean up *NormalizedNodeBody{Reader,Writer} 67/102867/1
Robert Varga [Tue, 25 Oct 2022 10:20:38 +0000 (12:20 +0200)]
Clean up *NormalizedNodeBody{Reader,Writer}

Use local variable type inference and instanceof patterns to clean up
casting and checks.

Change-Id: I410848132908f36dc5dd8a1b4ae309d872dd9b90
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoUse instanceof patterns in DefinitionGenerator 65/102865/2
Robert Varga [Mon, 24 Oct 2022 19:55:19 +0000 (21:55 +0200)]
Use instanceof patterns in DefinitionGenerator

We can simplify a bit with using a check-and-assign patterns.

Change-Id: Ib301dfa2f80ab7ad598cae5efc891ebbad021d06
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoAdd {keystore,truststore}-api and none implementations 05/102205/41
Robert Varga [Mon, 22 Aug 2022 13:08:15 +0000 (15:08 +0200)]
Add {keystore,truststore}-api and none implementations

The configuration bits for NETCONF/RESTCONF clients and server are part
of a large scale effort in NETCONF WG. In particular the concept of
crypto types and a keystore/truststore are shared between SSH and TLS
transports.

This patch adds the YANG models and an a 'none' implementation, which
the central keystore/truststore.

JIRA: NETCONF-590
Change-Id: I0827756df83aa9cfc83e98ee50b1e44f6310e82e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoFix TCPClientServerTest stability 21/102821/1
Robert Varga [Thu, 20 Oct 2022 15:01:20 +0000 (17:01 +0200)]
Fix TCPClientServerTest stability

Client's toString() changes when the connection completes. Move the
check to after we have waited for callbacks.

JIRA: NETCONF-590
Change-Id: I1ad7e375ca60d350affd1b226fa11ffc87106fe6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoFix transport-{api,tcp} dependencies 20/102820/1
Robert Varga [Thu, 20 Oct 2022 15:00:50 +0000 (17:00 +0200)]
Fix transport-{api,tcp} dependencies

netty-common is used by api, not by tcp, fix that up.

Change-Id: I338e1113506217905f6c8a779ab90d0025ccf2f1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoAdd transport-{api,tcp} 24/102124/59
Robert Varga [Wed, 10 Aug 2022 18:23:21 +0000 (20:23 +0200)]
Add transport-{api,tcp}

NETCONF (and potentially RESTCONF) has rather well-defined concepts
how it works on the transport layer. Furthermore there are quite mature
YANG models covering the configuration of both NETCONF server and
NETCONF client.

This patch introduces the transport-level APIs to establish a transport
stack and its interactions with protocol negotiation and then the
messages layer. A baseline implementation based on plain TCP is also
provided.

JIRA: NETCONF-590
Change-Id: I29c207a2036e1c54ea1f6d7fe48f7eb42a3a4a7d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoFix netconf WebInitializer url patterns 52/102552/3
OleksandrZharov [Tue, 4 Oct 2022 09:56:19 +0000 (11:56 +0200)]
Fix netconf WebInitializer url patterns

Fixed url patterns in WebInitializer so they all correspond
to specification.

JIRA: AAA-233
Change-Id: I2cfdabc7243e2c2d94debc3e02f6875d8ad13293
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoRemove OSGiBaseNetconfSchemas 60/102760/1
Robert Varga [Wed, 19 Oct 2022 11:47:15 +0000 (13:47 +0200)]
Remove OSGiBaseNetconfSchemas

We have constructor injection and therefore can easily reuse
DefaultBaseNetconfSchemas in OSGi environment as well.

Change-Id: I1677a9d208990eb60a74349f8b9fae921ac33096
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoTie together model namespace 46/102746/2
Robert Varga [Tue, 18 Oct 2022 17:40:39 +0000 (19:40 +0200)]
Tie together model namespace

We have a well-known constant at the ready which defines the model
revision we are bound to. Cross reference to ensure things work out
okay.

Change-Id: Ie6677b0070928df2f9de1c527d2524703a9f9cac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoReplace replaceHelloMessageOutboundHandler() 57/102757/4
Robert Varga [Tue, 18 Oct 2022 21:07:52 +0000 (23:07 +0200)]
Replace replaceHelloMessageOutboundHandler()

This is a utility method to manipulate pipeline, with a single caller.
Inline the method so the manipulations are clearly visible.

Change-Id: I7aafce20947559753f213cfcb686a14e74f6bb7c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoSimplify error checking in writeWithPendingDetection() 55/102755/4
Robert Varga [Tue, 18 Oct 2022 21:33:28 +0000 (23:33 +0200)]
Simplify error checking in writeWithPendingDetection()

We are only interested in seeing the failure, as we are guarateed to see
a completed future.

JIRA: NETCONF-905
Change-Id: I3fa0236592ff785be49e0cb69a20d7c08b9432e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoIgnore incoming messages in State.FAILED 56/102756/2
Robert Varga [Tue, 18 Oct 2022 23:45:41 +0000 (01:45 +0200)]
Ignore incoming messages in State.FAILED

Once we transition to FAILED state, we should not process any other
messages, as we just waiting for close() to complete.

JIRA: NETCONF-905
Change-Id: Id7d7f657e50bb7c7ad25c1445fa0b69e1e57cdb9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoCheck for early message send failures 51/102751/6
Robert Varga [Tue, 18 Oct 2022 19:37:29 +0000 (21:37 +0200)]
Check for early message send failures

The transition to start session negotiation does not truly start if we
fail to send the hello message. Check for this condition before
manipulating any other channel state.

JIRA: NETCONF-905
Change-Id: I024a39abc8c6219019531c2abedaf124a25b3f27
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoSequence state transitions during negotiation start 50/102750/5
Robert Varga [Tue, 18 Oct 2022 19:27:51 +0000 (21:27 +0200)]
Sequence state transitions during negotiation start

If we fail to write out the initial proposal, we will end up running
listener actions before other negotiation start transitions -- hence
messing up our state.

Inline sendMessage() and dispatch the listener as a last operation of
start().

JIRA: NETCONF-905
Change-Id: I06b3b266ed2c37ec388aff4abb988f84e6fa3863
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoSimplify isStateChangePermitted() 54/102754/1
Robert Varga [Wed, 19 Oct 2022 00:01:35 +0000 (02:01 +0200)]
Simplify isStateChangePermitted()

We have a duplicate check of old state value, merge two 'if' statements
together.

Change-Id: I36611230ef27de80f91a61b604e7bd71646c4718
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoClean up netconf-client tests 53/102753/3
Robert Varga [Tue, 18 Oct 2022 20:23:01 +0000 (22:23 +0200)]
Clean up netconf-client tests

Remove unneeded throws declarations and do not use mockito internals.

Change-Id: If25da046270c1e097f9e24c7e43dbad53720a293
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoClean up netconf-api tests 52/102752/2
Robert Varga [Tue, 18 Oct 2022 20:16:48 +0000 (22:16 +0200)]
Clean up netconf-api tests

Remove unneeded throws declaration, @Before instantiation and use of
mockito internals.

Change-Id: I7831f67d408c45582f1d97e8e21719700847b08d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoUse Future.cause() for error checking 49/102749/1
Robert Varga [Tue, 18 Oct 2022 18:59:34 +0000 (20:59 +0200)]
Use Future.cause() for error checking

Include error trace when terminating session.

Change-Id: I02faabd68cf8f9ad89dc0273e9a85641d12c8db6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>