netconf.git
8 months agoIntroduce XmlUtil.requireSingleElement 07/108207/3
Robert Varga [Tue, 3 Oct 2023 16:17:23 +0000 (18:17 +0200)]
Introduce XmlUtil.requireSingleElement

Improve our handling of structural errors, by reporting missing-element
instead of invalid-value. The utility to do so is also independent from
XmlElement.

Change-Id: If1efd60aa268d659b1e5f43686caf49e77e40c05
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoTurn ListenersBroker into a component 34/107834/17
Oleksandr Zharov [Tue, 12 Sep 2023 11:57:54 +0000 (13:57 +0200)]
Turn ListenersBroker into a component

Refactored the ListenersBroker class into a component using
osgi.service.component.annotations.

JIRA: NETCONF-1104
Change-Id: I6ef5fa2ab22792c3d408dfa9db92ae7f07b3c63d
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoFix 'End of input' exception on netconf session.close() 15/108115/7
Ruslan Kashapov [Mon, 2 Oct 2023 10:29:05 +0000 (13:29 +0300)]
Fix 'End of input' exception on netconf session.close()

On session.close() the channel is closed before the
session state updated. When processing channel closure
event the endOfInput() detects session is still up and
instructs session listener to throw an exception.
Updating state before channel closure eliminates the issue.

JIRA: NETCONF-1106
Change-Id: I0394c808dd13adb5f82290c625d0a04b14c91179
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoRemove type arguments 49/108249/1
Robert Varga [Thu, 5 Oct 2023 12:27:01 +0000 (14:27 +0200)]
Remove type arguments

We can use diamond notation to let javac figure out the type.

Change-Id: I098c1713c4b0899f88931c6e10d331d683617ed3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoFix channel initialization for netconf server 14/108114/6
Ruslan Kashapov [Mon, 2 Oct 2023 09:33:47 +0000 (12:33 +0300)]
Fix channel initialization for netconf server

The start() triggering run() method is executed on very
first client request within an open channel. Initializing
data receiver within run() method causes default data
receiver with incoming message buffer being dropped,
resulting the hello request from client being ignored.
While hello request from server is sent it leads netconf
session initialization on client, but not on server.

The fix enables channel initialization on processing
setChannelSession() and setIoOutputStream() methods which
are invoked by ChannelSession#prepareChannelCommand()
on processing channel OPEN request.

JIRA: NETCONF-1106
Change-Id: If6baba692e0178d7b5a24866176fe93aa0a0a485
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoDo not repair XML namespaces on output 99/108199/3
Robert Varga [Tue, 3 Oct 2023 15:28:35 +0000 (17:28 +0200)]
Do not repair XML namespaces on output

Our output should be namespace-clean, hence there should be no need for
repairing.

Change-Id: Iad70bf0fd750caf54c3dc7461219e8b78f46a6c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoFix RPC XML payload missing namespace 62/107762/17
Matej Sramcik [Mon, 25 Sep 2023 06:39:17 +0000 (08:39 +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.
Edit expected outcome from affected tests.

JIRA: NETCONF-1139
Change-Id: I17b99e0afa6acdcac98a63baef625c671a6ce29e
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
8 months agoTest JSON representations of responses in OpenApi 91/107391/29
Šimon Ukuš [Fri, 11 Aug 2023 12:48:15 +0000 (14:48 +0200)]
Test JSON representations of responses in OpenApi

We did not have any tests that would provide a higher overview
of the responses sent back to clients. Such view gives us an idea
about the generated output.

These tests verify the full response of each endpoint by comparing
the results to prepared JSONs.

JIRA: NETCONF-1131
Change-Id: I008f01e3c11593f5a2d0f53843bc4d5639abda1a
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
8 months agoClean up boolean values in records 02/108002/4
Samuel Schneider [Thu, 28 Sep 2023 10:48:01 +0000 (12:48 +0200)]
Clean up boolean values in records

Remove unnecessary boolean values in record and
the rest change to Boolean, so it can be null.

JIRA: NETCONF-938
Change-Id: Ieaadb216c23b9aea5bf682e914a554daf39907ff
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
8 months agoEliminate HandlingPriority.CANNOT_HANDLE 71/108171/2
Robert Varga [Tue, 3 Oct 2023 08:12:10 +0000 (10:12 +0200)]
Eliminate HandlingPriority.CANNOT_HANDLE

This is an ugly special case. It really is used only as a return from
canHandle(), which in turn can use a @Nullable return to represent this.

Change-Id: I87ce5f1a4391e04de78377c1d4d27b55e2fe80e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoClean up HandlingPriority 70/108170/1
Robert Varga [Mon, 2 Oct 2023 18:12:05 +0000 (20:12 +0200)]
Clean up HandlingPriority

Clean up comparison and API surface and mark CANNOT_HANDLE for removal.

Change-Id: Iec8585f67c25f65e8c473372bf7d37ab62c3ae65
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoFix RuntimeRpc.canHandle() 66/108166/2
Robert Varga [Mon, 2 Oct 2023 17:25:48 +0000 (19:25 +0200)]
Fix RuntimeRpc.canHandle()

We were disregarding the result from the RPC search, fix that.

Change-Id: Ice6e1d4cc7aa381c21fe640dbd1b5044c68cf6c7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoRuntimeRpc should be final 65/108165/1
Robert Varga [Mon, 2 Oct 2023 17:13:43 +0000 (19:13 +0200)]
RuntimeRpc should be final

We do not expect this class to be customized, make it final.

Change-Id: If2568f12fc512c3a078bdfb04d187f583412dc21
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoMake AbstractNetconfOperation.handle() final 56/108156/2
Robert Varga [Mon, 2 Oct 2023 12:09:20 +0000 (14:09 +0200)]
Make AbstractNetconfOperation.handle() final

We do not want to have a byzantine overrides when there is an extension
point. This locks the method down by making it final.

Change-Id: I974d6944a51d579607a422a8ced4d6917e470be5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoMake SettableRpc final 55/108155/2
Robert Varga [Mon, 2 Oct 2023 11:18:13 +0000 (13:18 +0200)]
Make SettableRpc final

This is an internal implementation class, there is no need to keep it
non-final.

Change-Id: I824422b26542737fa09e4b818932f5bc789f45d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoSSH keep-alive mechanism to use IGNORE messages 13/108113/1
Ruslan Kashapov [Mon, 2 Oct 2023 08:44:59 +0000 (11:44 +0300)]
SSH keep-alive mechanism to use IGNORE messages

Initial setting of HeartbeatType.RESERVED requires
custom implementation of heartbeat message handler.
Otherwise, the exception is thrown.

JIRA: NETCONF-590
Change-Id: I4752718a5bc9ac18910fa4c141e0fc53155e5ce8
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
8 months agoFix frame encoder for netconf server 01/108001/3
Ruslan Kashapov [Thu, 28 Sep 2023 09:33:22 +0000 (12:33 +0300)]
Fix frame encoder for netconf server

Using first appearance of ByteBuf output as a final
message caused frame encoder being skipped and
message returned without expected EOM bytes. Message
extraction from inner channel re-implemented as an
outbound message handler.

JIRA: NETCONF-1106
Change-Id: Icb7fc6eca070c75910a35c8f117e6b1fa4295c0c
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
8 months agoClean up XmlElementTest 07/108107/1
Robert Varga [Sun, 1 Oct 2023 22:48:39 +0000 (00:48 +0200)]
Clean up XmlElementTest

Use local variable type inference and text blocks.

Change-Id: I471d99d11a493c46aba9a2e6fe868172edfc6a24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoClean up XmlElement methods 90/108090/4
Robert Varga [Sun, 1 Oct 2023 13:36:34 +0000 (15:36 +0200)]
Clean up XmlElement methods

XmlElement has a number of methods which are better hosted in XmlUtil,
without the need for encapsulation.

Change-Id: I5e47719ce3c31b3e41976f0e1955ac097b4a1485
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoFix netconf-client's dependencies 89/108089/3
Robert Varga [Sun, 1 Oct 2023 13:22:45 +0000 (15:22 +0200)]
Fix netconf-client's dependencies

We have two warnings about dependencies we are using, fix that up.

Change-Id: I69ee5f9b629621edc74e1022bd9eda0bde3fcb67
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoMove XmlUtil.evaluateXPath() 88/108088/3
Robert Varga [Sun, 1 Oct 2023 13:20:41 +0000 (15:20 +0200)]
Move XmlUtil.evaluateXPath()

The only caller is NetconfClientSessionNegotiator, move the method
there.

Change-Id: I36e0d6cc98bc2881787eb16a380c67f6564ef8c0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoUse ContainerNode in RuntimeRpc 02/108102/1
Robert Varga [Sun, 1 Oct 2023 21:23:30 +0000 (23:23 +0200)]
Use ContainerNode in RuntimeRpc

We are guaranteed to have a ContainerNode, do not drop down to
NormalizedNode and re-cast.

Change-Id: I857be04823c927d96913a6b18a6cd37c079a6bc7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoImprove assertion 98/108098/1
Robert Varga [Sun, 1 Oct 2023 21:02:35 +0000 (23:02 +0200)]
Improve assertion

Print diff contents when it does not match.

Change-Id: I7f08cd1965f56d913600d487008b96cf6346221a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoEliminate XmlUtil.createElement() et al. 87/108087/3
Robert Varga [Sun, 1 Oct 2023 12:33:11 +0000 (14:33 +0200)]
Eliminate XmlUtil.createElement() et al.

These users are just shortcuts to Document.createElementNS(). Migrate
them over for clarity.

Change-Id: I9f2ec11bc0c7b5f8df86c15a0a0ca4a55c16ed54
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoClean up NetconfMessageTransformerTest 86/108086/2
Robert Varga [Sun, 1 Oct 2023 11:38:59 +0000 (13:38 +0200)]
Clean up NetconfMessageTransformerTest

Improve assertions, use local variable type inference and text blocks.

Change-Id: I212f3a3554978b4dd785eccdf8591f49fd4021fe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoFix filter type namespace 85/108085/2
Robert Varga [Sun, 1 Oct 2023 11:06:53 +0000 (13:06 +0200)]
Fix filter type namespace

We are emitting "type" with the NETCONF base namespace.

This is wrong, as attributes are not subject to default namespace, hence
we should be emitting it as a plain attribute -- it is interpreted in
the context of its defining element, which already is in NETCONF base
namespace.

JIRA: NETCONF-1170
Change-Id: I9cf63ca52297cd45ea062ec7ddfb1ff4a9e853f7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoClean up BaseRpcSchemalessTransformerTest 79/108079/1
Robert Varga [Fri, 29 Sep 2023 23:29:49 +0000 (01:29 +0200)]
Clean up BaseRpcSchemalessTransformerTest

Switch to using xmlunit-core and clean up.

Change-Id: I5ddd5316939859b131f28949d3de462c9b1929aa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoMigrate netconf-server to xmlunit-core 78/108078/3
Robert Varga [Fri, 29 Sep 2023 22:05:15 +0000 (00:05 +0200)]
Migrate netconf-server to xmlunit-core

Migrate to xmlunit-core and perform usual modernization.

Change-Id: Iaaad8749718e0705be5b47b4828b4f59f6cdb3e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoMigrate netconf-netty-util to xmlunit-core 76/108076/2
Robert Varga [Fri, 29 Sep 2023 21:35:29 +0000 (23:35 +0200)]
Migrate netconf-netty-util to xmlunit-core

Use xmlunit-core instead of xmlunit-legacy and modernize the code.

Change-Id: Ia9f9fba4e9458b9a6465c2f3fe2ab0d304e47bbc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoFix netconf-netty-util dependencies 77/108077/2
Robert Varga [Fri, 29 Sep 2023 21:38:06 +0000 (23:38 +0200)]
Fix netconf-netty-util dependencies

We have two warnings here, fix them up.

Change-Id: I54d7bc23e75569702cbd0b56c4db26530eb219df
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoRemove XmlUnitUtil 75/108075/1
Robert Varga [Fri, 29 Sep 2023 21:24:02 +0000 (23:24 +0200)]
Remove XmlUnitUtil

This class is not used anywhere, as it was only used in config-connector
tests.

Change-Id: I2069ff892311b7434ddd3c0269753f2d764f4326
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoCreate MdsalRestconfServer 93/107893/10
Robert Varga [Sat, 16 Sep 2023 09:24:35 +0000 (11:24 +0200)]
Create MdsalRestconfServer

The actual binding to MD-SAL services is independent of other
concerns, just as JAX-RS binding.

Introduce MdsalRestconfServer to act as an intermediary. This allows us
to centralize data binding operations and later act as the central
implementation dispatch.

This reduces the number of callers to
InstanceIdentifierParser.toInstanceIdentifier(), as we have a proper
indirection to bind either the root or a non-empty identifier and can
provide the first cut of differentiated binding.

In RestconfOperationsServiceImpl this has the nice effect of bringing
together the two distinct invocation paths, leading to
OperationsContent.bodyFor(EffectiveModelContext) being redundant.

In RestconfDataServiceImpl we lose getRestconfStrategy(), which is now
invoked on the server. We also clarify variable names, so they have a
semantic meaning.

RestconfInvokeOperationsServiceImpl integration sees RestconfStrategy
grow awareness of DOMRpcService, providing a clean invocation interface
centered around RestconfFuture<Optional<ContainerNode>>. That
co-location of concerns also allow us to perform only a single error
mapping, we any DOMRpcResult's errors into a
RestconfDocumentedException.

JIRA: NETCONF-1157
Change-Id: I9ecefb2e065b4ad6ed8e4226713da851a1050619
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoCleanup RestconfDataServiceImplTest 96/107996/2
Ivan Hrasko [Wed, 27 Sep 2023 11:54:44 +0000 (13:54 +0200)]
Cleanup RestconfDataServiceImplTest

Remove unused fields from RestconfDataServiceImplTest.

Change-Id: I3b299db3b283ea61116f54cd1bd5024a6f81de42
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
8 months agoClean up artifacts 93/107993/2
Robert Varga [Tue, 26 Sep 2023 20:18:06 +0000 (22:18 +0200)]
Clean up artifacts

netconf-netty-util does not produce a test-jar, hence we should not be
declaring it.

netconf-client's test-jar should be declared with scope=test to prevent
it from accidentally leaking to runtime.

Change-Id: I71de23653ac300c3ddb3d2c978b7fcf84d220333
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoTurn NetconfTopologyRPCProvider into a resource 90/107990/3
Robert Varga [Tue, 26 Sep 2023 13:41:26 +0000 (15:41 +0200)]
Turn NetconfTopologyRPCProvider into a resource

Rether than exposing ClassToInstanceMap and have users repeat the same
thing, turn the provider into a properly-managed resource which needs
to be cleaned up with close().

JIRA: NETCONF-1116
Change-Id: I77ab5020627ae3ed5632e919d2866b17c46878aa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoDo not leak ClassToInstanceMap from NetconfSalKeystoreRpcs 89/107989/1
Robert Varga [Tue, 26 Sep 2023 12:36:39 +0000 (14:36 +0200)]
Do not leak ClassToInstanceMap from NetconfSalKeystoreRpcs

A public method here is completely superfluous, do not leak it.

JIRA: NETCONF-1116
Change-Id: Ib2789ba44fd1ac00ace1d857a92f859c10b11e0f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoDo not use RpcService in NETCONF components 51/107751/8
Oleksandr Zharov [Thu, 7 Sep 2023 10:32:36 +0000 (12:32 +0200)]
Do not use RpcService in NETCONF components

Migrated usage of RpcService to Rpc<?,?> for NETCONF components.

JIRA: NETCONF-1116
Change-Id: I5a7fa47c961c7eb41cb71dcf08da58399d7011b5
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
8 months agoUse Guava's Escaper for percent-encoding 57/107957/1
Robert Varga [Sat, 23 Sep 2023 00:32:58 +0000 (02:32 +0200)]
Use Guava's Escaper for percent-encoding

We have a chunk of hand-written code which does essentially the same
thing. Trade a bit of memory for the lookup tables to simplify our code.

Change-Id: Ida137aaaa002c7c5c257c586f96fd9723b22e463
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoAdd test for union type 05/106505/24
tobias.pobocik [Fri, 16 Jun 2023 10:29:33 +0000 (12:29 +0200)]
Add test for union type

Previously, a test was missing to make sure that the proper
type was registered in union type.

JIRA: NETCONF-1058
Change-Id: Ifd6ea086014e13de88ffd50bfb6b2fd1eeb05530
Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
8 months agoClean up SSHTransportStack 43/107943/5
Robert Varga [Thu, 21 Sep 2023 15:40:54 +0000 (17:40 +0200)]
Clean up SSHTransportStack

Now that both client and server are initializing their SessionFactory,
we can simply pass down the arguments required for SshIoService down,
so that the stack can handle the dispatch itself.

While we are at it, rename SshIo{Service,Session} to
TransportIo{Service,Session}.

JIRA: NETCONF-590
Change-Id: I3e1b9f638e0fc441b9d68648cd63344caeb72378
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoAdd CompatChannelGroup 44/107944/4
Robert Varga [Thu, 21 Sep 2023 16:38:52 +0000 (18:38 +0200)]
Add CompatChannelGroup

All we really need is the add() operation, which can do absolutely
nothing, everything else is just unused.

Change-Id: Ib105d3486707d56c40fb084b2d5c6e8214d13ba5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoInitialize TransportSshClient.sessionFactory 42/107942/2
Robert Varga [Thu, 21 Sep 2023 15:20:23 +0000 (17:20 +0200)]
Initialize TransportSshClient.sessionFactory

We have a nice field for initializing a reference to the factory. Move
username validation and SessionFactory creation to the Builder.

JIRA: NETCONF-590
Change-Id: I327259e9d94a8bb7ac04a6664eb6133f25d1396d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoAcquire NettyIoServiceFactory from factoryManager 41/107941/2
Robert Varga [Thu, 21 Sep 2023 14:45:24 +0000 (16:45 +0200)]
Acquire NettyIoServiceFactory from factoryManager

Now that we are pushing down IoServiceFactoryFactory, we can rely on
FactoryManager.getIoServiceFactory() to correctly instantiate and cache
the factory.

This also improves things quite a bit, as we are dodging the creation of
a NioEventLoopGroup.

JIRA: NETCONF-590
Change-Id: I15f4a9dd11957b5e54c9a3f5f0c3c9d41bd24146
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoInitialize TransportSshServer.sessionFactory 40/107940/2
Robert Varga [Thu, 21 Sep 2023 14:19:39 +0000 (16:19 +0200)]
Initialize TransportSshServer.sessionFactory

SshServer has a field to hold the associated SessionFactory, which is
normally initialized when the server is started.

We are not starting the server, but we should initialize the session
factory, so that it can be used in other places.

JIRA: NETCONF-590
Change-Id: Ie574c7934c154f069fbc2d6ee48509bff770b481
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoSSH client requires a username 39/107939/2
Robert Varga [Thu, 21 Sep 2023 13:57:05 +0000 (15:57 +0200)]
SSH client requires a username

Leaving the username is not valid configuration. Enforce that.

JIRA: NETCONF-590
Change-Id: I5dcdec4462893771efde81364ac601e964b236d4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoImprove DefinitionGenerator testing 31/106131/37
tobias.pobocik [Thu, 25 May 2023 15:17:13 +0000 (17:17 +0200)]
Improve DefinitionGenerator testing

This commit addresses the lack of test coverage for various sections
within the DefinitionGenerator class. By adding more tests, we
significantly enhance the overall coverage of this class.
This improvement ensures a more robust and reliable testing environment.

JIRA: NETCONF-999
Change-Id: Iac703199c62f56b40dc02ff992e001a7b56554bf
Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
8 months agoEliminate ObjectNode(s) from Operation class 07/107707/11
Oleksandr Zharov [Tue, 5 Sep 2023 11:12:50 +0000 (13:12 +0200)]
Eliminate ObjectNode(s) from Operation class

Removed usage of ObjectNode and ArrayNode in Operation class
and replaced them with proper objects.

JIRA: NETCONF-938
Change-Id: I15d8f64d004141f40f5beebaa21690d32a25b14f
Signed-off-by: Oleksandr Zharov <oleksandr.zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
8 months agoEliminate server from Path class 95/107495/14
Šimon Ukuš [Fri, 25 Aug 2023 11:44:00 +0000 (13:44 +0200)]
Eliminate server from Path class

Remove server from Path. It is unused, and we want to
get rid of ObjectNode(s) and ArrayNode(s).

JIRA: NETCONF-938
Change-Id: I7b8141c38db18c49585a05e427ef64922db4bf6b
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
8 months agoFix incorrect schema reference in root POST link 19/107419/15
Šimon Ukuš [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.

This patch fixes it by passing null value and adding logic
that performs the null checking to construct correct schema reference.

JIRA: NETCONF-1133
Change-Id: I9019dea1874133706f8825b0159e6c571d7b9558
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
8 months agoBind SshClient/SshServer to NettyIoServiceFactoryFactory 35/107935/3
Robert Varga [Thu, 21 Sep 2023 02:53:52 +0000 (04:53 +0200)]
Bind SshClient/SshServer to NettyIoServiceFactoryFactory

Our implementation are captives of SSHTransportStackFactory and
therefore should be bound to a particular EventLoopGroup and not delve
into DefaultIoServiceFactoryFactory's
getDefaultIoServiceFactoryFactoryInstance(), which works with
ServiceLoader.

Pass down NettyIoServiceFactoryFactory to make sure the configuration
does not stray from the path we have set for it.

JIRA: NETCONF-590
Change-Id: I32fc9115a28cb60cae1960293416a62a96529aec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoNorthbound Netconf servers moved to new transport implementation 89/106789/33
Ruslan Kashapov [Mon, 3 Jul 2023 14:51:49 +0000 (17:51 +0300)]
Northbound Netconf servers moved to new transport implementation

Deprecated NetconfServerDispatcher is replaced with usage of new
NetconfServerFactory. Netty thread group provider was added as fix
for incompatible netty-threadgroup-config (nio only, fails with epoll)
from controller project.

JIRA: NETCONF-1106
Change-Id: I076020565b844ac7ddc4dfecc4b23154b825e4bf
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoRequire SubsystemFactory for SSHServer 38/107938/1
Robert Varga [Thu, 21 Sep 2023 12:19:22 +0000 (14:19 +0200)]
Require SubsystemFactory for SSHServer

Creating SSH servers without any subsystem is quite pointless. Require a
SubsystemFactory to be present and configure it directly in
TransportSshServer.

This improves safety and has the added benefit of reducing
ServerFactoryManagerConfigurator.

JIRA: NETCONF-1106
Change-Id: I70d37dbfa71bf13740d1c314b91777368fcf837c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoAdd SSHTransportStackFactory 34/107934/6
Robert Varga [Wed, 20 Sep 2023 21:56:34 +0000 (23:56 +0200)]
Add SSHTransportStackFactory

TransportStack integration with Apache SSHD requires non-trivial
interaction with Netty, as we need to integrate on both I/O and
threadpool/executor levels.

At the end of the day, anything from SSHD needs to run on worker event
loop (group). This in turn requires having control over the worker
EventLoopGroup.

SSHTransportStackFactory is a resource (e.g. it needs to be
lifecycle-managed), which captures the lifecycle of EventLoopGroups
compatible with NettyTransportSupport, i.e. using the best available
technology stack.

This is the new primary entrypoint into this component, with users
expected to create a SSHTransportStackFactory, manage its lifecycle
and create SSH client/servers from it.

JIRA: NETCONF-590
Change-Id: I80622f1595344a83d439717e243295cb4683383c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoIntroduce TransportSsh{Client,Server} 33/107933/6
Robert Varga [Wed, 20 Sep 2023 15:42:26 +0000 (17:42 +0200)]
Introduce TransportSsh{Client,Server}

We are using both SshClient and SshServer, configuring them extensively,
but we never start them.

Introduce proper specializations of SshClient and SshServer, which do
not allow themselves to be start or stopped. Strictly instantiate them
through provided builders, which also serve as hosts for configuration
adaptation.

This reduces clutter in SSH{Client,Server}, making them single-page
classes. Another benefit is that the consistency of SshClient/SshServer
is now checked, with defaults being correctly applied.

JIRA: NETCONF-590
Change-Id: If68714c21fe06de84cdff743c59c08f0f96f884c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoEliminate ObjectNode(s) from Schema class 52/107552/12
Yaroslav Lastivka [Tue, 29 Aug 2023 07:18:50 +0000 (10:18 +0300)]
Eliminate ObjectNode(s) from Schema class

Introduced Property, Xml, Discriminator, ExternalDocumentation records.
All JsonNode fields inside Schema class has been replaced by
corresponding classes or collections. Affected logic has been adapted
to use models instead of JsonNode.

JIRA: NETCONF-938
Change-Id: If3a653b742f977c15a3056675d028a8bdfbd092a
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
8 months agoRemove ChannelInitializerListener 22/107922/3
Robert Varga [Wed, 20 Sep 2023 00:50:45 +0000 (02:50 +0200)]
Remove ChannelInitializerListener

We really have two specializations here, and these will come handy for
our users. Expose BaseTransportServer, which does all the right things.

We ditch the use of the GlobalEventExecutor and use the channel's
EventLoop to allocate Promises.

JIRA: NETCONF-1106
Change-Id: I6a45cdd50a61b31605963cccd75e0da8e10c3333
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoFix ServerFactoryManagerConfigurator-less createSshServer() 21/107921/3
Robert Varga [Wed, 20 Sep 2023 00:14:17 +0000 (02:14 +0200)]
Fix ServerFactoryManagerConfigurator-less createSshServer()

We need to tell the server that we support the NETCONF subsystem,
achieve that through sharing codepaths.

JIRA: NETCONF-1106
Change-Id: I94ff50ea1963a40b9fd4eae9afdc3f45f8e20564
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoRemove FactoryManagerConfigurator 20/107920/2
Robert Varga [Wed, 20 Sep 2023 00:05:56 +0000 (02:05 +0200)]
Remove FactoryManagerConfigurator

This record is really just a simple lambda within its sole user.

JIRA: NETCONF-1106
Change-Id: I8a743b80a57a5f5dffa265276878cba7b1673cdc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoHide SshIoSession 27/107927/1
Robert Varga [Wed, 20 Sep 2023 11:48:25 +0000 (13:48 +0200)]
Hide SshIoSession

This is an implementation detail, hide it from the outside world.

JIRA: NETCONF-590
Change-Id: I7f6c869d73d1024f44693bae7a34596d44bd8389
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoHide SshIoService 26/107926/1
Robert Varga [Wed, 20 Sep 2023 11:20:49 +0000 (13:20 +0200)]
Hide SshIoService

This is just an internal utility, hide it.

Change-Id: I9debd4390b8e57089850c63a6e119e44cb1d0298
JIRA: NETCONF-590
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoClean up onUnderlayChannelEstablished 25/107925/1
Robert Varga [Wed, 20 Sep 2023 10:50:23 +0000 (12:50 +0200)]
Clean up onUnderlayChannelEstablished

Drop unneeded annotation and clean up method implementation.

JIRA: NETCONF-590
Change-Id: Ib0cd36c0a41b32e380dd0e1484d0fec58895020f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoUse HexFormat to percent-encode 09/107909/3
Robert Varga [Mon, 18 Sep 2023 16:30:12 +0000 (18:30 +0200)]
Use HexFormat to percent-encode

We can improve performance of encoding by not going through
String.format()/toUpperCase(), but rather talk directly to HexFormat.

Change-Id: I404673da66693beee6cb853c625cc08fe8f35615
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoDo not use WebApplicationException to report 204 13/107913/4
Robert Varga [Mon, 18 Sep 2023 19:13:57 +0000 (21:13 +0200)]
Do not use WebApplicationException to report 204

Use plain Responses to complete the AsyncResponse here, bypassing the
need to create an exception.

Change-Id: I73457c0a2147035445dd5e5252038c8d6021088a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoRestconf schema source URL provider for yanglib-mdsal-writer 58/107458/9
Ruslan Kashapov [Tue, 29 Aug 2023 11:35:50 +0000 (14:35 +0300)]
Restconf schema source URL provider for yanglib-mdsal-writer

Due to restconf-nb contains the service to download yang
resources it needs the component to provide valid URLs
when yang-library data is constructed.

JIRA: NETCONF-668
Change-Id: I948bc12dd4852ff25cc7a47007c4de8eaa7bc495
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
8 months agoFix PatchStatusBodyWriter's error reporting 77/107877/6
Robert Varga [Thu, 14 Sep 2023 18:06:34 +0000 (20:06 +0200)]
Fix PatchStatusBodyWriter's error reporting

We get errors-paths in YangInstanceIdentifier form, hence we need to go
through proper codec treatment.

JIRA: NETCONF-1130
Change-Id: I62d0173221f7906a6fd67eef1d1a03154e0925bb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoClean up YangInstanceIdentifierSerializer 08/107908/2
Robert Varga [Mon, 18 Sep 2023 16:15:50 +0000 (18:15 +0200)]
Clean up YangInstanceIdentifierSerializer

Eliminate appendQName() and inline it, as it is a common path in
dispatch. Also use local variable type inference and point out fishy
value encoding.

Change-Id: Ic5cc0962fe1a529bbd841b08cee4193d773393c8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 months agoBump upstreams 12/107912/1
Robert Varga [Mon, 18 Sep 2023 17:16:27 +0000 (19:16 +0200)]
Bump upstreams

Adopt:
- yangtools-11.0.2
- mdsal-12.0.2
- controller-8.0.2
- aaa-0.18.2

Change-Id: Iadc1fd5265dbdd7348ac1c0c5abb8d30a9ace424
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoInline checkedGet() 92/107892/2
Robert Varga [Sat, 16 Sep 2023 11:36:31 +0000 (13:36 +0200)]
Inline checkedGet()

This method has only a single caller which we want to evolve further.
Inline it into invokeAction().

JIRA: NETCONF-718
Change-Id: I0c017955ab51ddebf54c8bd6a46495f434fe55b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoMake DatabindContext codecs lazily-loaded 85/107885/2
Robert Varga [Fri, 15 Sep 2023 14:29:33 +0000 (16:29 +0200)]
Make DatabindContext codecs lazily-loaded

We may use temporary DatabindContexts and also we do not necessarily
want to instantiate both XML and JSON codecs for each. Make codec
loading lazy instead, allocated on the first request.

JIRA: NETCONF-773
Change-Id: Ie739629c23457937e73cc2f703b5d3a91989867d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoBind Insert point PathArgument earlier 76/107876/2
Robert Varga [Thu, 14 Sep 2023 17:31:10 +0000 (19:31 +0200)]
Bind Insert point PathArgument earlier

We have a bit of duplicate code in RestconfStrategy, which really should
not be present here. We should be receiving point's value as an
already-baked PathArgument instead.

JIRA: NETCONF-773
Change-Id: I0845ca34a41b0bfe82ada8598cc6a540451c34f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoBind RestconfStrategy to EffectiveModelContext 72/107872/2
Robert Varga [Thu, 14 Sep 2023 14:59:31 +0000 (16:59 +0200)]
Bind RestconfStrategy to EffectiveModelContext

We are passing around EffectiveModelContext like there's no tomorrow.
Let us just bind it to a RestconfStrategy instance.

This allows us to simplify methods all over the place, reducing
cognitive load while navigating them.

JIRA: NETCONF-773
Change-Id: Ibaeb7b865c894c6eaadf65de11147b912534cf93
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoPass correct EffectiveModelContext to readData() 75/107875/1
Robert Varga [Thu, 14 Sep 2023 16:25:50 +0000 (18:25 +0200)]
Pass correct EffectiveModelContext to readData()

This is a mixup -- schemaContextRef is the localModelContext. Fix that
thinko by passing the context from InstanceIdentifierContext.

Change-Id: I67e24334182531c7cc77c0d3e75d68c3fd3f3a96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRefactor NormalizedNodePayload 69/107869/2
Robert Varga [Thu, 14 Sep 2023 11:42:49 +0000 (13:42 +0200)]
Refactor NormalizedNodePayload

Turn this class into a record, with complete non-null semantics.

JIRA: NETCONF-773
Change-Id: I73e35fe4bd55f8382a86de0052839efc7b98be81
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoFix action invocation response 70/107870/1
Robert Varga [Thu, 14 Sep 2023 12:01:29 +0000 (14:01 +0200)]
Fix action invocation response

We should be checking for null here as well, which eliminates the last
user of NormalizedNodePayload.ofNullable().

Change-Id: I1397a6e382f4e8d202e98c3d07e6fd3201d0959a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoEliminate NormalizedNodePayload.headers 67/107867/1
Robert Varga [Thu, 14 Sep 2023 10:20:01 +0000 (12:20 +0200)]
Eliminate NormalizedNodePayload.headers

Convert the only user working with this facility to return a Response,
where it can set the location header directly.

JIRA: NETCONF-1102
Change-Id: Ice969014cf5532ea2cb93d1939cad5edf8c76335
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoDo not use InstanceIdentifierContext in postData() 63/107863/4
Robert Varga [Wed, 13 Sep 2023 20:00:37 +0000 (22:00 +0200)]
Do not use InstanceIdentifierContext in postData()

The variables being passed are trivial, refactor internal wiring to pass
appropriate variables instead.

JIRA: NETCONF-1157
Change-Id: I78de7bce3cd9aee231d8129e83dff54ee12a46f7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoReduce InstanceIdentifierContext proliferation 62/107862/4
Robert Varga [Wed, 13 Sep 2023 19:51:54 +0000 (21:51 +0200)]
Reduce InstanceIdentifierContext proliferation

Use local variable type inference to ease future migrations.

Change-Id: If86fb19df9b64dbbbbdcc94ad99dfa19ac0e19ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoDo not use InstanceIdentifierContext in NormalizedNodePayload 58/107858/5
Robert Varga [Wed, 13 Sep 2023 19:02:45 +0000 (21:02 +0200)]
Do not use InstanceIdentifierContext in NormalizedNodePayload

All writers have been proven to just need the Inference, ditch the
useless indirection through InstanceIdentifierContext.

JIRA: NETCONF-1157
Change-Id: I0f020b9a73198037dba51364b78ec3af7086b8d7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRefactor AbstractNormalizedNodeBodyWriter 57/107857/5
Robert Varga [Wed, 13 Sep 2023 17:27:02 +0000 (19:27 +0200)]
Refactor AbstractNormalizedNodeBodyWriter

AbstractNormalizedNodeBodyWriter so that the three common dispatches are
handled in common code. This also modernizes them and pulls common bits
together.

This allows us to also switch the dispatch logic, so it operates on
SchemaInferenceStack instead of on SchemaNode.

All of this ends up showing that there is a bug in operation output
code, which causes us to emit an unnecessary declaration.

JIRA: NETCONF-1157
Change-Id: Icc781e884cecf7a5d64de63dd65b97e963fd4abe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoDo not use InstanceIdentifierContext in OperationsContent 61/107861/5
Robert Varga [Wed, 13 Sep 2023 19:33:40 +0000 (21:33 +0200)]
Do not use InstanceIdentifierContext in OperationsContent

We are really operating on an Inference, remove the indirection.

JIRA: NETCONF-1157
Change-Id: I382716104f4bd66163b2031fe91f47ad96556612
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoOperationsContent requires a context 60/107860/3
Robert Varga [Wed, 13 Sep 2023 19:14:05 +0000 (21:14 +0200)]
OperationsContent requires a context

All callers are guaranteed to have a non-null context, just ditch the
check.

Change-Id: I23d3d1873a5008b5da8683b665df4bf7e9dd0def
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoShare common parts of AbstractNormalizedNodeBodyWriter 56/107856/3
Robert Varga [Wed, 13 Sep 2023 16:34:47 +0000 (18:34 +0200)]
Share common parts of AbstractNormalizedNodeBodyWriter

The two specializations are doing similar things, let's move them closer
together by sharing the common bits. This has a nice effect of reducing
JAX-RS exposure a tiny bit.

JIRA: NETCONF-1157
Change-Id: I4868a890d77f7a8863e85969f94bcb260cada6ed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoClean up XmlNormalizedNodeBodyWriter 55/107855/3
Robert Varga [Wed, 13 Sep 2023 16:28:22 +0000 (18:28 +0200)]
Clean up XmlNormalizedNodeBodyWriter

We are hunting down the actual state used from
InstanceIdentifierContext, this patch gets us a bit closer and it also
shows we have some oddities going on.

JIRA: NETCONF-1157
Change-Id: I0d623ddf11a00e93d45838ed9d316cee2eb9b715
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoClean up JsonNormalizedNodeBodyWriter 54/107854/3
Robert Varga [Wed, 13 Sep 2023 16:08:56 +0000 (18:08 +0200)]
Clean up JsonNormalizedNodeBodyWriter

We are hunting down the actual state used from
InstanceIdentifierContext, this patch gets us a bit closer and it also
shows we have some oddities going on.

JIRA: NETCONF-1157
Change-Id: I2754cdf7396a16fffc5bc0aedb266bec019c28cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoFix JsonPatchBody javadoc warnings 59/107859/1
Robert Varga [Wed, 13 Sep 2023 19:07:31 +0000 (21:07 +0200)]
Fix JsonPatchBody javadoc warnings

We are using javadoc for private methods. That is wasteful, as the only
real information is a single sentence. Turn that into an ordinary
comment.

Change-Id: I8bb9b0b41c3bb1e782887cb781bf16d2b85618e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoRemove InstanceIdentifierContext from PatchBody parsing 53/107853/1
Robert Varga [Wed, 13 Sep 2023 14:18:50 +0000 (16:18 +0200)]
Remove InstanceIdentifierContext from PatchBody parsing

We only need the path encoded from URL and the EffectiveModelContext.
This also splits the parsing and dispatch to simplifying the code flow.

JIRA: NETCONF-1157
Change-Id: I57be40b5f42da169215987f6ffa29395600e2283
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoMove InstanceIdentifierContext 52/107852/1
Robert Varga [Wed, 13 Sep 2023 12:21:19 +0000 (14:21 +0200)]
Move InstanceIdentifierContext

This is a legacy container, move it to restconf-nb, which is the only
place where it is being used.

JIRA: NETCONF-1157
Change-Id: I5d3690c598b860ea200437801ac00d715b8e8288
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoDisconnect PatchStatusContext from InstanceIdentifierContext 45/107845/4
Robert Varga [Tue, 12 Sep 2023 21:24:17 +0000 (23:24 +0200)]
Disconnect PatchStatusContext from InstanceIdentifierContext

All we need here is a reference to EffectiveModeContext, but later we
should be getting a DatabindContext.

Also highlight an encoding problem, where we are doing the wrong thing
based on YangInstanceIdentitier.toString().

JIRA: NETCONF-1157
Change-Id: I7213e3e02765822824d01139f4fbd590bc5f0e60
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoMigrate Collections references 42/107842/3
Robert Varga [Tue, 12 Sep 2023 18:08:49 +0000 (20:08 +0200)]
Migrate Collections references

Use List.of() instead of Collections. Also be smarter about treating
arrays.

Change-Id: I1674e00e4003587b176df939e250ea81d802453d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoImprove NetconfDataTreeService documentation 41/107841/2
Robert Varga [Tue, 12 Sep 2023 17:35:40 +0000 (19:35 +0200)]
Improve NetconfDataTreeService documentation

Remove XML escapes and spring {@code} elements.

Change-Id: I37f8a7b84bf9668feb56e9ea86d4452d7f7cfe83
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoAdd description to POST requests 67/107467/8
lubos-cicut [Tue, 22 Aug 2023 05:32:19 +0000 (07:32 +0200)]
Add description to POST requests

Add description to POST request (paths/…/post/description)
that states that user in example payload sees only the first
data node child of the resource to be created and that
this is in accordance with RFC 8040 which allows us to
create only one resource in POST request.

JIRA: NETCONF-1137
Change-Id: I8549cf860deb5e069a017c9e7247c0bce311e588
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
9 months agoOpenApi: Remove incorrect list POST requests 86/107086/20
Yaroslav Lastivka [Wed, 26 Jul 2023 15:18:03 +0000 (18:18 +0300)]
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>
9 months agoRefactor OpenApiTestUtils methods 35/107835/3
Ivan Hrasko [Tue, 12 Sep 2023 13:22:15 +0000 (15:22 +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>
9 months agoSkip structural nodes 83/107783/5
Robert Varga [Sun, 10 Sep 2023 15:37:24 +0000 (17:37 +0200)]
Skip structural nodes

We cannot just examine the content being changed, as this could lead
to us trying to report the entire MapNode disappearing -- which does not
have a instance-identifier representation.

JIRA: NETCONF-1152
Change-Id: Ie209b61a0ccd60b07c58ebb11edc518021c80092
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoImprove RestconfStrategy API surface 38/107838/4
Robert Varga [Tue, 12 Sep 2023 15:09:10 +0000 (17:09 +0200)]
Improve RestconfStrategy API surface

We have a number of methods which are only used internally, which formed
our (ugly) API surface. Hide them so we are free to evolve them.

Change-Id: I219d90e5f709c59e98739a73971a577f14659e9f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoUse NormalizedNodeStreamWriter to emit XML data 53/107753/12
Robert Varga [Thu, 7 Sep 2023 11:59:11 +0000 (13:59 +0200)]
Use NormalizedNodeStreamWriter to emit XML data

We are already instantiating NormalizedNode-based writer, which means we
get help in terms for formatting things. This is especially true of
identityrefs and instance-identifiers, where the XML codec does
absolutely the right thing.

This also allows us to ditch namespace repairing from our
XMLWriterFactory, so we are in explicit control of our namespaces.

JIRA: NETCONF-1152
Change-Id: I030d25a8e0b23a78b6c6e952b36395bd461b4c70
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoUse NormalizedNodeStreamWriter to emit JSON data 49/107749/11
Robert Varga [Wed, 6 Sep 2023 23:35:20 +0000 (01:35 +0200)]
Use NormalizedNodeStreamWriter to emit JSON data

We are already instantiating NormalizedNode-based writer, which means we
get help in terms for formatting things.

JIRA: NETCONF-1152
Change-Id: Ie076ba571887c70a94cdd1baf7ea5e1ec6d8e91f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoEliminate (ReadData)TransactionUtil 32/107832/3
Robert Varga [Tue, 12 Sep 2023 11:30:22 +0000 (13:30 +0200)]
Eliminate (ReadData)TransactionUtil

Integrate these utilities directly into RestconfStrategy.

JIRA: NETCONF-1107
Change-Id: Ic0ff3bcc2a7df03c7aa9faf0ac6e94c5b7ef7e96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoCross-relate WithDefaultsParam 27/107827/8
Robert Varga [Tue, 12 Sep 2023 02:52:07 +0000 (04:52 +0200)]
Cross-relate WithDefaultsParam

RFC6243 defines with-defaults-mode typedef, tie it together with
WithDefaultsParam. This improves interoperability with NETCONF.

JIRA: NETCONF-1107
Change-Id: Ia4823f60dcb5d8fc240b3c028a892f9bbe59fa43
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
9 months agoInline readAllData() 26/107826/4
Robert Varga [Tue, 12 Sep 2023 02:19:16 +0000 (04:19 +0200)]
Inline readAllData()

The two methods have simpler callers, remove an indirection by inlining
the code in the corresponding lambda.

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