netconf.git
6 months agoEliminate RestconfSchemaServiceImpl 52/109052/5
Robert Varga [Thu, 23 Nov 2023 10:47:33 +0000 (11:47 +0100)]
Eliminate RestconfSchemaServiceImpl

RestconfSchemaServiceImpl is serving YANG/YIN schema sources. While this
capability is not standardized, integrate it into RestconfServer as
modules{Yin,Yang}GET().

This turns out to be a major refactor, as the implementation was shoddy
-- it required local DOMSchemaService to expose
DOMYangTextSourceProvider extension and then it used that when talking
to mount points.

This refactor integrates the ability to lookup sources into
DatabindContext, with the corresponding DOMDatabindProvider wiring. If
no DOMYangTextSourceProvider is present, we call back to using
YangTextSnippet.

JIRA: NETCONF-773
Change-Id: I57689b2915eda0486c0bb5d5ba6de992b3107c0b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoFix channel inactive handling for SSH transport 46/109046/5
Ruslan Kashapov [Wed, 22 Nov 2023 10:21:05 +0000 (12:21 +0200)]
Fix channel inactive handling for SSH transport

Channel inactive handler require to re-transfer the event
down the pipeline in order for subsequent handler to be
triggered as well. SSH transport pipeline did contain two
channel inactive handlers both terminating the event
resulting *NetconfSession not handling channel termination
properly.

Fixed, case covered by test.

JIRA: NETCONF-1200
Change-Id: I2a78709909e1b8509b562a8fa0bf640c45c91432
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoEliminate JaxRsApiPath 59/109059/3
Robert Varga [Fri, 24 Nov 2023 17:06:15 +0000 (18:06 +0100)]
Eliminate JaxRsApiPath

Bouncing through JaxRsApiPath is not entirely optimal, as we need to
expose that class -- which really is an implementation detail.

Eliminate the class in favor of JaxRsRestconf implementing
ParamConverterProvider for ApiPath.

While we could provide this support as an external component, inlining
it in JaxRsRestconf, which is the only relevant user, has the added
benefit of suppressing Jersey warnings about the resource not providing
any provider interfaces.

JIRA: NETCONF-1157
Change-Id: Id3d1cc5acf764bc03a46f792b3d8c2bf72c5bd85
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoFix /operations indexing 61/109061/2
Robert Varga [Fri, 24 Nov 2023 17:44:48 +0000 (18:44 +0100)]
Fix /operations indexing

Guava's Table does not work for indexing here, as it cannot support null
keys, which we require for storing Revision. Switch to using explicit
nested maps.

JIRA: NETCONF-773
Change-Id: I5812191a070eb9e631afd962ecf1d99e537f3fc3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoAdd FIXMEs 60/109060/2
Robert Varga [Fri, 24 Nov 2023 17:22:48 +0000 (18:22 +0100)]
Add FIXMEs

ETag and Last-Modified should be part of the response payload maintained
on RestconfServer side. Add FIXMEs to reflect that.

JIRA: NETCONF-773
Change-Id: Ice8369fb6545569477a137079691c79e55f32927
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoFix operations{Json,Xml}GET definition 58/109058/4
Robert Varga [Fri, 24 Nov 2023 15:55:26 +0000 (16:55 +0100)]
Fix operations{Json,Xml}GET definition

AsyncResponse should be @Suspended, otherwise we get a warnings from
Jersey that "A HTTP GET method, ..., should not consume any entity."

JIRA: NETCONF-773
Change-Id: I6ad989ae7bd8cd6a0303945d2bf6040c6fea8a5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoFix JaxRsApiPath declaration 57/109057/4
Robert Varga [Fri, 24 Nov 2023 15:42:09 +0000 (16:42 +0100)]
Fix JaxRsApiPath declaration

We are using this class to define our mapping, which means its
constructor must be public. Fixes Jersey reporting "No injection source
found for a parameter of type" fatal message.

JIRA: NETCONF-1157
Change-Id: I75031376ce3ee453d9a5d60b7917c34e57c831fe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoApiPath is a HierarchicalIdentifier 43/109043/4
Robert Varga [Wed, 22 Nov 2023 03:05:30 +0000 (04:05 +0100)]
ApiPath is a HierarchicalIdentifier

ApiPath is essentially a counterpart to YangInstanceIdentifier -- hence
it should provide same services.

JIRA: NETCONF-773
Change-Id: I1d35e43723c484a99c2630f81129ee43222c60b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoSwitch RestconfSchemaServiceImpl to RestconfFuture 48/109048/5
Robert Varga [Wed, 22 Nov 2023 04:47:34 +0000 (05:47 +0100)]
Switch RestconfSchemaServiceImpl to RestconfFuture

We want to have async execution as we really can execute async method --
for example from SchemaSources. This is the first step, converting to
use RestconfFuture.

JIRA: NETCONF-718
Change-Id: Icf1c6bb505ba8dc37d78a248fe400690d49dfc3b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRelocate ParserIdentifier methods 44/109044/4
Robert Varga [Wed, 22 Nov 2023 03:18:34 +0000 (04:18 +0100)]
Relocate ParserIdentifier methods

Vast majority of methods here are implementation details of
RestconfSchemaServiceImpl. Move them there.

JIRA: NETCONF-773
Change-Id: I95836e3f6ee99f91c755f19ced3b3205ab2f7b56
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoClean up SchemaExportContext 42/109042/3
Robert Varga [Wed, 22 Nov 2023 01:55:54 +0000 (02:55 +0100)]
Clean up SchemaExportContext

SchemaExportContext is an output payload and we certainly can implement
it better than we have so far.

This is a first pass doing two things:
- disconnecting SchemaExportContext from mdsal.dom.api
- switches to use EffectiveStatements instead of SchemaNodes

Change-Id: Ic8cba496d8667fedffb92f5c1c482b5070719f01
JIRA: NETCONF-773
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoMigrate RestconfValidationTest to JUnit5 41/109041/4
Robert Varga [Tue, 21 Nov 2023 17:18:40 +0000 (18:18 +0100)]
Migrate RestconfValidationTest to JUnit5

Migrate tests cases and improve assertions.

Change-Id: I8266abb1cbbcbb72a4a7635a0c21d26ac9a48c12
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoEliminate nb.rfc8040.rests.services.api 40/109040/4
Robert Varga [Tue, 21 Nov 2023 16:38:17 +0000 (17:38 +0100)]
Eliminate nb.rfc8040.rests.services.api

This package contains just a specification and we can simply inline it
-- and move SchemaExportContext to nb.rfc8040.legacy pending further
refactor.

JIRA: NETCONF-773
Change-Id: Ia11b36dd66ca050cf8213d87e8d281250cd4de99
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRestconfServer requires ApiPath identifiers 70/107370/18
Robert Varga [Sun, 19 Nov 2023 20:37:21 +0000 (21:37 +0100)]
RestconfServer requires ApiPath identifiers

Parsing the request URL is the responsibility of the caller, hence we
should accept an ApiPath, not a plain String.

JAX-RS implementation uses JaxRxApiPath's default constructor to bind
with @PathParam semantics and report BadRequestException if anything
goes wrong.

JIRA: NETCONF-1157
Change-Id: Ie9dc79d30cbb4ea52643403f2762090a5e3b3aeb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoRemove ParserIdentifier.makeQNameFromIdentifier() 39/109039/2
Robert Varga [Tue, 21 Nov 2023 16:28:49 +0000 (17:28 +0100)]
Remove ParserIdentifier.makeQNameFromIdentifier()

This method is used only in its associated tests, remove it and the
tests.

JIRA: NETCONF-1157
Change-Id: I15dc458ff6153376fd3eec22ab7cd6abd4e6e204
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoClean up ParserIdentifierTest 38/109038/5
Robert Varga [Tue, 21 Nov 2023 15:36:48 +0000 (16:36 +0100)]
Clean up ParserIdentifierTest

Clean up and improve assertions.

JIRA: NETCONF-1157
Change-Id: I15559113861fadd09f0feb8ad2781901f9d507dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoImprove RestconfSchemaServiceTest 37/109037/2
Robert Varga [Tue, 21 Nov 2023 15:26:57 +0000 (16:26 +0100)]
Improve RestconfSchemaServiceTest

Add more assertions and perform general clean ups.

JIRA: NETCONF-1157
Change-Id: I3decca5b6dfeca2ab35adebbafdc73b086dbdb07
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoCreate tests for PUT "insert" query parameter 96/108296/9
Yaroslav Lastivka [Thu, 5 Oct 2023 10:49:45 +0000 (13:49 +0300)]
Create tests for PUT "insert" query parameter

Created UT for PUT requests with: insert=last, insert=first,
insert=before, insert=after query parameters.

JIRA: NETCONF-1163
Change-Id: I80f55f0d3f5d91535dccce7c43e7581b3de6feb5
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
6 months agoUse Timer in NetconfNodeHandler 85/108985/4
Robert Varga [Thu, 16 Nov 2023 12:40:03 +0000 (13:40 +0100)]
Use Timer in NetconfNodeHandler

We are using ScheduledExecutorService to scheduler timers. Since we are
already passing down Timer to other timeouts, also migrate
NetconfNodeHandler to use it.

JIRA: NETCONF-1106
Change-Id: I7b231cd4c91b67eff8c8937124a04338ffc8bbe0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoEliminate space escaping 30/109030/6
Robert Varga [Mon, 20 Nov 2023 13:41:36 +0000 (14:41 +0100)]
Eliminate space escaping

We want to be spec-compliant, and a simple space is not a special
character, so we should not be escaping it on output.

Fixup tests which require us escaping spaces and convert them to JUnit5.

JIRA: NETCONF-1157
Change-Id: Id550a4f9d17b77bec3fbb12de89bbf1f775b8e8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoUse Timer for KeepaliveSalFacade 82/108982/6
Robert Varga [Wed, 15 Nov 2023 17:10:42 +0000 (18:10 +0100)]
Use Timer for KeepaliveSalFacade

Our timers typically do not get to fire, which means our performance is
dominated by task setup/teardown.

Improve this by using a Netty Timer, which is optimized for timeouts
which do not typically occur.

JIRA: NETCONF-1199
Change-Id: Iabb89f863a8c447f0e9fcc6981127893f8aa255f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoEstablish ietf-yang-library revision from model context 17/108917/11
Robert Varga [Fri, 10 Nov 2023 13:46:55 +0000 (14:46 +0100)]
Establish ietf-yang-library revision from model context

Rather than hard-coding, report the latest revision available in the
context.

JIRA: NETCONF-773
Change-Id: I0981b6efba576b393eea1f43db5417df4cf3b527
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
6 months agoAdd ApiPath.toString() 28/109028/3
Robert Varga [Mon, 20 Nov 2023 10:21:46 +0000 (11:21 +0100)]
Add ApiPath.toString()

We are about to push ApiPath deeper into stack. This requires reporting
ApiPath values to end user -- for which we need a toString() method.

This rehosts PERCENT_ESCAPER, as we really need it to emit key values.

JIRA: NETCONF-1157
Change-Id: Ia602dacc78eb9f6b0edd9801998dcc5bd60817ea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoOpenApi: Do not introduce JUnit 4 31/109031/3
Ivan Hrasko [Mon, 20 Nov 2023 13:48:15 +0000 (14:48 +0100)]
OpenApi: Do not introduce JUnit 4

Do not use JUnit 4 AfterClass annotation with our JUnit 5 test cases.

JIRA: NETCONF-938
Change-Id: Ie959671a110ba37da6f87410edbd4493766d6612
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
6 months agoUpdate ietf-yang-library to 2019-01-04 81/108981/9
Ivan Hrasko [Wed, 15 Nov 2023 16:43:57 +0000 (17:43 +0100)]
Update ietf-yang-library to 2019-01-04

Update ietf-yang-library to 2019-01-04 where needed.
It is also required to add ietf-datastores, ietf-inet-types
and ietf-yang-types as its dependency.

Remove ietf-yang-library YANG model where the module is not needed.
It means its not required in effective model context and/or not
expected by tests.

Change-Id: I34c854cebabeedd19ce4ec3a5ab1d7ef2eb91b24
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
6 months agoOpenApi: Rework tests to parameterized 07/108707/5
lubos-cicut [Fri, 27 Oct 2023 21:10:59 +0000 (23:10 +0200)]
OpenApi: Rework tests to parameterized

Reworked tests which are expecting JSON output to paramaterized and
reduced code duplications.

JIRA: NETCONF-938
Change-Id: I98d5d4725811da42c630f779f65d4c447afc7fdc
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
6 months agoOpenApi: Improve test coverage 86/108686/7
lubos-cicut [Thu, 26 Oct 2023 13:55:22 +0000 (15:55 +0200)]
OpenApi: Improve test coverage

Created new tests which are expecting JSON outputs. Created suites for
models we are using in current unit tests.

JIRA: NETCONF-938
Change-Id: I8445ac3754b9e4cb604be36f517f1b75abfc27e6
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
6 months agoRestconfServer is strictly asynchronous 26/109026/3
Robert Varga [Sun, 19 Nov 2023 19:23:40 +0000 (20:23 +0100)]
RestconfServer is strictly asynchronous

Make sure all methods are returning RestconfFuture, meaning everything
is potentially asynchronous and every call fail in a well-documented
way.

Take the time to create an assertion framework in AbstractRestconfTest,
which makes testing easy and understandable.

JIRA: NETCONF-718
Change-Id: I852f78568ed14ba527284cf835bfdee5ec024452
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 months agoAnnotate RestconfFuture returns 25/109025/2
Robert Varga [Sun, 19 Nov 2023 19:22:29 +0000 (20:22 +0100)]
Annotate RestconfFuture returns

Both of() and failed() are returing a non-null instance, annotate that
fact.

Change-Id: I1462b99224d0ec5a2ee8f613f314817ef5e5db9e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMove DOMDatabindProvider 22/109022/3
Robert Varga [Sat, 18 Nov 2023 04:41:55 +0000 (05:41 +0100)]
Move DOMDatabindProvider

DOMDatabindProvider is a logical part of MD-SAL-based server, move it to
server.mdsal. Also document restconf.server.mdsal package a bit.

JIRA: NETCONF-773
Change-Id: Idf72b75eeadf9953d69caf5925f276261e380600
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoSplit up MediaTypes 21/109021/3
Robert Varga [Sat, 18 Nov 2023 04:34:04 +0000 (05:34 +0100)]
Split up MediaTypes

We really want two sets of independent constants:
- plain Strings in restconf.api.MediaTypes
- JAX-RS MediaTypes in restconf.nb.jaxrs

JIRA: NETCONF-773
Change-Id: I11fcf0694bd2d7d3d8f75024b3aa5a43f84c6b31
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoIntroduce restconf.nb.jaxrs package 20/109020/3
Robert Varga [Sat, 18 Nov 2023 04:06:49 +0000 (05:06 +0100)]
Introduce restconf.nb.jaxrs package

We have reached a place where we can clean up JAX-RS northbound
components without worrying about weird dependencies.

Refactor RestconfImpl into restconf.nb.jaxrs.JaxRsRestconf.

JIRA: NETCONF-773
Change-Id: I75dbe87f2276be12157616779ec78b988863daac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMove MdsalRestconfServer 19/109019/4
Robert Varga [Sat, 18 Nov 2023 02:31:30 +0000 (03:31 +0100)]
Move MdsalRestconfServer

MdsalRestconfServer is now properly isolated, move it to
restconf.server.mdsal.

This hides getStrategy() from tests, which is forcing us to convert them
to proper end-to-end integration tests.

JIRA: NETCONF-773
Change-Id: I5e2729f2b9113d610886972cb7a50f28e40bcd4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoIntroduce RestconfServer.dataPOST() 18/109018/3
Robert Varga [Sat, 18 Nov 2023 02:01:23 +0000 (03:01 +0100)]
Introduce RestconfServer.dataPOST()

POST on /data has two modes, Invoke Operation and Create Resource,
which we can neatly capture in RestconfServer.

This eliminates the final bits of RestconfDataServiceImpl, completing
indirection through RestconfServer.

JIRA: NETCONF-773
Change-Id: I7338d6f49688bc2769a1fc5e952553478566965a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoAdd DataPostResult 17/109017/4
Robert Varga [Fri, 17 Nov 2023 23:44:19 +0000 (00:44 +0100)]
Add DataPostResult

POST to /data can result in multiple different results. Add
DataPostResult encapsulate the possiblities.

Also introduce CreateResource, which is the result of POST in Operation
Create Mode -- moving some of the worries away from JAX-RS layer's
postData().

JIRA: NETCONF-773
Change-Id: I56dcde72630d53290f002e9b6258924175bb3072
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMore NetconfCommandUtils cleanup 23/109023/2
Robert Varga [Sat, 18 Nov 2023 07:52:34 +0000 (08:52 +0100)]
More NetconfCommandUtils cleanup

We have forgotten a commented-out block of code. Eliminate it and
simplify isIpValid().

Change-Id: I051d1114f142f92a91eb429ff036f5985476b046
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRename OperationsContent 16/109016/2
Robert Varga [Fri, 17 Nov 2023 23:08:07 +0000 (00:08 +0100)]
Rename OperationsContent

A better name for this interface is OperationsGetResult, mirroring
DataPutResult.

JIRA: NETCONF-773
Change-Id: Ic00d867373fd635ac2d7de78d6d87100a8a433c3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoIntroduce RestconfServer.dataPUT() operations 15/109015/3
Robert Varga [Fri, 17 Nov 2023 21:46:07 +0000 (22:46 +0100)]
Introduce RestconfServer.dataPUT() operations

Migrate PUT operations on /data to MdsalRestconfServer/RestconfImpl.
This temporarily duplicates Insert parsing logic, which will be
eliminated in a follow-up patch.

JIRA: NETCONF-773
Change-Id: I8692fede3238cdcca283dfc7d9bc8e123b18aea7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoIntroduce RestconfServer methods for YANG Patch 14/109014/2
Robert Varga [Fri, 17 Nov 2023 19:50:11 +0000 (20:50 +0100)]
Introduce RestconfServer methods for YANG Patch

YANG Patch is a quite simple request, easily defined by RestconfServer.
This allows us to rehost JAX-RS methods to RestconfImpl.

JIRA: NETCONF-773
Change-Id: I8532685a52f7b4989125f52c758c956faebe41ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up getStatusCode() 13/109013/5
Robert Varga [Fri, 17 Nov 2023 19:10:32 +0000 (20:10 +0100)]
Clean up getStatusCode()

Do not use else branches and simplify error evaluation. Rename it ot
statusOf() and put it into JaxRsCallback which is using it.

JIRA: NETCONF-773
Change-Id: I8e40f87f174a1ab62b6c5d9188f202a5f85f6028
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoAdd RestconfServer.dataPATCH() 12/109012/2
Robert Varga [Fri, 17 Nov 2023 19:02:33 +0000 (20:02 +0100)]
Add RestconfServer.dataPATCH()

Plain patch method is a rather simple operation, define it in
RestconfServer and migrate JAX-RS implementation to RestconfImpl.

JIRA: NETCONF-773
Change-Id: I26be45eb6eaa77d52df6197bcb43a6d0ee12df94
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoAdd RestconfServer.dataDELETE() 11/109011/2
Robert Varga [Fri, 17 Nov 2023 18:22:45 +0000 (19:22 +0100)]
Add RestconfServer.dataDELETE()

Add a the delete operation and move its implementation into
RestconfImpl. Also unify test mocking.

JIRA: NETCONF-773
Change-Id: Iecbe8219fdd72266b78e466859b593ff341f177b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMove bindResourceRequest() 10/109010/3
Robert Varga [Fri, 17 Nov 2023 17:34:12 +0000 (18:34 +0100)]
Move bindResourceRequest()

This is a shared utility method destined to become an implementation
detail. Move it to MdsalRestconfServer.

JIRA: NETCONF-773
Change-Id: I819412e8dc9cabffaf01558b658ee5f6b892a3cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMove /data GET methods to RestconfImpl 09/109009/2
Robert Varga [Fri, 17 Nov 2023 16:41:15 +0000 (17:41 +0100)]
Move /data GET methods to RestconfImpl

The methods are extremely simple wrappers around RestconfServer, move
them to RestconfImpl. Also splits up the related tests, migrating them
to JUnit5.

JIRA: NETCONF-773
Change-Id: I73bbbadcdd02cbca703cae290e3e779911c2295a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoIntroduce asynchronous RestconfServer.readData() 08/109008/3
Robert Varga [Fri, 17 Nov 2023 15:49:45 +0000 (16:49 +0100)]
Introduce asynchronous RestconfServer.readData()

Refactor logic so as to reside in MdsalRestconfServer, interfaced with
RestconfFuture -- which is forcing us to use AsyncResponse.

JIRA: NETCONF-773
JIRA: NETCONF-1155
Change-Id: Idc8207f0c2ac4486f9382d1649131852e76e5965
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMove action invocation to MdsalRestconfServer 07/109007/4
Robert Varga [Fri, 17 Nov 2023 15:06:00 +0000 (16:06 +0100)]
Move action invocation to MdsalRestconfServer

This code is quite clear-cut and JAX-RS free, move it to
MdsalRestconfServer. The actual interface is still TBD.

This allows us to clean up JaxRsNorthbound of quite a few unnecessary
services.

JIRA: NETCONF-773
Change-Id: If030a80eaab55dd4cb5ccc6889c94b7cc06e97cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoEliminate RestconfOperationsServiceImpl 06/109006/4
Robert Varga [Fri, 17 Nov 2023 14:26:03 +0000 (15:26 +0100)]
Eliminate RestconfOperationsServiceImpl

This class is a simple forwarded to MdsalRestconfServer, just like
RestconfImpl. Move all its methods to RestconfImpl, improving their
naming consistency.

JIRA: NETCONF-773
Change-Id: I04306d99473fcbbe8474026684b4d185a4cedb74
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoFix single-item OperationsContent 05/109005/5
Robert Varga [Fri, 17 Nov 2023 12:21:45 +0000 (13:21 +0100)]
Fix single-item OperationsContent

We are returning the wrong value when asked for a specific operation.
Fix that. Since we are here, also simplify XML emission to use simple
entries with default namespace -- making the output more consistent
between queries.

JIRA: NETCONF-773
Change-Id: I4cbb67278b9e2227f9b1b9272f066942d4c9108f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRefactor OperationsContent 02/109002/5
Robert Varga [Thu, 16 Nov 2023 23:26:47 +0000 (00:26 +0100)]
Refactor OperationsContent

Turn the enumeration into a plain DTO which can serialize itself into
XML/JSON -- allowing it to be promoted to restconf.server.api.

While we are in the area, fix the semantics here:
- do not consider ActionEffectiveStatement, as that is handled through
  a different service
- report 404 when the operation points to a non-RPC

JIRA: NETCONF-773
Change-Id: I69fd5865c89ea2b727befdf4cedb8cddf8418002
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRehost OperationsContent.bodyFor() 01/109001/2
Robert Varga [Thu, 16 Nov 2023 23:04:15 +0000 (00:04 +0100)]
Rehost OperationsContent.bodyFor()

Rehost formatting logic to MdsalRestconfServer, reducing API/impl
friction.

JIRA: NETCONF-773
Change-Id: Ib0fdebad4ff8c7f4309eace3e177707a873288bb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoCodify operationsGET 00/109000/2
Robert Varga [Thu, 16 Nov 2023 22:23:18 +0000 (23:23 +0100)]
Codify operationsGET

GET on /operations is well-defined, express it in RestconfServer,
migrating callers of OperationsContent.bodyFor().

JIRA: NETCONF-773
Change-Id: I64b713fdddac2dc3b1e4166a26ea554d23e3cfa1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDocument RestconfServer.invokeRpc() 99/108999/2
Robert Varga [Thu, 16 Nov 2023 21:31:34 +0000 (22:31 +0100)]
Document RestconfServer.invokeRpc()

This should be called operationsPOST() to keep with flexible naming.
Document the behaviour and tie it to RFC8040.

JIRA: NETCONF-773
Change-Id: I05f77706de74e7fb2af57060317246d7773e92ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoCodify RestconfServer.yangLibraryVersionGET() 98/108998/1
Robert Varga [Thu, 16 Nov 2023 21:01:34 +0000 (22:01 +0100)]
Codify RestconfServer.yangLibraryVersionGET()

The inquiry to the supported ietf-yang-library version is a well-defined
RESTCONF operation. Codify our implementations through RestconfServer.

JIRA: NETCONF-773
Change-Id: Ie969a9d4897c232769005d3c628826401febecbe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up wadl-generator 97/108997/1
Robert Varga [Thu, 16 Nov 2023 20:36:24 +0000 (21:36 +0100)]
Clean up wadl-generator

Migrate to JUnit5 and clean up reported issues.

Change-Id: I058f3bb07a2d0b33d6a228ee967eaaac1af3baaa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up netconf-console 96/108996/1
Robert Varga [Thu, 16 Nov 2023 19:25:55 +0000 (20:25 +0100)]
Clean up netconf-console

This is all-round cleanup of the component, including migration to
JUnit5.

Change-Id: I53275bd2bf4edd794a796938c5f58e1d4763aa8b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoCleanup netconf-console dependencies 95/108995/1
Robert Varga [Thu, 16 Nov 2023 18:27:44 +0000 (19:27 +0100)]
Cleanup netconf-console dependencies

We have a ton of warnings here, clean up -- most notably ditching
dependency on org.apache.karaf.shell.console.

Change-Id: Iea280b000d5e8b3f75285646c64a20933a851db5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMigrate netconf-api to JUnit5 94/108994/1
Robert Varga [Thu, 16 Nov 2023 18:11:33 +0000 (19:11 +0100)]
Migrate netconf-api to JUnit5

This is a rather trivial conversion, including obvious cleanups.

Change-Id: I25534008ef4b226fdd934abc89f43cd45e470392
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMigrate netconf-nb to JUnit5 91/108991/1
Robert Varga [Thu, 16 Nov 2023 17:30:34 +0000 (18:30 +0100)]
Migrate netconf-nb to JUnit5

This is a simple test migrate it, updating mocking to eliminate
superfluous runs.

Change-Id: I7d89def26c6dfc84c870bf0289965e73b4fe46d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDisconnect netconf-topology-singleton from EventExecutor 83/108983/1
Robert Varga [Thu, 16 Nov 2023 08:57:58 +0000 (09:57 +0100)]
Disconnect netconf-topology-singleton from EventExecutor

EventExecutor is no longer used. Remove references to it and clean up
NetconfTopologySetupBuilder.

JIRA: NETCONF-1106
Change-Id: Icd9319ee527abe50af06d903a8b74937ae0a4858
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoDisconnect netconf-topology from threadpool-config-api 05/108905/8
Robert Varga [Wed, 15 Nov 2023 15:14:33 +0000 (16:14 +0100)]
Disconnect netconf-topology from threadpool-config-api

We are just a simple user of thread pools here, make sure we do not rely
on specific details how the pools are created.

Also cleans up future handling within NetconfNodeHandler, paving the way
for further refinement.

JIRA: NETCONF-590
Change-Id: I94ca12604947d32a632fa8e846d052ad93ce4543
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up AbstractWriteTx 72/108972/3
Robert Varga [Wed, 15 Nov 2023 12:25:27 +0000 (13:25 +0100)]
Clean up AbstractWriteTx

Do not invoke init() directly from constructor is bad. Refactor the code
to have callers invoke init() as needed.

While we are at it, use Registration instead of AutoCloseable and use
assertThrows() instead of legacy Test(expected).

Change-Id: I7373d91ceedd07e138577e563776e881acc295c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean-up AbstractRestconfStreamRegistryTest 71/108971/3
Samuel Schneider [Wed, 15 Nov 2023 11:58:19 +0000 (12:58 +0100)]
Clean-up AbstractRestconfStreamRegistryTest

Remove unused methods from AbstractRestconfStreamRegistryTest.
Test which was using these methods was removed by:
https://git.opendaylight.org/gerrit/c/netconf/+/107210
also with the tested method/class.

The tested method was marked as @VisibleForTesting and the
original functionality is no longer present.

JIRA: NETCONF-1196
Change-Id: I05933b916af0019e0f07927b3658f198aaea1741
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
7 months agoTear down NETCONF session on keepalive timeout 00/108200/14
Robert Varga [Wed, 15 Nov 2023 11:03:53 +0000 (12:03 +0100)]
Tear down NETCONF session on keepalive timeout

The keepalive mechanism guards user-level invocations from timeouts, but
does not proactively react to the device failing to respond to the
keepalive request itself.

Fix this by adding a timeout for the keepalive request as well.

JIRA: NETCONF-966
Change-Id: I39f8ba16a3f85c450f601f0ce42201e2bdccc1d0
Signed-off-by: Martin Sunal <martin@paxet.io>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up RequestTimeoutTask 65/108965/2
Robert Varga [Wed, 15 Nov 2023 10:26:44 +0000 (11:26 +0100)]
Clean up RequestTimeoutTask

There is no point in cancelling the user future or re-enabling
keepalives, as we will do that when our onFailure() callback is invoked.

Change-Id: Ibdeddf1140b8e77e70d90e74ade23ac976fbc233
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoInvert enableKeepalive() check 64/108964/1
Robert Varga [Wed, 15 Nov 2023 10:06:55 +0000 (11:06 +0100)]
Invert enableKeepalive() check

Invert if/else condition to remove a negation.

Change-Id: I5af0c9fd49df39487b822ad151135f5aff8a3eb2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRemove unused suppressions 63/108963/1
Robert Varga [Wed, 15 Nov 2023 09:47:48 +0000 (10:47 +0100)]
Remove unused suppressions

SpotBugs is now better at analyzing nulls, hence we do not need these
suppressions.

Change-Id: I9e7835e5657a1d29ee967f0cdf3eb914cb843a86
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRemove JaxbContextResolver class 30/106430/4
Ivan Hrasko [Thu, 8 Jun 2023 13:19:42 +0000 (15:19 +0200)]
Remove JaxbContextResolver class

This class only provides unused ObjectMapper. Remove it.

Change-Id: I057f6be8fdcb979436576a3b2bbf41a62e48f305
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoMigrate test-tool StressClient to transport-api 62/108662/5
Ruslan Kashapov [Thu, 26 Oct 2023 07:17:22 +0000 (10:17 +0300)]
Migrate test-tool StressClient to transport-api

JIRA: NETCONF-1108
Change-Id: I7517bc2c2e69303fc853198ca59cdd4247cea556
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
7 months agoCall-home with ext service integration for TLS transport 91/108591/5
Ruslan Kashapov [Mon, 3 Jul 2023 14:51:49 +0000 (17:51 +0300)]
Call-home with ext service integration for TLS transport

Call-home test case added.

JIRA: NETCONF-1183
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Change-Id: Iff4fd61d10d62ead28ad48e5ac67f3cfd25ecaab

7 months agoMigrate netconf-topology to new transport 53/108253/18
Ruslan Kashapov [Mon, 23 Oct 2023 09:38:37 +0000 (12:38 +0300)]
Migrate netconf-topology to new transport

Deprecated NetconfClientDispatcher was replaced with
NetconfClientFactory for further migration. The call-home
components were updated only as ancestor component,
reflecting api changes.

JIRA: NETCONF-1108
Change-Id: Iade4fcaf0680d58319427020d1b1894e3c6ac75e
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoExt service integration support for Netconf SSH client 99/108499/10
Ruslan Kashapov [Wed, 18 Oct 2023 14:21:51 +0000 (17:21 +0300)]
Ext service integration support for Netconf SSH client

Netconf topology and call-home components are using
own services for authorization, configuration only
approach for ssh client is not sufficient.

JIRA: NETCONF-1108
Change-Id: Iac63445067b235437ebf6d2c06df7f9f22acbf89
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
7 months agoExt service integration support for SSH client 98/108498/11
Ruslan Kashapov [Mon, 3 Jul 2023 14:51:49 +0000 (17:51 +0300)]
Ext service integration support for SSH client

Netconf topology and call-home components are using
own services for authorization, configuration only
approach for ssh client is not sufficient.

JIRA: NETCONF-1108
Change-Id: Ie7ef8a60c21204ad9df69964423c451291d4ee77
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
7 months agoWire RestconfImpl to MdsalRestconfServer 10/108910/6
Robert Varga [Fri, 10 Nov 2023 09:01:08 +0000 (10:01 +0100)]
Wire RestconfImpl to MdsalRestconfServer

Our databind operations should strictly go through server, as that
is the true backed for everything. Update RestconfImpl to defer to
server. Also clean up code a bit.

JIRA: NETCONF-773
Change-Id: I85b965d3dd301e0e2d6209d08aeebd8ebed44afd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoClose device's source resolution on teardown 67/108167/15
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
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>
7 months agoDitch threadpool-config-api from netconf-server 04/108904/5
Robert Varga [Fri, 10 Nov 2023 01:26:41 +0000 (02:26 +0100)]
Ditch threadpool-config-api from netconf-server

Use direct integration with ScheduledExecutorService in a purely user
role.

JIRA: NETCONF-1106
Change-Id: Id624b8b27287fb268fae5435a705db23ed1cf819
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoAdapt netconf testtool for login-password removal 11/108911/3
Samuel Schneider [Fri, 10 Nov 2023 09:37:36 +0000 (10:37 +0100)]
Adapt netconf testtool for login-password removal

Adapt netconf testtool for removal of deprecated way of configuring
login/password (unencrypted) from odl-netconf-device YANG file.

JIRA: NETCONF-1198
Change-Id: Ibf5ca9fad8d88fceac6b6a79e449caf6f472429e
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
7 months agoEliminate RestconfInvokeOperationsServiceImpl 06/108906/2
Robert Varga [Fri, 10 Nov 2023 05:46:28 +0000 (06:46 +0100)]
Eliminate RestconfInvokeOperationsServiceImpl

This class handles only POST, merge it into
RestconfOperationsServiceImpl, which already handles GET.

JIRA: NETCONF-773
Change-Id: I1f61c4957c04f05333ec6438c85b356f3c1642eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoIntroduce restconf.server.{api,spi,mdsal} 77/108877/11
Robert Varga [Wed, 8 Nov 2023 06:44:48 +0000 (07:44 +0100)]
Introduce restconf.server.{api,spi,mdsal}

This patch refactors restconf-nb wiring by introducing:
- RestconfServer, capable of invokeRpc()
- RestconfStreamRegistry, being the public interface to ListenersBroker
- RpcImplementation, being a native RestconfServer RPC invocation interface

This allows us to split out RPCs and logic for individual
RestconfStream.Sources -- which now become normal components injected
into MdsalRestconfServer.

This necessitates dealing with the fact that ListenerBroker requires
configuration. We take this on by splitting Config Admin interactions
into OSGiNorthbound, which then instantiates components based on
configuration.

After the dust settles, we end up ditching a controller dependency and
have a pretty crisp model of what gets done where and how.

JIRA: NETCONF-773
Change-Id: I3ea139dd811b487d676353adf075dcb102abc0c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoExpose streams with all supported encodings 64/108864/12
Robert Varga [Mon, 6 Nov 2023 14:17:14 +0000 (15:17 +0100)]
Expose streams with all supported encodings

The entire idea of output-type for a stream is wrong. The user can
choose which encoding to pick based on operational datastore -- and
there we expose all encodings.

This requires a rather major refactor to deal with stream lifecycle:
- RestconfStream is the central point
- RestconfStream.Source is a source of events -- notifications, DTCL
- RestconfStream.Source.start() is invoked when the first subscriber
  arrives
- RestconfStream.Source is stopped when the last subscriber disappears
- both sides can terminate the stream

JIRA: NETCONF-1102
Change-Id: I6f7a196195ac96706c3c6b1797350e5fd96b261e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoFix JSON and XML PatchBodyWriter errors output 87/107687/21
Matej Sramcik [Mon, 4 Sep 2023 07:58:51 +0000 (09:58 +0200)]
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>
7 months agoAdd correct status code to YangPatch 80/108880/4
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
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
7 months agoRemove obsoleted way of configuring password 49/108349/8
Robert Varga [Wed, 11 Oct 2023 12:40:32 +0000 (14:40 +0200)]
Remove obsoleted way of configuring password

We are removing the possibility to configure device's password
as plain text which has been deprecated and obsoleted in NETCONF 6.

JIRA: NETCONF-1187
Change-Id: I1a753dc89add34727a31f7fde723ac75b6327975
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
7 months agoFix OpenApi ignoring min-elements for list 78/108878/3
Matej Sramcik [Wed, 8 Nov 2023 10:25:23 +0000 (11:25 +0100)]
Fix OpenApi ignoring min-elements for list

Replace orElse(null).get() with orElseThrow().get() because
it can produce NullPointerException

JIRA: NETCONF-1172
Change-Id: If0b48b474f6a3e6ed4f6b939b9f5a0709c0244a7
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
7 months agoRefactor EventFormatter interface 76/108876/3
Robert Varga [Wed, 8 Nov 2023 00:52:48 +0000 (01:52 +0100)]
Refactor EventFormatter interface

We have some amount of method duplication and tangling. Move methods
around and clean them up.

JIRA: NETCONF-1102
Change-Id: Ica1af471d1c035142a77bfba14d94ebde624438a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoPopulate restconf-state/streams 75/108875/2
Robert Varga [Tue, 7 Nov 2023 19:17:08 +0000 (20:17 +0100)]
Populate restconf-state/streams

ListenersBroker needs to manage restconf-state/streams, so users
can locate the endpoint servicing each stream.

Pick up the required pieces from RestconfStateStreams and surrounding
commented-out code to generate proper entries.

Also clean up tests, so that we have nice and crispy test suite, without
duplications and asserting proper changes.

JIRA: NETCONF-1102
Change-Id: Ifddb9fba119e6580ac9cb1c6377b63285d8d6cb0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoImprove subscriber tracking 31/108831/12
Robert Varga [Fri, 3 Nov 2023 07:06:15 +0000 (08:06 +0100)]
Improve subscriber tracking

Create a dedicated immutable Subscribers object, which tracks handlers
and their corresponding formatters.

Subscribers are structured, so multiple subscribers with the same
formatter with reuse the same formatted message.

Each RestconfStream starts with Subscribers.empty(), indicating a first
subscriber is required. When we lose the last subscriber, Subscribers
will become null and we trigger stream removal.

This improves on the HashSet tracking in terms of memory footprint, as
we typically will have 0 or 1 subscribers.

The newly introduced indirection through Subscriber allows the
subscriber to dictate the actual formatter which we will use in upcoming
patches.

JIRA: NETCONF-1102
Change-Id: I75e581ed7615b883e65ea60285cd4c1ba09d109e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoRefactor EventFormatter constants 51/108851/3
Robert Varga [Sat, 4 Nov 2023 00:54:23 +0000 (01:54 +0100)]
Refactor EventFormatter constants

NotificationFormatter currently hosts a few constants which are really
unrelated to its operation. Move them to the appropriate places.

JIRA: NETCONF-1102
Change-Id: I04d1ed574d7d8fb8bf0a431d3fbba367e894ac9f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoAllow RestconfStream to advertize multiple encodings 50/108850/2
Robert Varga [Sat, 4 Nov 2023 00:03:23 +0000 (01:03 +0100)]
Allow RestconfStream to advertize multiple encodings

Each stream can have multiple encodings -- which we currently do not
support, as we have a singular outputType.

Introduce EncodingName and the ability for RestconfStream to advertize
all encodings it supports. This paves the way for transport components
to select the encoding based on subscriber preferences.

JIRA: NETCONF-1102
Change-Id: I9dbe6f7a0805668e2bbaf18d369c709e71e341f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoMove restconfStateStreamPath() 49/108849/1
Robert Varga [Fri, 3 Nov 2023 22:37:02 +0000 (23:37 +0100)]
Move restconfStateStreamPath()

Management of ietf-restconf streams is the domain of ListenersBroker,
move the constant and the single used utility method there.

JIRA: NETCONF-1102
Change-Id: Id44123f5409dd2507db8d55220f9daa8dda23351
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoUpdate sal-remote-augment model to rev 2023-11-03 48/108848/1
Robert Varga [Fri, 3 Nov 2023 22:23:51 +0000 (23:23 +0100)]
Update sal-remote-augment model to rev 2023-11-03

This brings a couple of changes:
- reformat to use two spaces instead of four
- eliminate unneeded things (like version 1)
- do not import-by-revision
- default datastore is CONFIGURATION, document that
- scope parameter is now obsolete as it is completely unused

JIRA: NETCONF-1102
Change-Id: Ifd4dc79575afbd2fb3f383fa8e210f47fecd1ac1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoClean up stream class names 47/108847/4
Robert Varga [Fri, 3 Nov 2023 21:28:24 +0000 (22:28 +0100)]
Clean up stream class names

ListenerAdapter, AbstractStream et al. have rather unfortunate names.

Fix this by renaming:
- AbstractStream to RestconfStream
- AbstractNotificationListenerAdaptor to AbstractNotificationStream
- DeviceNotificationListenerAdaptor to DeviceNotificatioNStream
- ListenerAdapter to DataTreeChangeStream
- NotificationListenerAdapter to NotificationStream

JIRA: NETCONF-1102
Change-Id: Ib42d89344079c9815a628d9353abea15c67a72d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoEliminate AbstractStream.setCloseVars() 46/108846/2
Robert Varga [Fri, 3 Nov 2023 21:17:08 +0000 (22:17 +0100)]
Eliminate AbstractStream.setCloseVars()

We are only setting the DatabindProvider, which is something we have
when we create the stream. Update class design to get the provider in
constructor.

JIRA: NETCONF-1102
Change-Id: Ic46ef9ffe3200e254601d9c65f5a35e3fc39ef4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoListenersBroker requires DOMDataBroker 40/108840/6
Robert Varga [Fri, 3 Nov 2023 11:16:58 +0000 (12:16 +0100)]
ListenersBroker requires DOMDataBroker

Managing the contents of the operation data store is the responsibility
of ListenersBroker, not individual streams. We therefore ListenersBroker
should have a reference to it directly and not have it passed through
from each stream.

JIRA: NETCONF-1102
Change-Id: I79523e139648eacb36def92f24253f79af81b021
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoUse random UUIDs for stream names 45/108845/1
Robert Varga [Fri, 3 Nov 2023 17:47:56 +0000 (18:47 +0100)]
Use random UUIDs for stream names

Deriving stream names from their parameters is rather tacky, as it opens
up race conditions, lifecycle leaks and the lure to try to parse the
names out.

This patch refactors the logic to split stream name allocation, which is
now random, and creation of the actual stream via StreamFactory.

Since we now know names cannot conflict and that each AbstractStream has
its name embedded, we can do away with BiMaps and StampedLocks and
instead keep all streams in a single ConcurrentMap.

We end up removing a ton of duplicated code, allowing us to focus on
the lifecycle itself.

This in turn shows that we do not have an end-of-stream indicator for
subscribers to see -- so introduce it and pick up the resulting
DeviceNotificationListenerAdaptor clean ups.

This refactor also shows that {Json,Xml}NotificationListenerTest are
only testing NotificationFormatter, so we rename them and migrate to
JUnit5.

JIRA: NETCONF-1102
Change-Id: I043bebbd9240281cda9e29b41881de43f0a6b769
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoEliminate CreateStreamUtil 38/108838/5
Robert Varga [Fri, 3 Nov 2023 09:44:47 +0000 (10:44 +0100)]
Eliminate CreateStreamUtil

Integrate the functionality into ListenerBroker, before we end up
splitting it out.

JIRA: NETCONF-1102
Change-Id: I57fafd28bc602d81e06780515cf66c6e26627013
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoFix OpenApi ignoring min-elements for list 56/108456/28
Matej Sramcik [Mon, 16 Oct 2023 12:37:38 +0000 (14:37 +0200)]
Fix OpenApi ignoring min-elements for list

If list have min-elements parameter, it is ignored and example with
only one element is created.
Edited definitionGenerator to adhere to the amount of min-elements,
also if parameter is defined as key, unique examples are created for
string and number types.

MinItems and maxItems values are missing in list property,
so they are added.

JIRA: NETCONF-1172
Change-Id: I5411fe6dd451a87fd7bfa53eb47206685aa624e7
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
7 months agoClose device handler when it fails to connect 41/108841/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
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoEliminate RestconfStreamsSubscriptionService 35/108835/6
Robert Varga [Fri, 3 Nov 2023 09:08:54 +0000 (10:08 +0100)]
Eliminate RestconfStreamsSubscriptionService

Move the code to ListenersBroker pending further refactors. Also move
and comment-out RestconfStreamsSubscriptionServiceImplTest.

JIRA: NETCONF-1102
Change-Id: Iebe56ae46455d707ce522e16d8d640246bccd8e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 months agoOpenApi: Document feature installation and usage 67/108467/11
Samuel Schneider [Mon, 16 Oct 2023 17:16:05 +0000 (19:16 +0200)]
OpenApi: Document feature installation and usage

Add dedicated paragraph into Netconf user guide which
document OpenApi feature installation and usage.

JIRA: NETCONF-1181
Change-Id: I46facaea023f9b981b12089448139affd336d7b2
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
7 months agoClean up restconf-nb dependencies a bit 34/108834/3
Robert Varga [Fri, 3 Nov 2023 06:52:28 +0000 (07:52 +0100)]
Clean up restconf-nb dependencies a bit

maven-dependency-plugin is complaining about a number of things, fix at
least model artifact references.

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