netconf.git
5 months agoBump versions to 4.0.10-SNAPSHOT 22/108922/1 4.0.x
Robert Varga [Mon, 13 Nov 2023 18:05:59 +0000 (19:05 +0100)]
Bump versions to 4.0.10-SNAPSHOT

This starts the next development iteration.

Change-Id: I559eca4dec80e63287f9f435a909c5e71bbfa241
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoRelease netconf v4.0.9
jenkins-releng [Mon, 13 Nov 2023 16:09:59 +0000 (16:09 +0000)]
Release netconf

5 months agoClose device's source resolution on teardown 15/108915/2
Sangwook Ha [Mon, 2 Oct 2023 20:24:48 +0000 (13:24 -0700)]
Close device's source resolution on teardown

Checking the current connection status is not enough to guarantee that
schema setup was completed for the initial session-up event.

To resolve this close ListenableFuture for device schema resolution
when the 'onRemoteSessionDown' method is called.

This prevents unnecessary duplicate notification, creating duplicate
SchemaContext and avoid confusion in the connection state.

JIRA: NETCONF-1173
Change-Id: I7f84da4a9197db52a0c33d2640e0c2543e587d7b
(cherry picked from commit e9518fdc4410b5407318d4b3bcc7fa333e296c55)
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
5 months agoAdd correct status code to YangPatch 02/108902/2
Peter Suna [Tue, 7 Nov 2023 16:17:36 +0000 (17:17 +0100)]
Add correct status code to YangPatch

Set the status code based on the first global error
or the first error in the PatchStatusEntity.

JIRA: NETCONF-1103
Change-Id: Ica4e503226e9323e02efc51cf28e07868177154d
(cherry picked from commit 3a131d1ebe983754661b6ca1889e61f677998c2e)
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
5 months agoUse Jakarta Response object in yangPatch response 01/108901/2
Peter Suna [Thu, 9 Nov 2023 16:09:17 +0000 (17:09 +0100)]
Use Jakarta Response object in yangPatch response

Wrapped PatchStatusContext in a Response object within
the RestconfDataServiceImpl patchData method to provide
the option for customizing the status code

JIRA: NETCONF-1103
Change-Id: Id527a8c83fe7365a337ab90b5356ad31f67fda4d
(cherry picked from commit 7f419e7a9b662c54a6cee7b3c5cdefefa04ba7a0)
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
5 months agoFix JSON and XML PatchBodyWriter errors output 84/108884/2
Matej Sramcik [Thu, 9 Nov 2023 11:20:44 +0000 (12:20 +0100)]
Fix JSON and XML PatchBodyWriter errors output

When an error occurs on commit the result displays a global error
together with per-operation status, which is confusing and self
contradicting.

JsonPatchBodyWriter and XmlPatchBodyWriter edited to omit
per-operation status if global error is present.

Added tests for this behavior.

JIRA: NETCONF-1176
Change-Id: I228754e75189e8475fbd32fa0cb57272b35f654a
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
(cherry picked from commit 54cc4550da43ea6b553a8bd81a58e1aeffcbef03)

5 months agoFix buffer readerIndex test after XML parse error 63/108863/1
Peter Suna [Mon, 6 Nov 2023 09:45:07 +0000 (10:45 +0100)]
Fix buffer readerIndex test after XML parse error

Add test to verify NetconfMessage is not
a FailedNetconfMessage instance.

JIRA: NETCONF-1194
Change-Id: I4f23df2f2efefa1e74c975dfc0e112ec0bb0bcd0
(cherry picked from commit 37077c1d9d81ab280a161a4bd4992b7b712c26c9)
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
5 months agoClose device handler when it fails to connect 44/108844/1
Ivan Hrasko [Fri, 3 Nov 2023 12:48:13 +0000 (13:48 +0100)]
Close device handler when it fails to connect

Close RemoteDeviceHandler instance and thus delete operational data
for device from data-store when we failed to establish connection,
for example because of wrong password format used.

JIRA: NETCONF-1114
Change-Id: I9db06595a3867ec04ad30aa76b7a5b21c75b7a8f
(cherry picked from commit 204069e28ae7a784955f69d272777bbe367b163c)
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
5 months agoWorkaround invalid password 61/108561/5
Ivan Hrasko [Thu, 2 Nov 2023 15:49:47 +0000 (16:49 +0100)]
Workaround invalid password

Catch IAE which can, for example, be produced when we attempt to decrypt
a bad password.

JIRA: NETCONF-1114
Change-Id: I17154dea25cdec0252514ed803fbfaafd5060a6c
(cherry picked from commit d5ad82ef1f01bd868758aaa651049f5b09bbf259)
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
5 months agoUpdate buffer readerIndex after XML parsing error 39/108839/1
Sangwook Ha [Thu, 2 Nov 2023 08:40:52 +0000 (01:40 -0700)]
Update buffer readerIndex after XML parsing error

The readerIndex of the input buffer may have not reached the end
of the message when XML parsing fails. And in this case unnecessary
decoding may get repeatedly triggered for the unread partial message.

Make sure that readerIndex advances to writerIndex so that the next
decoding can start for a new message and add a test case to show this
parsing error scenario.

It means that we can skip all readable bytes counted by:
(ByteBuff.writerIndex - ByteBuff.readerIndex).

JIRA: NETCONF-1194
Change-Id: I01b668eb0c995ff01435e983cdbba1490645909e
(cherry picked from commit 2504bde5d69fcb64fd2f7469a6c15707cc4984d2)
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
5 months agoFix module's root POST request payload 49/108549/7
Oleksandr Zharov [Tue, 10 Oct 2023 10:24:18 +0000 (12:24 +0200)]
Fix module's root POST request payload

Removed “processModule” method from DefinitionGenerator class.
This method is invoked only when a specific single model is requested
directly and generated POST request had an incorrect payload.

Fixed “addRootPostLink” method to correct POST payload containing
the first container/list child.
Adapted affected unit tests.

JIRA: NETCONF-1179
Change-Id: Ic10280770cfceedc2c9c5099cdbdab14cdc28ad6
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
(cherry picked from commit 1f6754a83ab28b43e4636c87441315614a350de2)

5 months agoBump upstreams 81/108781/4
Robert Varga [Tue, 31 Oct 2023 11:14:55 +0000 (12:14 +0100)]
Bump upstreams

Adopt:
- odlparent-11.0.7
- infrautils-4.0.8
- yangtools-9.0.10
- mdsal-10.0.9
- controller-6.0.10
- aaa-0.16.10

Change-Id: I0aa981a5fb654fc1343ad169352aeb39d2250cd9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoSkip POST for nodes without container/list child 38/108638/2
Samuel Schneider [Tue, 24 Oct 2023 14:13:49 +0000 (16:13 +0200)]
Skip POST for nodes without container/list child

Remove generation of post operations for nodes that does
not have at least one container/list child.

Current implementation generates the wrong payload for JSON
and XML POST requests with leafs or leaf-list in the payload.

With this solution, we can avoid the need to check how many
leaves are in the container and what to do if more of them
are mandatory.

JIRA: NETCONF-1164, NETCONF-1165
Change-Id: I6268ab118fd0cb5092d4b959660855035394e436
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
(cherry picked from commit c62bceb1b3054e440181864569896bbc8c2736f4)

5 months agoOpenApi: Remove incorrect list POST requests 37/108637/2
Samuel Schneider [Tue, 24 Oct 2023 13:57:04 +0000 (15:57 +0200)]
OpenApi: Remove incorrect list POST requests

Our logic creates POST requests for lists with keys, containing
multiple resources in payload. This does not align with the expected
structure for creating child resources in the YANG model.

Added condition that prevents the creation of POST requests
that has list as a last element.

JIRA: NETCONF-1101
Change-Id: I46820f222c9c5ef8078ac8675d2adc12b06f1253
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
(cherry picked from commit 1d64392feb896e9c74f4d9085eea52bbfdac1211)

5 months agoRefactor OpenApiTestUtils methods 35/108635/2
Samuel Schneider [Tue, 24 Oct 2023 13:13:42 +0000 (15:13 +0200)]
Refactor OpenApiTestUtils methods

Change getPathParameters into getPathGetParameters and add
getPathPostParameters.

We assume that all paths present in OpenApi should have at least
GET example in the documentation.

Thus we can use GET operation as a base operation to get number of
parameters in path. We just need to drop 'content' parameter.

For actions and RPCs we can use getPathPostParameters method.

JIRA: NETCONF-1101
Change-Id: I2a0a24a5a567d7dd95b7adf6ec13dddb391fab51
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
(cherry picked from commit 88403faca52518bc4d9674190f17fe934e6f23d1)

5 months agoOpenApi: Fix parameter types for paths 53/108553/4
lubos-cicut [Tue, 10 Oct 2023 18:37:19 +0000 (20:37 +0200)]
OpenApi: Fix parameter types for paths

Corrected the hard-coded "string" type for path parameters type to the
proper type. Created a test to verify that the Schema type is assigned
with the expected type.

JIRA: NETCONF-1168
Change-Id: I0c1ff3dd04044507840fe2c484145e8c5740776a
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
(cherry picked from commit dd28415b7e9615f5f7e54dcc299c452d6a815cb9)

5 months agoOpenApi: Fix 'min-elements' for XML Leaf-List 52/108552/7
lubos-cicut [Fri, 13 Oct 2023 12:21:56 +0000 (14:21 +0200)]
OpenApi: Fix 'min-elements' for XML Leaf-List

Manually set examples with the expected number of elements in the
leaf-list, rather than relying on OpenAPI to duplicate them for us.

JIRA: NETCONF-1171
Change-Id: I883c92a396f88c610067861dc1e31bdd8dfcceb3
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
(cherry picked from commit 1c1ab4ebb81ce9a44128b4a02629b7c06d13bc2e)
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
5 months agoBump SSHD to 2.11.0 66/108666/1
Robert Varga [Tue, 24 Oct 2023 15:32:26 +0000 (17:32 +0200)]
Bump SSHD to 2.11.0

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

JIRA: NETCONF-1189
Change-Id: I4bd7e028f9340c7169317a10bd2ccf3d75e1058e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 9d5ee561a7dd73b6b43a190a923abc53bbc8a66f)

5 months agoBump SSHD to 2.10.0 65/108665/1
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>
(cherry picked from commit 3da408810a8bf2b2e92c788d09ecbdbe9a0976bd)

6 months agoRemove synchronization locking 33/108533/2
Samuel Schneider [Fri, 20 Oct 2023 09:03:47 +0000 (11:03 +0200)]
Remove synchronization locking

All sal-restconf-docgen API methods were synchronized
due to bug causing thread access to the SchemaContext
be not synchronized properly. The bug should be no longer
present as SchemaContext is declared to be safe for usage
in multi threaded environment.

JIRA: NETCONF-1049
Change-Id: I86818ee3c93f68f4a5f5bbd8d8fb6e8f6a8ee21c
Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
(cherry picked from commit 1f5210393f7696c7e37c1d0cca1fdd758b50fe32)

6 months agoReplace whitelist with allowlist 30/108530/3
Matej Sramcik [Thu, 19 Oct 2023 08:08:12 +0000 (10:08 +0200)]
Replace whitelist with allowlist

Replaced all usages of whitelist as its considered non-technical term
with allowlist.

JIRA: NETCONF-1185
Change-Id: Id6f827ae1b1fb4c2c3e52e69ec2c60ab3c19b25d
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
(cherry picked from commit 169d7d71cb8c5f90bb7a10ebd68cc51569ce504d)

6 months agoUpdate port in NETCONF user guide 45/108545/1
Matej Sramcik [Wed, 18 Oct 2023 12:16:16 +0000 (14:16 +0200)]
Update port in NETCONF user guide

Update NETCONF user guide call-home section with
currently being used listening port 4334.

JIRA: NETCONF-1184
Change-Id: If3390aab4e028fd6e18c377d668692807828024d
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
(cherry picked from commit ba6d04b96be4f6a6c164b81015c068f288b3c980)

6 months agoThrows RDE exception in case model was not found 08/108408/4
Oleksandr Zharov [Thu, 5 Oct 2023 12:19:57 +0000 (14:19 +0200)]
Throws RDE exception in case model was not found

Added proper response in case model was not found using
RestconfDocumentedException's DATA_MISSING error tag.

Added unit tests to cover this cases.

JIRA: NETCONF-1159
Change-Id: Ife5b3836c8c2d974963d80df4d497ec019a83cc1
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
(cherry picked from commit e17f784409f8d6a42a9529ef45423dfcd06c39f7)

6 months agoThrow exception when module cannot be found 07/108407/4
Oleksandr Zharov [Thu, 5 Oct 2023 09:01:49 +0000 (11:01 +0200)]
Throw exception when module cannot be found

Added exception in case module not found in
ParserIdentifier#toSchemaExportContextFromIdentifier.

JIRA: NETCONF-1166
Change-Id: I9571496d789a1c499fd4871787e25e562bfec8ae
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
(cherry picked from commit 820f7aba74e9f71b46da6d69611ce120feb26148)

6 months agoDo not change NetconfSessionPromise to failure 14/108414/1
Sangwook Ha [Fri, 30 Jun 2023 22:54:34 +0000 (15:54 -0700)]
Do not change NetconfSessionPromise to failure

Setting NetconfSessionPromise to failure when session negotiation fails
prevents recovery from a temporary session negotiation issue.
The state change does not prevent a new connection attempt but the
NETCONF session can never be fully established successfully even if the
negotiation itself is successful because it is tried with the same
promise which has already been set to failure.

Do not change the promise to failure when the session negotiation fails,
and leave the decision to ReconnectStrategy.

JIRA: NETCONF-1067
Change-Id: Id021d268f80f9991a2517a20ed105d3c1d87069c
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 09c09ffbff1a8cb1dd6926be41464b3fb3a0a24f)

6 months agoClarify NotificationQueryParams checks 44/108344/1
Robert Varga [Wed, 6 Sep 2023 17:20:45 +0000 (19:20 +0200)]
Clarify NotificationQueryParams checks

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

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

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

Change-Id: I659921075fe3c9e4e234a86bceba24a771a1cf89
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6b828e1710315104da40e750cc0c85593183bc68)
(cherry picked from commit 0ba2548351b626286902fcaadf87af838e6433cd)
(cherry picked from commit 024ef99ebba00f5f755f5ad30fd2c01376ca050e)

6 months agoMove parserPatchTarget() 43/108343/1
Robert Varga [Sun, 20 Aug 2023 16:03:35 +0000 (18:03 +0200)]
Move parserPatchTarget()

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

JIRA: NETCONF-1128
Change-Id: Iea9993606591d80d8247755d3c63a3b4d43a0ade
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit ff1a063b179ffcee2088b70782ca56d2479a4140)
(cherry picked from commit 927d7bb67c3bfac4c2e89c30611d3741f96c8945)
(cherry picked from commit 8379702856ec0d0caf22a82186ecf8bfc52123d6)

6 months agoDeprecate @Patch 42/108342/1
Robert Varga [Fri, 18 Aug 2023 15:00:12 +0000 (17:00 +0200)]
Deprecate @Patch

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

JIRA: NETCONF-1140
Change-Id: Id27e8936bf50fa90ed5e240ffb9adb08679a28be
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit c032a145e031a5d733431405df594f70508dcc2d)
(cherry picked from commit 6937f82ea656f3e51254eeb971849bdc3c0e4b8f)
(cherry picked from commit 214135530a48e14f7baf02a8751acb282bdfb5cd)

6 months agoDo not use LogicalDatastoreType.name() in logging 41/108341/1
Robert Varga [Thu, 3 Aug 2023 17:11:28 +0000 (19:11 +0200)]
Do not use LogicalDatastoreType.name() in logging

Issuing name() has no effect -- it is the same as toString(), and slf4j
will do that for us.

Change-Id: Ibb89475de803bd2f77e190f96264e2cebe0065d4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 803fa31e5301ddf9a48ebdac9a07c6fbe8c6a042)
(cherry picked from commit 4fa07c0bc14b0e10459f2f4e2f454eb51be86870)

6 months agoUse %X instead of %x + toUpperCase() 40/108340/1
Robert Varga [Thu, 3 Aug 2023 16:18:58 +0000 (18:18 +0200)]
Use %X instead of %x + toUpperCase()

This is a tad more expressive.

Change-Id: I1785a38c80c963f6ec1a7f31315c5e3ac59b842a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1053458c853111041eb8a442e4d1425004254821)
(cherry picked from commit 0b5ce913edde1821bcfa470faa77be73a042ac13)

6 months agoUse ErrorSeverity.elementBody() in RestconfError 39/108339/1
Robert Varga [Thu, 3 Aug 2023 15:51:26 +0000 (17:51 +0200)]
Use ErrorSeverity.elementBody() in RestconfError

ErrorSeverity provides the element body through a dedicated method, do
to use toLowerCase().

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

6 months agoFix RPC XML payload missing namespace 71/108271/8
Matej Sramcik [Fri, 6 Oct 2023 06:47:00 +0000 (08:47 +0200)]
Fix RPC XML payload missing namespace

XML payload for RPCs is missing namespace.
Add namespace parameter to schema builder.
Add test to check if namespace is present.

JIRA: NETCONF-1139
Change-Id: I17b99e0afa6acdcac98a63baef625c671a6ce29e
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
(cherry picked from commit 9dc5513792f3af8eba4ca3a1eb5617c7c243fc6f)

6 months agoFix checkstyle 77/108277/1
Robert Varga [Thu, 31 Aug 2023 10:23:46 +0000 (12:23 +0200)]
Fix checkstyle

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

Change-Id: I46ac6cf74c243a80a6866d649914628eb19b3576
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4a8d27bf03c0088b9c571422cb39753d058f6b5a)
(cherry picked from commit d43606a98f310215096b6efec4beb865c3e26e3b)
(cherry picked from commit 5e6a6abc07a4e2a8ec3d43e2521af444c97483c1)

6 months agoFix incorrect schema reference in root POST link 24/107524/7
Samuel Schneider [Thu, 24 Aug 2023 09:36:09 +0000 (11:36 +0200)]
Fix incorrect schema reference in root POST link

We are creating a root POST link, when requesting swagger document
for single module. We were passing empty string as module name
when building the POST operation, which resulted in our schema ref
beginning with underscore (like this: "_toaster_module").
The schema is created, but without the leading underscore.
The schema name was also incorrectly created (missing the "_config").

This patch fixes it by altering the api call to create the POST request
and by fixing the schema name.

JIRA: NETCONF-1133
Change-Id: I9019dea1874133706f8825b0159e6c571d7b9558
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
(cherry picked from commit 49e965432e29092aa8aa3ffb64a5875632e3c255)

7 months agoRemove _XML and _POST containers from OpenApi 68/107568/1
Peter Suna [Mon, 27 Mar 2023 11:38:29 +0000 (14:38 +0300)]
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>
(cherry picked from commit cc6f8b0d874209c1888b3da2d4e5f448a068d3cc)

7 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)

7 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)

8 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)

8 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>
8 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)

8 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>
9 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)

9 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)

9 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)

9 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)

9 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)

9 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)

9 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)

9 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)

10 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>
10 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)

10 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>
10 months agoRelease netconf v4.0.7
jenkins-releng [Wed, 31 May 2023 13:20:07 +0000 (13:20 +0000)]
Release netconf

10 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>
10 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)

10 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)

10 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>
10 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)

11 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)

11 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

14 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>
15 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)

15 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>