netconf.git
2 years agoBump versions to 2.0.2-SNAPSHOT 20/96920/1
Robert Varga [Mon, 19 Jul 2021 10:49:55 +0000 (12:49 +0200)]
Bump versions to 2.0.2-SNAPSHOT

This starts the next development iteration.

Change-Id: Icfc93a2326c62319d8e82008141c2b7c21409353
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump janino to 3.1.4 16/96916/1
Robert Varga [Mon, 19 Jul 2021 08:59:50 +0000 (10:59 +0200)]
Bump janino to 3.1.4

https://janino-compiler.github.io/janino/changelog.html

Change-Id: I40ce79d4001a10af6bedfaf8ff5657036d892a88
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoConvert netconf-client to OSGi DS 04/96904/6
Robert Varga [Fri, 16 Jul 2021 16:12:35 +0000 (18:12 +0200)]
Convert netconf-client to OSGi DS

This is a rather straighforward migration, but we also ditch the
now-unneeded Autocloseable from AbstractNetconfDispatcher.

JIRA: NETCONF-791
Change-Id: I4737ef30e0ff3b12bbaedcf8940edf80d8eb7d7a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDitch blueprint-maven-plugin 07/96907/2
Robert Varga [Fri, 16 Jul 2021 17:21:40 +0000 (19:21 +0200)]
Ditch blueprint-maven-plugin

We have two artifacts using a combination of generated and hand-written
blueprint containers. This makes reasoning about the actual wiring
rather hard. Inline the generated XML into the hand-written one, so that
we can untangle it more easily.

JIRA: NETCONF-749
Change-Id: I380600215a0fadf438b9a44e6ea4465f15d63fbf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCleanup NetconfConsoleUtils 06/96906/2
Robert Varga [Fri, 16 Jul 2021 16:56:35 +0000 (18:56 +0200)]
Cleanup NetconfConsoleUtils

We have a few strange methods here, clean them up to streamline.

Change-Id: Icf0ca4661d4b62cf9e3855af99a6611d1b719869
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoConvert netconf-console to OSGi DS 05/96905/2
Robert Varga [Fri, 16 Jul 2021 16:36:16 +0000 (18:36 +0200)]
Convert netconf-console to OSGi DS

netconf-console is a very simple component, convert it to OSGi DS.

JIRA: NETCONF-792
Change-Id: Ic92a59b52a85af67a8ed648a53cb11a083928ece
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove old AbstractNetconfDispatcher.getReconnectingClient() 03/96903/1
Robert Varga [Fri, 16 Jul 2021 12:52:14 +0000 (14:52 +0200)]
Remove old AbstractNetconfDispatcher.getReconnectingClient()

This method is not used anywhere, remove it. Also deprecate the
corresponding re-establishment policy, as it is no longer used.

Change-Id: I89b5ebf3197e8d459501b11433f3c9eaa3845281
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMove Rfc8040.Restconf constants 86/96886/2
Robert Varga [Wed, 14 Jul 2021 11:38:11 +0000 (13:38 +0200)]
Move Rfc8040.Restconf constants

We are using most of these constants only in export, clean them up and
move them to their sole user.

Change-Id: I493bb2baed521367ff78d6ec07ad64ee56516c32
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMove mapModulesByIetfYangLibraryYang() 85/96885/2
Robert Varga [Wed, 14 Jul 2021 11:15:23 +0000 (13:15 +0200)]
Move mapModulesByIetfYangLibraryYang()

This method has only a single production caller, migrate it to that
class, making reducing utility overloads.

Change-Id: I2c210e93797fbe5575c524e54c6c3ad6841b950f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMigrate getDataChildByName() callers 78/96878/2
Robert Varga [Tue, 13 Jul 2021 12:48:06 +0000 (14:48 +0200)]
Migrate getDataChildByName() callers

ControllerContext missed the migration of getDataChildByName(), hence
it's nullness checks are ineffective and it is tripping over. Make sure
we use plain dataChildByName() when we can tolerate missing data.

JIRA: NETCONF-790
Change-Id: Ic3aa31c764d08c199085b750674e5f98c9165f2e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUpdate tests with Akka Artery 15/95515/13
Kostiantyn Nosach [Wed, 17 Mar 2021 13:57:14 +0000 (15:57 +0200)]
Update tests with Akka Artery

Upstream has switched to using Artery TCP instead of classic transport.
Update test config file
netconf/netconf-topology-singleton/src/test/resources/application.conf
with new transport (artery-tcp)

JIRA: NETCONF-787
Change-Id: I70a4a5bb23f53166d8b164fced7f1311f1d7f764
Signed-off-by: Kostiantyn Nosach <kostiantyn.nosach@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSingle out RestconfConstants.MOUNT 62/96862/1
Robert Varga [Sat, 10 Jul 2021 05:18:02 +0000 (07:18 +0200)]
Single out RestconfConstants.MOUNT

This constant should be used via its PathArgument equivalent. Reduce
its use in tests and mark it for removal.

Change-Id: Ia3b75b95b236e35167ffb213c138930ed419a7f1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove RestconfConstants.IDENTIFIER 61/96861/2
Robert Varga [Fri, 9 Jul 2021 23:02:58 +0000 (01:02 +0200)]
Remove RestconfConstants.IDENTIFIER

This constant is not really useful, as it is referenced once in
production code and once in testing. Inline the definitions, as we
really want to make an explicit assertion in tests.

Change-Id: I7fd7a6e64562cb054b15011c1aad7624c47fea3d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCollapse streams.{sse,websocket} 60/96860/2
Robert Varga [Fri, 9 Jul 2021 22:52:24 +0000 (00:52 +0200)]
Collapse streams.{sse,websocket}

This two packages have just a few classes, collapse them to simplify
overall structure.

Change-Id: Ib3df507ac7b68e8641b933ac45c42f3bd7494437
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRestconfTransaction always operates on a single datastore 59/96859/3
Robert Varga [Fri, 9 Jul 2021 15:53:48 +0000 (17:53 +0200)]
RestconfTransaction always operates on a single datastore

Previous refactors in this area have suffered from lack of actual
clarity. All legitimate users of RestconfTransaction operate on
CONFIGURATION, hence use that without allowing a possiblity to
mix&match datastore access.

Change-Id: Ief9ff8d51e12c3cd3e04e55f9cd04b2b42f81068
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoClean up RestconfInvokeOperationsUtil 58/96858/2
Robert Varga [Fri, 9 Jul 2021 14:38:57 +0000 (16:38 +0200)]
Clean up RestconfInvokeOperationsUtil

RPC/action invocation through mount point and service is the same,
except for an additional lookup/throws. Restructure code to take
advantage of that.

JIRA: NETCONF-773
Change-Id: I68a4d75564b2f0a42070ad9f8ebd140109a6eb62
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoClean up listener activation 57/96857/3
Robert Varga [Fri, 9 Jul 2021 14:16:09 +0000 (16:16 +0200)]
Clean up listener activation

We have a two-step process in listener create/activate. Move methods
around so that the process can become properly stateful, without
giving out too much in terms of actual implementation methods.

JIRA: NETCONF-773
Change-Id: Ib9aa28a7b00e8f292a8a97a56d472ed51a9c45fd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoPackage ietf-yang-patch 56/96856/1
Robert Varga [Fri, 9 Jul 2021 12:41:24 +0000 (14:41 +0200)]
Package ietf-yang-patch

This is the model published in RFC8072, which gives us some basic
structural elements. Its value will increase once we can generate
structures for rc:yang-data.

JIRA: NETCONF-788
Change-Id: I063cea05f33cc8191db4320ee686b253b0471679
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRename {Xml,Json}ToPatchBodyReader 55/96855/1
Robert Varga [Fri, 9 Jul 2021 12:31:11 +0000 (14:31 +0200)]
Rename {Xml,Json}ToPatchBodyReader

Make sure we have consistent naming here by dropping 'To'.

JIRA: NETCONF-773
Change-Id: If1fd3cb6b07c97c7faf18b8d8324e81e9888c084
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMove validation methods 54/96854/3
Robert Varga [Fri, 9 Jul 2021 10:42:56 +0000 (12:42 +0200)]
Move validation methods

PutDataTransactionUtil is rather ugly in that it is used only
by a single implementation. Start disolving it by moving data validation
methods to RestconfDataServiceImpl.

JIRA: NETCONF-773
Change-Id: I365c087392fb0f593560c4dac3583622b341b037
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd AbstractPatchStatusBodyWriter 53/96853/3
Robert Varga [Fri, 9 Jul 2021 10:11:35 +0000 (12:11 +0200)]
Add AbstractPatchStatusBodyWriter

We have two specializations of this writer, create a common superclass
and share common code. Also improve error handling by mapping wrapping
XMLStreamException into an IOException.

JIRA: NETCONF-773
Change-Id: I000b9c7b333f59d000dc28ce2e75ee65477da193
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd AbstractNormalizedNodeBodyWriter 52/96852/3
Robert Varga [Fri, 9 Jul 2021 10:02:02 +0000 (12:02 +0200)]
Add AbstractNormalizedNodeBodyWriter

We have two specializations of this writer, share common code in
an abstract class. Also use more regular class naming.

JIRA: NETCONF-773
Change-Id: I8f52090de19a44a0293cb2cb07bfb9623250e34c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMove AbstractNormalizedNodeBodyReader 51/96851/3
Robert Varga [Fri, 9 Jul 2021 09:58:25 +0000 (11:58 +0200)]
Move AbstractNormalizedNodeBodyReader

We have only two specializations in jersey.providers package, move
the base class there.

JIRA: NETCONF-773
Change-Id: I1ae2cadff525af8089a511738989de68a3866df7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRefactor source export 50/96850/3
Robert Varga [Fri, 9 Jul 2021 09:53:51 +0000 (11:53 +0200)]
Refactor source export

Add AbstractSchemaExportBodyWriter and specialize it for YIN/YANG.
Also eliminate jersey.provides.schema package, as it does not really
make sense.

JIRA: NETCONF-773
Change-Id: Ia099e927da10f451cd843ba947a79312dd35af19
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove MessageBodyWriter.getSize() implementations 49/96849/3
Robert Varga [Fri, 9 Jul 2021 09:44:22 +0000 (11:44 +0200)]
Remove MessageBodyWriter.getSize() implementations

getSize() is documented legacy method which has a default implementation
and does nothing. Remove unneeded implementations.

JIRA: NETCONF-773
Change-Id: I1e1a9310f3ad78fe684de02fbaec5035bd1fcb90
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove TransactionChainHandler 46/96846/6
Robert Varga [Thu, 8 Jul 2021 20:18:42 +0000 (22:18 +0200)]
Remove TransactionChainHandler

This class is pure overhead and serves no purpose. Remove it to
simplify lifecycle as well as improve latencies.

JIRA: NETCONF-773
Change-Id: I0506f17d05cec910057e40742adfbb04225f4211
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoReduce use of TransactionChainHandler 45/96845/7
Robert Varga [Thu, 8 Jul 2021 19:55:01 +0000 (21:55 +0200)]
Reduce use of TransactionChainHandler

SchemaContextHandler does not need transaction chains at this point.
When it will need them, it will manage their lifecycle on its own.

JIRA: NETCONF-773
Change-Id: I89587b9777cb1ae7aa0b0fe628e3fa4ef16e83a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse free-standing transaction in SubscribeToStreamUtil 44/96844/3
Robert Varga [Thu, 8 Jul 2021 19:13:49 +0000 (21:13 +0200)]
Use free-standing transaction in SubscribeToStreamUtil

There is no point in juggling transaction chains here, just use
a simple free-standing transaction. Also note we do not need a
read-write transaction, so allocate a write-only transaction, which
is generally cheaper.

JIRA: NETCONF-773
Change-Id: Ib9995f664a27a2d29e91c18032d2a02cca6d768d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUnwrap ListenersAdapter 42/96842/3
Robert Varga [Thu, 8 Jul 2021 18:50:55 +0000 (20:50 +0200)]
Unwrap ListenersAdapter

We are calling Optional.get() repeatedly here, after performing
an isPresent() check. Use .orElseThrows() to ditch the Optional,
making things simpler.

Change-Id: I4242b39176bfee52d316969eb806a1fef21c2f90
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove ResolveEnumUtil 41/96841/3
Robert Varga [Thu, 8 Jul 2021 16:57:51 +0000 (18:57 +0200)]
Remove ResolveEnumUtil

ResolveEnumUtil is a rather timid utility, which is best eliminated
by adapting its users to do something smarter. We also suffle a few
constants around to make information scoping a bit clearer.

Change-Id: I54b347e7ec24876a3e1515c57af6c2db3cec9c55
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMake ListenersBroker.getInstance() lockless 43/96843/4
Robert Varga [Thu, 8 Jul 2021 18:55:25 +0000 (20:55 +0200)]
Make ListenersBroker.getInstance() lockless

While this is a huge antipattern in terms of retained global state,
we do not need to bounce a global lock to access it.

Use Initialization-on-demand holder idiom to make the access completely
lockless.

Change-Id: I374737f2dc5b3b07226eb7bbffcaaf2665cc8967
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix checkArgument() use 40/96840/1
Robert Varga [Thu, 8 Jul 2021 16:59:01 +0000 (18:59 +0200)]
Fix checkArgument() use

We do not want to concat the strings here, use a proper formatting
string -- speeding things up.

Change-Id: I0585752e07a4e58abf22d3e0facc93d0623ee198
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDeprecate restconf.common.util.MultivaluedHashMap 38/96838/1
Robert Varga [Thu, 8 Jul 2021 12:58:02 +0000 (14:58 +0200)]
Deprecate restconf.common.util.MultivaluedHashMap

This is a custom-coded class, which has a direct competitor in
javax.ws.rs.core. Deprecate it in favor of the standard class.

Change-Id: I2397c4a3b72d410a39806c1b147d9816b95eb875
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoImprove content checking 37/96837/1
Robert Varga [Thu, 8 Jul 2021 12:44:04 +0000 (14:44 +0200)]
Improve content checking

We have neat nested ifs to check for the content value, which makes
it rather hard to understand what is going on. Use a simple switch
expression to validate the values instead.

Change-Id: I7799fafd45ec393541a5f7f2ede92d8e6a178375
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix field count check 36/96836/1
Robert Varga [Thu, 8 Jul 2021 12:36:52 +0000 (14:36 +0200)]
Fix field count check

This is a simple copy&paste error which slipped past review, fix it up.

Change-Id: Ia381754abc7ec9d3adf53066ab2f8910e5554123
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSpeed up checkParametersTypes() 35/96835/1
Robert Varga [Thu, 8 Jul 2021 12:31:27 +0000 (14:31 +0200)]
Speed up checkParametersTypes()

Our checking logic here is rather sub-optimal, performing multiple
operations. Improve situation by using a fixed Set along with its
containsAll() method. The actual delta is computed only if we determine
there is something amiss.

Change-Id: If85e1049a34804444db6ad9849147b51b333b76f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSpeed up parseUriParameters() 34/96834/1
Robert Varga [Thu, 8 Jul 2021 11:58:12 +0000 (13:58 +0200)]
Speed up parseUriParameters()

Pre-construct our default values and access query parameters only once.

Change-Id: Ice551e9c441e86711d7705bf40fe0f2670c0440a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump versions to 2.0.1-SNAPSHOT 96/96796/1
Robert Varga [Sun, 4 Jul 2021 08:28:37 +0000 (10:28 +0200)]
Bump versions to 2.0.1-SNAPSHOT

This starts the next development iteration.

Change-Id: I4783ed8f10b04820f00857379dd316d030802cec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd a logging event when schema is loaded 95/96795/1
Robert Varga [Fri, 2 Jul 2021 21:56:08 +0000 (23:56 +0200)]
Add a logging event when schema is loaded

This is a useful indication as to when we are laying claim on the
directory.

Change-Id: I8a9057fa0b0ea84b54b1ec16c01979286a195277
JIRA: NETCONF-605
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse released aaa 0.14.0 94/96794/1
Robert Varga [Fri, 2 Jul 2021 20:44:28 +0000 (22:44 +0200)]
Use released aaa 0.14.0

Fix version to released artifacts.

Change-Id: I1a62c6475d9e7c0fc27426ba6b42c066bf676a0e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove OSGiSchemaResourceManager 93/96793/2
Robert Varga [Fri, 2 Jul 2021 20:22:28 +0000 (22:22 +0200)]
Remove OSGiSchemaResourceManager

We have OSGi R7, hence we have use constructor injection and express our
dependency on SCR.

Change-Id: I77f92de079aa2d51c444451ffd0db4bf2168695f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUpdate sal-rest-docgen dependencies 89/96789/1
Robert Varga [Fri, 2 Jul 2021 16:12:23 +0000 (18:12 +0200)]
Update sal-rest-docgen dependencies

We do not need parser here, we are getting all we need from
yang-test-util.

Change-Id: I3450b7ad3b0422b01cf3d43e8e2ed1f67c04d756
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse controller-4.0.0 86/96786/1
Robert Varga [Fri, 2 Jul 2021 15:05:28 +0000 (17:05 +0200)]
Use controller-4.0.0

Do not use snapshots for controller artifacts.

Change-Id: I86a46dbc466d0c4dde611f364e57808fc23b8e33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUpdate RESTCONF error mapping 83/96683/4
Robert Varga [Fri, 25 Jun 2021 21:26:01 +0000 (23:26 +0200)]
Update RESTCONF error mapping

yang.common.YangError is an attachment used to propagate RFC6020-defined
failure modes enforced by YANG Tools as exceptions. One such example is
YangInvalidValueException, which is reporting YANG constraint
violations.

Recognize these when mapping to RestconfDocumentedException, so that
their error-app-tag and error-message are properly propagated.

JIRA: NETCONF-786
Change-Id: Id6ea1877e03f42fc193942a4e2b83ecb6daeb631
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFixup MD-SAL breakages 76/96676/2
Robert Varga [Fri, 25 Jun 2021 15:00:49 +0000 (17:00 +0200)]
Fixup MD-SAL breakages

There are a few last-minute breaking changes coming from MD-SAL, make
sure we adapt to them. Also use released artifacts, so we should be fine
until we use snapshots again.

Change-Id: I12a44b2041fc47a824c039dddfdb21e3ebc8be17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCleanup yanglib dependencies 51/96651/1
Robert Varga [Thu, 24 Jun 2021 08:09:56 +0000 (10:09 +0200)]
Cleanup yanglib dependencies

We do not need yang-model-{api,util} here, remove the declarations.

Change-Id: I63ebd0b2fba3be82009b7a3e1e916526d2f0d36a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUpdate json-unit-assertj to 2.27.0 50/96650/2
Robert Varga [Thu, 24 Jun 2021 08:01:50 +0000 (10:01 +0200)]
Update json-unit-assertj to 2.27.0

There have been a few releases over the past year, catch up with them.

Change-Id: Ia3f24f73ecb386a9d3d6850159cd2ae8167c9049
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCleanup restconf-nb-rfc8040 dependencies 49/96649/2
Robert Varga [Thu, 24 Jun 2021 07:59:58 +0000 (09:59 +0200)]
Cleanup restconf-nb-rfc8040 dependencies

We have a few unnecessary dependencies here, readjust them to minimize
footprint.

Change-Id: Iacf49cce058aedc37e3d63067391026f65d0c235
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCleanup restconf-nb-bierman02 dependencies 48/96648/2
Robert Varga [Thu, 24 Jun 2021 07:57:22 +0000 (09:57 +0200)]
Cleanup restconf-nb-bierman02 dependencies

We have a ton of dependencies which are not used, or used only for
testing. Clean them up.

Change-Id: I8e86de3279b8f82b66b53879583cb2ec9b19c90d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCleanup restconf-common dependencies 47/96647/2
Robert Varga [Thu, 24 Jun 2021 07:52:24 +0000 (09:52 +0200)]
Cleanup restconf-common dependencies

We do not need parser-impl nor model-util, just model-ir.

Change-Id: Id37cd1fd37697b27f4f67ec40b652bb93403e571
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCleanup netconf-topology-singleton dependencies 46/96646/2
Robert Varga [Thu, 24 Jun 2021 07:49:49 +0000 (09:49 +0200)]
Cleanup netconf-topology-singleton dependencies

We are not using codec-xml here, remove it.

Change-Id: I1c0f8e264d9465c45daba805f744df5f48b482e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoClean up mdsal-netconf-connector dependencies 45/96645/2
Robert Varga [Thu, 24 Jun 2021 07:47:02 +0000 (09:47 +0200)]
Clean up mdsal-netconf-connector dependencies

We have a few superfluous dependencies here, remove them.

Change-Id: I3a47677de71d134437b6ff321009386bd7fea435
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDrop an unneeded dependency from mdsal-netconf-monitoring 44/96644/2
Robert Varga [Thu, 24 Jun 2021 07:44:57 +0000 (09:44 +0200)]
Drop an unneeded dependency from mdsal-netconf-monitoring

We do not use ietf-inet-types here, remove it.

Change-Id: I359aa26a6cc9463e9f706070debb5f707501465c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove sal-rest-docgen-maven 30/96630/1
Robert Varga [Wed, 23 Jun 2021 13:44:30 +0000 (15:44 +0200)]
Remove sal-rest-docgen-maven

Static generator for swagger documentation is not used anywhere and it
is an utter mess. Remove it.

JIRA: MDSAL-232
Change-Id: I8a131f22f7f5d01aa0d66116413ded822fda1341
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd restconf-wadl-generator 05/96605/3
Robert Varga [Wed, 23 Jun 2021 11:49:44 +0000 (13:49 +0200)]
Add restconf-wadl-generator

WADL generator is a tiny bit coming from MD-SAL's
maven-sal-api-gen-plugin, but dependent on RESTCONF semantics.

This patch imports its state as of commit
123a8fe79fa859b5e64e3efbd004d0730e25164d, taking ownership of it.

JIRA: MDSAL-232
Change-Id: I81cc5cb6e2ef3496605e3532087688eb4ab172e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRefactor Swagger unit tests 47/96547/5
Ivan Hrasko [Wed, 16 Jun 2021 09:52:31 +0000 (11:52 +0200)]
Refactor Swagger unit tests

Get rid of incorrect equals call on module revision by
using SchemaContext#findModule methods to find
module according to namespace (and revision).

Because of incorrect equals call the tests
were just passing without any assertions and
were not maintained for long time, some of the
assertions needed to be adapted.

Remove unnecessary code to load EffectiveModelContext
from DocGenTestHelper and instead use YangParserTestUtils
methods directly in tests.

Refactor DocGenTestHelper to be utility class.
Refactor tests code, make tests logic more simple.
Also, introduce tests for ApiDocGeneratorRFC8040.

JIRA: NETCONF-785
Change-Id: I195acbca354cdfe80241430255254436d0dac23f
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
2 years agoFix multiple keys path in RFC8040 swagger 30/96530/3
Ivan Hrasko [Tue, 15 Jun 2021 07:46:05 +0000 (09:46 +0200)]
Fix multiple keys path in RFC8040 swagger

ListPathBuilder for RFC8040 needs to change its state
when processing multiple keys (= to ,) thus we have
to create it before the iteration over all list keys.

JIRA: NETCONF-708
Change-Id: If617ff1508e63b1001ab7857e3b3fdebff287f74
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMark netconf node with ext:mount 01/96501/1
Robert Varga [Wed, 9 Jun 2021 16:00:39 +0000 (18:00 +0200)]
Mark netconf node with ext:mount

Add an explicit marker for netconf topology nodes.

JIRA: NETCONF-783
Change-Id: Ie037ea099ed2ebb426242922cf3f7b791e5f7dc4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump MRI upstreams 99/96099/50
Robert Varga [Sun, 9 May 2021 20:18:07 +0000 (22:18 +0200)]
Bump MRI upstreams

Adopt latest versions, namely;
- odlparent-9.0.2
- yangtools-7.0.2-SNAPSHOT
- infrautils-2.0.2
- mdsal-8.0.0-SNAPSHOT
- controller-4.0.0-SNAPSHOT
- aaa-0.14.0-SNAPSHOT

Change-Id: Ic4cbc01d88134df26416cd2d6f3e7ac64a03dc1a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse InstanceIdentifier.empty() 24/96424/1
Robert Varga [Fri, 4 Jun 2021 13:01:57 +0000 (15:01 +0200)]
Use InstanceIdentifier.empty()

We do not need a builder here, just use the empty identifier.

Change-Id: I65d6cd0d27e71316b5a8eed330157b583e406474
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoHandle NetconfDocumentedExceptions correctly 97/96397/3
Tomas Cere [Tue, 1 Jun 2021 08:41:51 +0000 (10:41 +0200)]
Handle NetconfDocumentedExceptions correctly

These need to be wrapped in TransactionCommitFailedException
so they are handled correctly, so restconf can map these and
return correct status code on failure.

JIRA: NETCONF-777
Change-Id: Id4833bfe46da6f97a216163452dd2a44af599063
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCorrect stream instance identifier 95/96395/1
Robert Varga [Mon, 31 May 2021 12:25:40 +0000 (14:25 +0200)]
Correct stream instance identifier

Constructed path has a mismatch in both depth and map identifier QName,
fix that up.

JIRA: NETCONF-773
Change-Id: Ib0ce3c3727f5cf340d8d1d6ea8e449bf3f83f2f3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd sample how to use karaf static distribution for NETCONF and RESTCONF 84/94784/15
Oleksii Mozghovyi [Mon, 25 Jan 2021 12:21:20 +0000 (14:21 +0200)]
Add sample how to use karaf static distribution for NETCONF and RESTCONF

This shows how the combination of NETCONF connector and RESTCONF can be
packaged inside the static karaf distribution.

JIRA: INTDIST-116
Change-Id: I4b21b0cde3ae3ca3276133355b166e662d3212e7
Signed-off-by: Oleksii Mozghovyi <oleksii.mozghovyi@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix augment argument 84/96384/1
Robert Varga [Thu, 27 May 2021 22:48:41 +0000 (00:48 +0200)]
Fix augment argument

As per RFC6020 section 7.15, augment statement used under a module
(or submodule} statement MUST use absolute form must be used.
Fix our test model.

Change-Id: I0b6a566f448464643c0796714de268464412bff6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFixup netconf-parent path 58/96358/1
Robert Varga [Tue, 25 May 2021 09:11:02 +0000 (11:11 +0200)]
Fixup netconf-parent path

netconf-parent's directory is just 'parent', fix that up.

Change-Id: I863f07415ec49cb8ecda0c60de316ce048c27d9b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup FilterContentValidator 36/96336/2
Robert Varga [Mon, 24 May 2021 12:03:22 +0000 (14:03 +0200)]
Cleanup FilterContentValidator

Make sure we do not mutate our argument and do not access children
until necessary.

Change-Id: Ic2a1a7561fc321b75f2e63a6968eb20507cdda43
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoInitialize FilterTree.children 35/96335/1
Robert Varga [Mon, 24 May 2021 11:06:29 +0000 (13:06 +0200)]
Initialize FilterTree.children

This is a simple move of initializer, so that it is obvious what
is going on.

Change-Id: I002cc767bd0d98855c31a172d45ccdc39389a5b5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoModernize netconf-util tests 03/96303/1
Robert Varga [Sun, 23 May 2021 18:06:45 +0000 (20:06 +0200)]
Modernize netconf-util tests

Use assertThrows() and fixup imports a bit.

Change-Id: I2816141af08815afb0dc926e78ace962ba561ded
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup netconf-impl tests 02/96302/1
Robert Varga [Sun, 23 May 2021 17:57:41 +0000 (19:57 +0200)]
Cleanup netconf-impl tests

Use static imports for assert methods, and use assertThrows() instead
of try/catch blocks.

Change-Id: I0054becc441cbe33c6aedf156b267429eb53e224
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup NetconfMDSalMappingTest 00/96300/1
Robert Varga [Fri, 21 May 2021 13:05:37 +0000 (15:05 +0200)]
Cleanup NetconfMDSalMappingTest

Use assertThrows() and remove unused code.

Change-Id: Ia0c1ab438ad93026fff28c476254e409bd2cc4ae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUpdate RuntimeRpc a bit 99/96299/1
Robert Varga [Fri, 21 May 2021 12:50:14 +0000 (14:50 +0200)]
Update RuntimeRpc a bit

Move Element cast to the method which is producing it, saving one
import.

Change-Id: Ie00e716681666ae64f2774cf068a202e54fbeb81
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove restconf-parent 98/96298/1
Robert Varga [Fri, 21 May 2021 12:14:38 +0000 (14:14 +0200)]
Remove restconf-parent

This pom is a useless wrapper around netconf-parent. Eliminate it and
migrate its users.

Change-Id: Id3c0cc6458855a7c4bd9eeb6a2e8e3d47d57b9da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove superfluous version/groupId declarations 97/96297/1
Robert Varga [Fri, 21 May 2021 12:12:04 +0000 (14:12 +0200)]
Remove superfluous version/groupId declarations

We can inherit these declarations from our parent structure, making
poms a tad leaner.

Change-Id: Ia56733a45566af971d8963b1465341925de4ce7f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoEnable TCP_NODELAY for SSH client/server 09/96209/3
Robert Varga [Mon, 17 May 2021 15:10:45 +0000 (17:10 +0200)]
Enable TCP_NODELAY for SSH client/server

Both NETCONF northbound (SshProxyServer) and southbound
(AsyncSshHandler) plugins exhibit latencies caused by Nagle's algorithm.
These are superfluous, as we typically work in request-response manner,
with reasonable level of buffering going on in the intermediate layers.

Set TCP_NODELAY flag to get rid of these artifacts.

JIRA: NETCONF-776
Change-Id: I68a87cc2bef4f0032e104833b8d241f5b1f7566b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup RFC8040 media type handling 77/96277/3
Robert Varga [Wed, 19 May 2021 21:40:48 +0000 (23:40 +0200)]
Cleanup RFC8040 media type handling

Promote Rfc8040.MediaTypes to a top-level types, adding documentation
and proper constants mimicking the layout of javax.ws.rs.core.MediaType.

As part of this exercise, also correct the media types produced by our
JAX-RS services so they accurately comply with RFC8040, RFC8072 and
RFC6415.

JIRA: NETCONF-779
JIRA: NETCONF-780
Change-Id: Iaaf192e9d30858f5ce6f8e3484ea232fbf69e92f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSwitch to using SseEventSink 08/96208/2
Robert Varga [Mon, 17 May 2021 14:00:42 +0000 (16:00 +0200)]
Switch to using SseEventSink

JAX-RS 2.1 has a standard way of working with SSE, do not use
Jersey-specific APIs (except in test).

JIRA: NETCONF-775
Change-Id: I46c2b80be52d2313ab9193361da788f41923c175
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUse MediaType.SERVER_SENT_EVENTS 05/96205/4
Robert Varga [Mon, 17 May 2021 12:47:31 +0000 (14:47 +0200)]
Use MediaType.SERVER_SENT_EVENTS

We are using JAX-RS 2.1, hence we have SSE support built-in. Reduce
dependency surface by using MediaType constant instead of Jersey's
Feature.

JIRA: NETCONF-775
Change-Id: I27338775dd3cd92681a4c1f953f71145100f24ef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove event fragmentation 07/96207/2
Robert Varga [Mon, 17 May 2021 14:03:41 +0000 (16:03 +0200)]
Improve event fragmentation

Rather than instantiating String objects, use StrinBuilder's ability to
append CharSequence parts.

Change-Id: I1283791c50a9e41fd1703786cbf2aefe71e75484
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUse a simple isEmpty() check 71/96271/2
Robert Varga [Wed, 19 May 2021 19:10:44 +0000 (21:10 +0200)]
Use a simple isEmpty() check

Rather than checking size() == 0, use isEmpty(), which is clearer
and potentially fasterUse a simple isEmpty() check

Rather than checking size() == 0, use isEmpty(), which is clearer
and potentially faster.

Change-Id: I0aadff4a55258f2fbb0bd60c26993b08b3b8e7b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRefactor ietf-restconf constants 70/96270/2
Robert Varga [Wed, 19 May 2021 14:21:01 +0000 (16:21 +0200)]
Refactor ietf-restconf constants

We have a number of constants which overlap with definitions generated
for the ietf-restconf module. Use QNames from generated code and rehost
all constants to their users.

JIRA: NETCONF-773
Change-Id: Ic6fe0a8fedf4029fabc5cdf3ea634975b5949515
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUse ImmutableNodes.leafNode() 69/96269/2
Robert Varga [Wed, 19 May 2021 13:49:35 +0000 (15:49 +0200)]
Use ImmutableNodes.leafNode()

Do not use schema-aware builder, use a straight-up shortcut to a
LeafNode.

JIRA: NETCONF-773
Change-Id: I306dde8b7f8857945d1036945545c65fc98c4c3b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRefactor constants relating to restconf-monitoring 68/96268/3
Robert Varga [Wed, 19 May 2021 13:30:48 +0000 (15:30 +0200)]
Refactor constants relating to restconf-monitoring

We have a number of constants scattered around, some of which can
have better names and placement, or are duplicates of constants
generated for the ietf-restconf binding.

Reuse generated constants and construct native YangInstanceIdentifiers,
so we minimize duplication.

JIRA: NETCONF-773
Change-Id: I5a17cbdd863fcdbaf75db56d4a8b0daddfe5e7a9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup Rfc8040 constants 61/96261/1
Robert Varga [Wed, 19 May 2021 10:24:55 +0000 (12:24 +0200)]
Cleanup Rfc8040 constants

A number of constants here are unused, remove them.

JIRA: NETCONF-773
Change-Id: If75073a19eff52da4cf68c9601c1b775258a42d4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRename SessionHandlerInterface 04/96204/1
Robert Varga [Mon, 17 May 2021 11:36:13 +0000 (13:36 +0200)]
Rename SessionHandlerInterface

The 'Interface' part is obvious, but it is not immediately obvious
what sort of 'session' and 'handler' we are talking about. Rename
it to StreamSessionHandler.

Change-Id: I76fe4f0a7fc87134ce15dece17bb5bdd2075b779
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove SSEInitializer 03/96203/1
Robert Varga [Mon, 17 May 2021 10:32:39 +0000 (12:32 +0200)]
Remove SSEInitializer

SSEInitializer is a simple indirection between RestconfDataStreamServiceImpl
and streams.Configuration. Eliminate the indirection.

JIRA: NETCONF-773
Change-Id: I88429d8a58720589fd73f1c6da7cb3d2176bf88f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUnmask NotificationListenerAdapter 02/96202/1
Robert Varga [Mon, 17 May 2021 09:41:47 +0000 (11:41 +0200)]
Unmask NotificationListenerAdapter

Use .orElseThrow() to acquire a nice instance, without needing to issue
multiple .get()s.

JIRA: NETCONF-773
Change-Id: If67fb5391642e437ce27c2d9f21688c875de4561
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove the ability to inject differing DOMDataBroker 01/96201/1
Robert Varga [Mon, 17 May 2021 08:41:26 +0000 (10:41 +0200)]
Remove the ability to inject differing DOMDataBroker

We only have one implementation of DOMDataBroker therefore tuning
the injection via Config Admin is useless -- remove it.

JIRA: NETCONF-774
Change-Id: I024866c51b2c825032169fbff768833ac03c7195
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove Service(Notif)Wrapper 00/96200/1
Robert Varga [Sun, 16 May 2021 21:13:06 +0000 (23:13 +0200)]
Remove Service(Notif)Wrapper

The wrappers are a remnant of the Config Subsystem wiring, and are not
really useful. Remove them, along with Rfc8040RestConfWiring, which is
no longer needed.

JIRA: NETCONF-773
Change-Id: I2534a6418dc0ca1f1d6aad3d41f874781ea1930d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUnmask NotificationListenerAdapter 99/96199/2
Robert Varga [Sat, 15 May 2021 13:16:45 +0000 (15:16 +0200)]
Unmask NotificationListenerAdapter

Use .orElseThrow() to acquire a nice instance, without needing to issue
multiple .get()s.

JIRA: NETCONF-773
Change-Id: Ic499f6eee7f19cba1796e62cad47892b64a28b4c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup WebInitializer 98/96198/2
Robert Varga [Sat, 15 May 2021 08:24:44 +0000 (10:24 +0200)]
Cleanup WebInitializer

Use a simple List.of() and clean up code formatting to make it clearer
what we are trying to do.

Change-Id: I1bb44e4c75fb7f3c86e580255df9a3119044be7f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove {Base,Transaction}ServicesWrapper 96/96196/2
Robert Varga [Sat, 15 May 2021 08:10:02 +0000 (10:10 +0200)]
Remove {Base,Transaction}ServicesWrapper

These interfaces are just simple combination of JAX-RS services, remove
them to make inheritance a bit clearer.

JIRA: NETCONF-773
Change-Id: I47c4cc866f64143d8042a729bfe56d4a9860cec1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove services API 95/96195/1
Robert Varga [Sat, 15 May 2021 08:05:57 +0000 (10:05 +0200)]
Move services API

We seem to have two packages for JAX-RS services, without any
explanation of the split. Arbitrarily pick rests.services as the
target package, mostly vacating services.simple.

JIRA: NETCONF-773
Change-Id: I9642309916d0503081211f15394fd94762382eb4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoReuse local RestconfStrategy 94/96194/1
Robert Varga [Sat, 15 May 2021 07:38:58 +0000 (09:38 +0200)]
Reuse local RestconfStrategy

RestconfStrategy is now completely stateless, hence we can reuse the
same object, reducing GC pressure a bit.

JIRA: NETCONF-773
Change-Id: Ic6c7968f1279bd0aa7c5f58452af499d16079464
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoClean up Root Resource Discovery implementation 90/96190/1
Robert Varga [Fri, 14 May 2021 18:05:04 +0000 (20:05 +0200)]
Clean up Root Resource Discovery implementation

Move the implementation to other service implementations and make sure
it has configurable root -- which should be coming from WebInitializer.

JIRA: NETCONF-773
Change-Id: I1fd8936d622c0ee51bd151a0ebd34b05dd76d2b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoReduce preliferation of TransactionChainHandler 71/96171/3
Robert Varga [Fri, 14 May 2021 08:05:04 +0000 (10:05 +0200)]
Reduce preliferation of TransactionChainHandler

RestconfStrategy does not need to work on transaction chains -- we are
really dealing with standalone transactions every step of the way. This
ends up simplifying the flow quite a bit.

JIRA: NETCONF-773
Change-Id: I70c49e7c2f9da250c53ebfc32ddb99456f9b2c46
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove DOMMountPointServiceHandler 70/96170/2
Robert Varga [Thu, 13 May 2021 15:44:06 +0000 (17:44 +0200)]
Remove DOMMountPointServiceHandler

This is a useless indirection over DOMMountPointService, just remove it,
making lifecycle a bit more clearer.

JIRA: NETCONF-773
Change-Id: I0cf083b11e98c10b5af28784e20fc7e8fda25110
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove DOMDataBrokerHandler 69/96169/3
Robert Varga [Thu, 13 May 2021 15:18:28 +0000 (17:18 +0200)]
Remove DOMDataBrokerHandler

This is a useless indirection over DOMDataBroker, just remove it, making
lifecycle a bit more clearer.

JIRA: NETCONF-773
Change-Id: I349baf5e184c7f18092e41149cf93efc13e72ac1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove NotificationServiceHandler 68/96168/1
Robert Varga [Thu, 13 May 2021 15:09:47 +0000 (17:09 +0200)]
Remove NotificationServiceHandler

This is a useless indirection over DOMNotificationService, remove it,
making interactions tad easier to follow.

JIRA: NETCONF-773
Change-Id: I91f4da713f3ff66d0efa7cd3feeda6fc01a83fad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove RpcServiceHandler 67/96167/2
Robert Varga [Thu, 13 May 2021 14:29:40 +0000 (16:29 +0200)]
Remove RpcServiceHandler

This is a useless indirection class, just remove it and deal with
DOMRpcService instead.

JIRA: NETCONF-773
Change-Id: I3808997bc1226d384d012a5153701cbd95fb6028
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove ActionServiceHandler 66/96166/2
Robert Varga [Thu, 13 May 2021 13:10:45 +0000 (15:10 +0200)]
Remove ActionServiceHandler

This is a useless indirection class, just remove it and deal with
DOMActionService instead.

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