Robert Varga [Fri, 27 Sep 2024 11:02:10 +0000 (13:02 +0200)]
StorageEntry should not be a Map.Entry
StorageEntry is internal storage and as such it does not follow the
Map.Entry contract -- most notably it has a different hashCode().
Stop claiming we are implementing Map.Entry and instead use Map.entry()
to construct the one to give out to users.
Change-Id: I6ef9900f32d65d129edbbc7aa84e89177ca853e3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Sep 2024 10:43:01 +0000 (12:43 +0200)]
Use a iterator mapping
Each of our entries snapshot is immutable, hence we can use iterator
transforms instead of linearizing to array.
Change-Id: Ic41fbfc35a39db704c78de1ccea5381dfd3ecb8b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Sep 2024 10:30:08 +0000 (12:30 +0200)]
Cleanup plaintext-localfile dependencies
We have superfluous dependencies specified and have them misordered. Fix
both up.
Change-Id: I3101f9f581c3eefeb1e92b4b5673028e3936c980
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Sep 2024 09:52:12 +0000 (11:52 +0200)]
Remove superfluous nullness annotations
Annotations are specified in interface contract, there is no point in
repeating them.
Change-Id: I0c346d62b7c1bde2b5978f7c80b707d601c5fe8a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Sep 2024 09:48:27 +0000 (11:48 +0200)]
Do not use Optional during lookup
We are using Optional only to remap it internally. Rename findByKey() to
lookupEntry() and return a nullable instead.
While we are here, also make sure we reject null keys consistently.
Change-Id: I404247e93e34f3e05405e6e0517d942f6b8a5489
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 26 Sep 2024 14:27:53 +0000 (16:27 +0200)]
Specialize TransportChannelListeners
Take advantage of the ability to cap which TransportChannels a
particular listeners supports. This allows us to eliminate a cast in
RestconfTransportChannelListener.
JIRA: NETCONF-1400
Change-Id: I1f7000b724eb9f94bc28f9cec51f098165d5f722
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 26 Sep 2024 14:18:23 +0000 (16:18 +0200)]
Fix private TransportChanneListener references
Our switch making TransportChanneListener a parameterized interface is
causing quite a few warnings.
This patch addresses warnings private to transport implementations,
without an ABI impact.
JIRA: NETCONF-1400
Change-Id: I5d3aa813f9ef4c859b72e774376031facf614ee5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 26 Sep 2024 12:01:01 +0000 (14:01 +0200)]
Parameterize TransportChannelListener
TransportChannel types are exposed to users and some of them provide
useful information. Allow the TransportChannel type to be specified
for TransportChannelListener.
JIRA: NETCONF-1400
Change-Id: Ia5d589ff2496153ee6909350217bb31a4152b4ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 26 Sep 2024 11:30:52 +0000 (13:30 +0200)]
Propagate Target URI to dispatcher
We need the Target URI in RestconfRequestDispatcher, so that we can
propagate the correct {+restconf} base, as seen by the client, to the
RestconfServer.
JIRA: NETCONF-1379
Change-Id: Iac3fb12bc708f72496f576260c7de7a0fb09c5c7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Sep 2024 10:36:44 +0000 (12:36 +0200)]
Rework resource lookup
RestconfRequestDispatcher is using indirection via PathParameters to
interpret the requested path.
There are multiple problems here:
- the logic is quite undocumented
- there is an overload of PathArguments.EMPTY to report at least two
distinct paths
- we are reporting 409 where we should be reporting 404, as noted in
RFC8040 section 4.3
- the splitting works on decoded path, whereas the ApiPath.parse()
should always we presented with an encoded path
This patch deals with the first three problems, documenting how we are
peeling the path and what gaps there are relative to the specification.
The last problem is marked with a FIXME and will be addressed in a
follow-up patch.
JIRA: NETCONF-1379
Change-Id: I408626a5e328bb938f727d9a549ca8297c9df3a9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Sep 2024 22:59:54 +0000 (00:59 +0200)]
Correct well-known error status code
We are now reporting unimplemented method from RestconfSession, hence
WellKnownResources can report a proper 405 Method Not Allowed by
default.
JIRA: NETCONF-1379
Change-Id: I62c4323e8bc4f4fe0c0f082bffec18dffab55f01
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Sep 2024 16:39:57 +0000 (18:39 +0200)]
Reconstruct Target URI, part two
Reconstructing Target URI from its usual origin-form is a tad more
involved:
1. we need access to the URI scheme being used, which we now have
conveniently available from HTTPTransportChannel
2. we need to ensure we have a Host header, that it contains only one
value and that it is a valid authority
We employ java.net.URI for most of the parsing, combining and error
reporting functions. It also allows us to determine in the uri is in
absolute-form, in which case we can pick it up as is.
We use this URI to initialize QueryStringDecoder, so that its uri()
method reports the complete thing.
JIRA: NETCONF-1379
Change-Id: I6641a613f2fd4c63332ae29b0a876ca32a325a03
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Sep 2024 12:31:06 +0000 (14:31 +0200)]
Reconstruct Target URI, part one
In order to correctly serve our requests, we need to properly
reconstruct target URI, as per HTTP/1.1 spec.
This patch deals with the simplest case, asterisk-form: it is only
allowed for OPTIONS request and reports all methods implemented by
the server. All other methods fails with either status 400.
That necessitates knowledge as to what methods are requested, hence
we have a statically-populated Set.
JIRA: NETCONF-1379
Change-Id: Id37044799460759d1066ad7a17524ee0c0284060
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Sep 2024 18:48:46 +0000 (20:48 +0200)]
Expose HttpScheme from HTTPTransportChannel
Downstream users may need to inquire as to whether the channel is secure
or not -- for example to follow RFC9110 Target URI construction.
Expose HttpScheme from HTTPTransportChannel, so that this information is
readility available.
JIRA: NETCONF-1379
Change-Id: Iba7f847246ab9c88a9804caba803f22ab704f406
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Sep 2024 19:13:36 +0000 (21:13 +0200)]
Specialize HTTPClient
We know statically whether a particular client is TLS-enabled, so use
two subclasses, each specialized for the task.
JIRA: NETCONF-1379
Change-Id: Ib46a3c779dd2f3bdf060561a754180f099fdc997
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Sep 2024 22:56:46 +0000 (00:56 +0200)]
Move ResponseUtils.optionsResponse()
This method is only called from RestconfRequestDispatcher. Move it there
and simplify it by bypassing ResponseBuilder's complexities.
JIRA: NETCONF-1379
Change-Id: Ie7647fcc2eab6b8c1c9112da55283efb1b5819ae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Sep 2024 22:42:19 +0000 (00:42 +0200)]
Clean up NettyServerRequest subclasses
Almost all anonymous NettyServerRequest subclasses are inefficient in
that they retain RequestParameters twice:
- once in NettyServerRequest
- once via reference to 'params' method argument
Make sure we reference NettyServerRequest.requestParams instead of
params, reducing memory overhead of each request.
JIRA: NETCONF-1379
Change-Id: I0f7df86dbd8681f2d4e92f7dabefb6f6820709ef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Sep 2024 22:35:36 +0000 (00:35 +0200)]
Add FormattableServerRequest
We have two distinct NettyServerRequest subclasses doing exactly the
same thing. Share a single FormattableServerRequest class between the
two code paths.
JIRA: NETCONF-1379
Change-Id: Id30306ce9073afdd73d790282d3a023dde2c4c07
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Sep 2024 22:03:41 +0000 (00:03 +0200)]
Introduce RestconfRequest
The use of FutureCallback is misleading and not very well controlled.
Introduce RestconfRequest, which shows that the onFailure() path is
never taken.
This also provides us with an anchor point for future evolution, as we
must be mindful of asynchronous processing. The requirements are laid
down in a FIXME, which we will address in future improvements.
JIRA: NETCONF-1379
Change-Id: I3e9a25ce6932498654567c12ea431417e27a2c7b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Sep 2024 21:31:57 +0000 (23:31 +0200)]
Do not pass around RestconfServer
Now that we have localized request dispatch, we can access
RestconfServer via RestconfRequestDispatcher's field rather than passing
it around to static methods.
JIRA: NETCONF-1379
Change-Id: Ie1fd87d1f873b86d46ce68e8e127b13c4e13d5d8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Sangwook Ha [Wed, 25 Sep 2024 20:32:10 +0000 (13:32 -0700)]
Limit the number of candidates for string example
The number of candidates tried when a string example is generated
with regex & length constraints may increase exponentially as the
string length increases and this may cause out-of-memory error.
For example, if there are 10 transition paths at each step, then
the number of candidates becomes 1 million after just 6 characters.
Limit the maximum number of transitions allowed at each step to prevent
the exponential growth in search paths. This reduces the chance of
generating a conformant example a little, but prevents excessive use
of memory and CPU cycles.
JIRA: NETCONF-1398
Change-Id: I2d926a438da14395f56f93d1a98a56507c1c7ff2
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Robert Varga [Wed, 25 Sep 2024 04:19:30 +0000 (06:19 +0200)]
Do not use LinkedList in plaintext-*
Use an ArrayList instead.
Change-Id: I95676a3d3db5870d09d40c54151439d2e1667dd0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Sep 2024 21:12:48 +0000 (23:12 +0200)]
Eliminate RequestUtils
The only production caller is RestconfRequestDispatcher, move these
utility methods there.
Hide them and ensure AbstractRequestProcessorTest uses explicit
calls to ApiPath.parse().
JIRA: NETCONF-1379
Change-Id: I8f5c69f57d23f9bd74e9f49d0519f8e078c2c6da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Sep 2024 21:04:09 +0000 (23:04 +0200)]
Eliminate ModulesRequestProcessor
RestconfRequestDispatcher can host the static methods just as well, and
such organization is actually conducive to structuring dispatch based on
needs, rather than upfront parsing.
Also updates RFC references to point to their canonical web presence.
JIRA: NETCONF-1379
Change-Id: I268ba415f30daf492fe12573a3b09bb9ed8b3a6f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Sep 2024 20:56:50 +0000 (22:56 +0200)]
Eliminate OperationsRequestProcessor
RestconfRequestDispatcher can host the static methods just as well, and
such organization is actually conducive to structuring dispatch based on
needs, rather than upfront parsing.
Also updates RFC references to point to their canonical web presence.
JIRA: NETCONF-1379
Change-Id: Ib51a3c83de9400c61304d99d4a3b21f99f502045
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Sep 2024 20:45:21 +0000 (22:45 +0200)]
Eliminate DataRequestProcessor
RestconfRequestDispatcher can host the static methods just as well, and
such organization is actually conducive to structuring dispatch based on
needs, rather than upfront parsing.
Also updates RFC references to point to their canonical web presence.
JIRA: NETCONF-1379
Change-Id: I0ec4cdd2634cd707e5bbcef2617e4eebc3173923
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Ivan Hrasko [Mon, 23 Sep 2024 12:56:53 +0000 (14:56 +0200)]
Clarify FIXME for NETCONF-714
Clarify FIXME in NettyServerRequest to be part of NETCONF-714.
JIRA: NETCONF-714.
Change-Id: Idf7192ff65fd9d48a7d8d00f22b15c294a7faa49
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Ruslan Kashapov [Fri, 6 Sep 2024 08:29:53 +0000 (11:29 +0300)]
Fix testtool request failure to netty endpoint
Testtool uses java's HttpClient which includes
HTTP/2 upgrade headers by default when PATCH requests
being sent. This results 413 Entry too large response
from Netty-based server because HttpServerUpgradeHandler
is not expecting non-empty request body with
protocol upgrade request.
The fix limits protocol version for HttpClient to
HTTP 1.1 to omit upgrade headers.
JIRA: NETCONF-1376
Change-Id: I2c07edce78b521417cf073f5c0d757e58f557c91
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Ruslan Kashapov [Fri, 6 Sep 2024 08:29:53 +0000 (11:29 +0300)]
Fix 401 Response headers for HTTP Transport
Auth handler updated to return WWW-Authenticate
header with 401 Unauthorized response.
JIRA: NETCONF-1394
Change-Id: I018b7c37ec08eae4525355001265f4151bafa298
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Robert Varga [Thu, 19 Sep 2024 12:08:56 +0000 (14:08 +0200)]
Bump versions to 8.0.3-SNAPSHOT
This starts the next development iteration.
Change-Id: I02b4ab07c5385f86af946b821f1ede30d58b4ce9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
jenkins-releng [Thu, 19 Sep 2024 10:42:16 +0000 (10:42 +0000)]
Release netconf
Robert Varga [Wed, 18 Sep 2024 15:18:45 +0000 (17:18 +0200)]
Dispatch OPTIONS requests to RestconfServer
RestconfServer is providing guidance as to what kind of resource a
particular path represents. We take advantage of this, to ensure parity
with JaxRsRestconf.
JIRA: NETCONF-1210
Change-Id: Iab8aa05f2183f5f0f9b5f9d283bea9cdd9579eb6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 19 Sep 2024 08:43:24 +0000 (10:43 +0200)]
Fixup OptionsResult
We need to differentiate between RPCs and actions, an unfortunate
side-effect of difference of their invocation modeling.
Split OPERATION into ACTION and RPC, and report them as appropriate.
JIRA: NETCONF-1210
Change-Id: Ia9948998ffedb4e7ff1025cb4e268ffeb1a68ad9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Samuel Schneider [Mon, 16 Sep 2024 15:38:42 +0000 (17:38 +0200)]
Adapt docs for netconf-node state encapsulation
Adapt user guide to changes caused by netconf-node state
encapsulation.
JIRA: NETCONF-1388
Change-Id: I477f14e814c0d4dfa3833454b8803c2a72fdc18e
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Ruslan Kashapov [Fri, 13 Sep 2024 09:42:01 +0000 (12:42 +0300)]
Fix stream URLs for Netty RESTCONF
Restconf URI passed for URL construction require to be ended
with slash otherwise last path element will be dropped by URI#resolve.
JIRA: NETCONF-1390
Change-Id: I1707b8460741bd99a971359fd152152b60440c8c
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Robert Varga [Mon, 16 Sep 2024 09:14:14 +0000 (11:14 +0200)]
Translate RpcCredentials with a switch expression
We have an if/else cascade here, use a switch expression instead.
Change-Id: I6d98c2fcd07ab06f9a161ed663864b00347686ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 9 Sep 2024 19:27:44 +0000 (21:27 +0200)]
Encapsulate netconf-node state
Encapsulate netconf device related configuration into its own container.
So mandatory credentials requirement is not enforced for anyone who is
not writing that container.
This allows using other custom topologies without issues.
JIRA: NETCONF-1382
Change-Id: If015222df4b4a885c832f8de35f3c482e9dfbc2a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Robert Varga [Mon, 9 Sep 2024 15:48:50 +0000 (17:48 +0200)]
Add {data,operations}OPTIONS() methods
JAX-RS endpoint is doing a number of bad things w.r.t OPTIONS:
- it does not produce Accept-Patch header
- it exposes implementation structure via WADL
- it is not accurate for /data/* resources
Enrich RestconfServer API to allow querying the nature of a particular
data item and existence of operations -- which in turn allows us to
report accurate OPTIONS.
JIRA: NETCONF-1210
Change-Id: Iee4171eb9500bb996a63e682c946c20d6e401145
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Peter Suna [Thu, 12 Sep 2024 16:32:09 +0000 (18:32 +0200)]
Set correct SchemaInferenceStack for list example
In the method prepareFirstListExample, SchemaInferenceStack points
to the list, which is incorrect as we are processing its child.
This method is called only when the min-elements constraint is set.
JIRA: NETCONF-1389
Change-Id: I4ffb371751a71012ead461837f775a89957fd111
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Sangwook Ha [Fri, 13 Sep 2024 04:03:03 +0000 (21:03 -0700)]
Fix string example generation error
Following a single regex transition path does not guarantee an example
conforming to the regex & length constraints.
Search all transition paths adding a character at a time until the
minimum length requirement & regex pattern are satisfied or the maximum
length limit is reached.
This guarantees the shortest possible example that satisfies the regex
& length constraints.
JIRA: NETCONF-1386
Change-Id: Ib7b7714330b5176541fe928dc5660c20579f8b2d
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Robert Varga [Fri, 6 Sep 2024 09:50:11 +0000 (11:50 +0200)]
Eliminate Http2SettingsFilter
We need Http2SettingsFilter only because Http2Utils.connectionHandler()
configures Http2ToHttpAdapter to send it out.
Do not override the default configuration, leading to HTTPClient's
adapter not sending these -- and hence we can ditch the filter.
JIRA: NETCONF-1379
Change-Id: I0be0ec6b7375b12c183bc2076276c0c6932455ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 11 Sep 2024 15:46:23 +0000 (17:46 +0200)]
Clean up restconf-nb dependencies
The dependencies are quite inaccurate now, clean them a up a bit.
Change-Id: I19229a1f8d9027173ea1f42f5fdfa90d336a2acc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 12 Sep 2024 08:01:04 +0000 (10:01 +0200)]
Clean up odl-restconf-nb
Clean up packaging, so we do not pull in duplicate bundles.
Change-Id: I379e1ebbdb203c23c0d8ae21554d04b9e3f32203
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 11 Sep 2024 16:11:37 +0000 (18:11 +0200)]
Add odl-restconf-(server-)api
Package restconf-api as a separate feature, so that it can be used from
other places.
Change-Id: I5b40e2814ec15b78b74948c1e2120010425dca7d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 11 Sep 2024 10:39:37 +0000 (12:39 +0200)]
Move restconf-server-jaxrs tests
Move tests into the artifact they are actually testing.
Change-Id: I2d504bcd40c98bb9f0bead309c7e5c7ef6c8e0bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 11 Sep 2024 14:20:38 +0000 (16:20 +0200)]
Package transport-http in odl-netconf-transport
transport-http does not have a home. Make sure to include it in
odl-netconf-transport.
JIRA: NETCONF-1379
Change-Id: Ia6d12e1866a1eb22609586aee578015bb11688d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 10 Sep 2024 14:06:52 +0000 (16:06 +0200)]
Integrate transformation to NettyServerRequest
Make NettyServerRequest abstract, with a transform() method. This makes
it clear what specializations we have and also reduces the amount of
objects we allocate.
JIRA: NETCONF-1379
Change-Id: Ifddc410b929f6b8e64adbf2e94c40bc08856fea5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 11 Sep 2024 08:17:51 +0000 (10:17 +0200)]
Slice XRD/JRD resource
We need to use ByteBuf.slice() so the reader index on shared buffer does
not get updated.
JIRA: NETCONF-1379
Change-Id: Ibd69b480748094fbbe227ef767f47f14b91943cb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 10 Sep 2024 14:14:58 +0000 (16:14 +0200)]
Use a switch expression with DataPostResult
We have a sealed hierarchy, hence using a switch expression is
exhaustive and we can eliminate an impossible case. The same thing
applies to both RESTCONF endpoints.
Change-Id: Ia06223bbccb7fda2a33c67cc129c04cd1cc4a335
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 9 Sep 2024 15:09:50 +0000 (17:09 +0200)]
Use OPTIONS * for upgrade
GET / is a resource operation, which may result a ton of data, be
subject to access control, or actually be unimplemented.
Use OPTIONS *, which is well-documented to be a 'no-op' kind of HTTP
request.
Change-Id: I9e112ffa1817d09b77109171a3a221ed34c9bf6b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 9 Sep 2024 14:21:13 +0000 (16:21 +0200)]
Advertize "defaults" RESTCONF capability
Advertizement of "defaults" RESTCONF capability is mandatory, yet we do
not do that.
Advertize it with basic-mode=explicit, which most closely matches the
semantics of the MD-SAL datastore.
JIRA: NETCONF-1380
Change-Id: I48577e606383fc7413a3cd2e95a5c8cbb52fb49f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 10 Sep 2024 11:31:26 +0000 (13:31 +0200)]
Do not use karaf-services-maven-plugin
We are not really using services -- just publishing Karaf commands.
Add the MANIFEST header and ditch use of karaf-services-maven-plugin --
fixing a build-time warnings and eliminating the unnecessary code it
packages in the bundle.
Change-Id: Ia9dc9cf8f837ac77f0f9998a2943dc1bd73f5712
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 10 Sep 2024 11:24:05 +0000 (13:24 +0200)]
Fix truststore-api dependencies
We are using nullness annotations, declare them to fix a warning.
Change-Id: I6ed2b81420fecb2023038b773cfaf3db2683ece8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 10 Sep 2024 11:23:11 +0000 (13:23 +0200)]
Fix dependency issues in keystore/*
We have two dependency issues reported here, fix them up.
Change-Id: I9bdcc0ae7c7ca4289276e2d445ea6b34e20877bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 9 Sep 2024 23:13:17 +0000 (01:13 +0200)]
Fix create-notification-stream implementation
We have a mismatch in the output leaf name, as sal-remote.yang has a
day-0 modeling bug: what was supposed to be 'stream-name' is named
'notification-stream-identifier' instead.
Fix the implementation to use the correct container.
JIRA: NETCONF-1295
Change-Id: I9ea3d4b3bb6c70b4c087e597f67456a9a095f789
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 7 Sep 2024 20:46:20 +0000 (22:46 +0200)]
Eliminate ResponseUtils.allowHeaderValue()
This creates a static string, from a set of methods. Rather than
performing magic, let's use hand-crafted equivalents.
Also do not share these strings with tests, but rather have tests assert
them separately.
JIRA: NETCONF-1379
Change-Id: Id241430ac633f3bb8c1166dea3e65c34c9266975
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 7 Sep 2024 20:33:05 +0000 (22:33 +0200)]
Eliminate restconf.server.Method
This enum might look like it is useful until, but it really is not: we
can equally well use HttpMethod and switch on HttpMethod.name().
JIRA: NETCONF-1379
Change-Id: I30db6a5dca57270f9a774298906d10a327816c3a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 7 Sep 2024 11:28:57 +0000 (13:28 +0200)]
Split out WellKnownResources
Well-known resources are extremely simple to service, as they take only
a few inputs and produce an immediate response.
Split them out into their own class and execute them immediately from
RestconfSession. This allows us to report '501 Not Implemented' for
unimplemented methods, along with 'Allow' header hinting at what is
implemented.
JIRA: NETCONF-1379
Change-Id: I91af1aee99e2ffb2bf05d6833d64dd8471a40765
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 6 Sep 2024 08:39:24 +0000 (10:39 +0200)]
Take ownership of request message
We have asynchronous processing here, hence
SimpleChannelInboundHandler's defaults are working against us.
Switch off autoRelease, hence we do not need to issue retain().
JIRA: NETCONF-1379
Change-Id: If4d86111c97122638f17bed52805468d2c3de240
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 5 Sep 2024 15:33:35 +0000 (17:33 +0200)]
Expose ServerSseHandler
Rather than hiding this handler behind a simple SseUtils method, expose
it to the outside world, so it can be used directly by NettyRestconf's
initialization code.
JIRA: NETCONF-1379
Change-Id: Ia3d2a19525115323b7d613053f561dd169a1c760
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2024 23:52:57 +0000 (01:52 +0200)]
Disconnect HTTPServer from RequestDispatcher
RequestDispatcher is useless layering violation sitting between Netty
pipeline and RESTCONF protocol implementation.
Do not use RequestDispatcher in HTTPServer and instead use
onTransportChannelEstablished() to wire a RestconfSession into the
pipeline.
This means we have centralized protocol-level initialization at the
correct layer and a proper class interfacing between a particular Netty
channel and the RestconfServer.
RestconfRequestDispatcher now becomes a private implementation detail,
acting as a the common router between RestconfSession and
RestconfServer (et al.).
A follow-up patch will deal with exposing RestconfSession from
NettyServerRequest.
JIRA: NETCONF-1379
Change-Id: Ie24e440dbf24a850428902076175fb569981d0d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 9 Sep 2024 22:24:17 +0000 (00:24 +0200)]
Rename CreateNotificationStreamRpcTest
This is really testing CreateDataChangeEventSubscriptionRpc, rename it
accordingly.
Change-Id: Icb0a151c8d2d9b2c5397f5426529a170638e178a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 9 Sep 2024 22:19:53 +0000 (00:19 +0200)]
Clean up CreateNotificationStreamRpc
Use CreateNotificationStreamOutput instead of
CreateDataChangeEventSubscriptionOutput, just for consistency's sake.
Change-Id: Ia5f4734a2763848592a16bb407f1898a3f272014
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 9 Sep 2024 15:50:12 +0000 (17:50 +0200)]
Fix ietf-restconf.yang reference
We have a typo in Javadoc, fix that.
Change-Id: I464c854bda2e5a11b986d85979775e234050996f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 9 Sep 2024 13:32:11 +0000 (15:32 +0200)]
Advertize :yang-patch capability
We support yang-patch media type, hence we should be advertizing that
capability.
JIRA: NETCONF-1365
Change-Id: I0aec76d5e1558b1116d72e8ba60ead34e3b46e75
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 9 Sep 2024 13:29:25 +0000 (15:29 +0200)]
Deprecate capabilityUri() methods
We have the capability strings centralized in CapabilityURI class, hence
we do not need them in individual parameters. Deprecate them for
removal.
Change-Id: I4ec07a2109ed3967079e140a02c1f92c6f2fd453
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 9 Sep 2024 13:01:18 +0000 (15:01 +0200)]
Add restconf.api.CapabilityURN
We are missing a few key capabilities, simply because we are exposing
only capabilities tied to query parameters.
This patch adds restconf.api.CapabilityURN with current contents of the
corresponding IANA registry, along with ODL-specific capabilities --
mirroring what we have in netconf.api.CapabilityURN.
Change-Id: I418feb6784c732b14f9e2b1c2c91dcfec87699ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2024 22:51:11 +0000 (00:51 +0200)]
Factor out RestconfTransportChannelListener
Pipeline initialization for transport channels sits in an anonymous
class, make it non-obvious as to what its actual role should be.
Split it out into RestconfTransportChannelListener, making it
independent of NettyEndpoint.
JIRA: NETCONF-1379
Change-Id: Ia1a45dfa957f737923aca5e0da3b99004fe727c3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 9 Sep 2024 13:04:53 +0000 (15:04 +0200)]
Fixup restconf-server-mdsal module definition
We require the ietf-restconf-monitoring module, make sure we advertize
that.
Change-Id: I6c3dd01c14ba92001bbcd59d2f68e9f6bcff8cd5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 6 Sep 2024 12:55:14 +0000 (14:55 +0200)]
Fix host meta template constants
The strings should be proper constants, so they can be inlined.
Change-Id: I7ab918b7f7863c70d6f8bb6f286bd2a5934af5c1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 5 Sep 2024 12:48:36 +0000 (14:48 +0200)]
Refactor HTTPServer pipeline initialization
The pipeline should be initialized immediately when the channel is
brought up, so that we do not require additional client-side operations
before it is visible the the server side.
This necessitates smarter operations on the pipeline, so that we keep
RequestDispatcher at the last position.
Change-Id: If0f0b0456407ab2b6457c1a34565c87f61c433d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2024 22:24:43 +0000 (00:24 +0200)]
Fix heartbeat overflow
sseHeartbeatIntervalMillis is an Uint32, hence it is wrong to assume its
value can safely fit in an int.
Use .toJava() instead, which returns a proper long, exposing the fact
that ServerSseHandler is using the wrong type.
Change-Id: I309bc441c56d1052c3ea013dd8e33db4c80490cc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2024 19:16:39 +0000 (21:16 +0200)]
Clean up OSGINorthbound.newNettyEndpointProps()
We have a magic check for URI scheme -- i.e. if we grow a different
transport, we might happily be using 'http' without ever realizing it.
Refactor logic to make it absolutely clear which cases we handle, so
that there can be no mistakes.
Also clean up obvious gaps in semantics of objects we create and add
FIXMEs/TODOs for follow-ups.
Change-Id: I5a5b812d137fc4d665cfa457a1df1d5bbe4968e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 5 Sep 2024 14:55:54 +0000 (16:55 +0200)]
Use simple concatenation in SseUtils.chunkOf()
Using a simple concatenation improves performance. It also eliminates
the need for @SuppressFBWarnings and making transport-http independent
of spotbugs-annotations.
Change-Id: I2ab11adc679f01b217b21ab847c3e3a96fbdc99b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 5 Sep 2024 09:04:24 +0000 (11:04 +0200)]
Enforce strict stubbing in transport-tcp
Make sure our mocks are throughly stubbed by pulling in
mockito-configuration.
Change-Id: I2ee6f13fa9adeab187a24698ed313f9f733b733f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2024 17:43:50 +0000 (19:43 +0200)]
Separate out Http2SettingsFilter
Http2Utils.clientSettingsHandler() is a stateless thing. Separate it out
into a dedicated class, which has a singleton instance shared across all
channels that need it.
Change-Id: I5136b43286c01ad6caa4a3ec11a814e239217dcd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2024 17:27:48 +0000 (19:27 +0200)]
Split up HTTPServer
HTTPServer is either backed by TCP or TLS, each of which has a different
flow setup. Specialize the two so we do not need to muck around with
SslHandler.
Change-Id: I91563aad1c3c924a5cb63a47c76df8e706e11a1c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2024 12:09:44 +0000 (14:09 +0200)]
Clean up HTTPTransportStack, part two
Eliminate HttpChannelInitializer, as both implementations can easily be
integrated into HTTP{Client,Server}.
This also eliminates needless juggling of channel pipeline, as the
channel is always functional by the time we are initializing.
Change-Id: I228de5c6e5bbb301b2984c62a465900e3ecb3a22
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2024 11:30:25 +0000 (13:30 +0200)]
Clean up HTTPTransportStack, part one
A number of cleanups:
- channelInitializer should be private
- naming should be consistent
- superfluous annotations should not be present
Change-Id: I2843f9967ad85c30df366cbc81adc5dcbbb1f89d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2024 13:00:43 +0000 (15:00 +0200)]
Expose {SSH,TLS}TransportChannel
Knowing the identity of underlying TransportChannel is needed to
accurately report their type. Expose the two implementations, as
{TCP,HTTP}TransportChannel are already exposed.
Change-Id: Iaaca2b92b1df9bedbb278f8c0f0e9d48c617e3d6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2024 11:29:33 +0000 (13:29 +0200)]
Clean up HTTPTransportChannel
This class should be final and should only be instantiated from the same
package.
Change-Id: I3261f983b8db52b5405f31b41a3adb69e4c352d6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2024 09:13:02 +0000 (11:13 +0200)]
Use enhanced switch for transport dispatch
We have two supported possibilities, use a switch to discern them.
Change-Id: Ica6c7529aad0366caf8c413bc58a5ddc63481e5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
lubos-cicut [Thu, 8 Aug 2024 08:57:25 +0000 (10:57 +0200)]
OpenAPI: add metadata endpoint
Added endpoints for pagination metadata.
/single/meta(?offset=0&limit=5)
/mounts/{instance}/meta(?offset=0&limit=5)
Created MetadataStream and MetadataEntity to provide metadata
which would be valuable for end users.
JIRA: NETCONF-1344
Change-Id: I14e476ac4266e48953e9faaca80782fa891d03d3
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Robert Varga [Tue, 3 Sep 2024 17:56:36 +0000 (19:56 +0200)]
Bump versions to 8.0.2-SNAPSHOT
This starts the next development iteration.
Change-Id: Ie0a8f46a47852bb05891a6ff422feb7360a110e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
jenkins-releng [Tue, 3 Sep 2024 16:36:25 +0000 (16:36 +0000)]
Release netconf
Robert Varga [Tue, 3 Sep 2024 12:35:08 +0000 (14:35 +0200)]
Bump upstreams
Adopt:
- odlparent-14.0.3
- infrautils-7.0.3
- yangtools-14.0.4
- mdsal-14.0.2
- controller-10.0.2
- aaa-0.20.1
Change-Id: I035b5e0002f01a54b0ec6971c33aa021aa757ee4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 3 Sep 2024 08:29:06 +0000 (10:29 +0200)]
Fix superfluous nullness annoutations
We have @NonNullByDefault -- there's no point in @NonNulls.
JIRA: NETCONF-1366
Change-Id: Ib579eddd14dba2ab2f05fdfac61fcb224730a4e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 3 Sep 2024 08:26:10 +0000 (10:26 +0200)]
Add missing return
We should not be invoking callbacks twice -- make sure to return.
JIRA: NETCONF-1366
Change-Id: If7d5e4c2791187e23b13ae0270e98a44faba5746
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 3 Sep 2024 08:13:08 +0000 (10:13 +0200)]
Advertize :interleave capability
We support interleave, i.e. concurrent use of RPCs and notifications.
Advertize this fact.
JIRA: NETCONF-1374
Change-Id: I9028814398a8355d8f4a970ab5e7731d7983d78b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 3 Sep 2024 07:23:30 +0000 (09:23 +0200)]
Revert "Check for netconf interleave capability"
This reverts commit
c2cfd0608b41775f9e71904de14b453ad9d2ca59, as it does
not present a complete solution.
JIRA: NETCONF-1375
Change-Id: If7052257472a72f44f0e39401e630c691f13c64c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 29 Aug 2024 08:08:25 +0000 (10:08 +0200)]
Do not copy constant bytebufs
Three things:
- use plain byte[] to make it clear we are using US_ASCII
- ensure the constant is a read-only buffer
- use .retainedSlice() instead of .copy()
JIRA: NETCONF-1366
Change-Id: I08c56ccdbe47db1e2e07e4bbf20607c9ab678681
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 29 Aug 2024 03:54:28 +0000 (05:54 +0200)]
Convert restconf-server to bnd-parent
This is a simple artifact, make sure we use bnd-parent substrate to keep
it modern.
JIRA: NETCONF-873
Change-Id: Iadf313ec6affc426dd8270a9dff8ec04ffaaa401
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 29 Aug 2024 04:21:03 +0000 (06:21 +0200)]
Fix Date import slopiness
We are using java.util.Date, not java.sql.Date.
JIRA: NETCONF-873
Change-Id: I793da328fcd4625a39db640f18ba4d1cb5afb028
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 29 Aug 2024 03:53:18 +0000 (05:53 +0200)]
Clean up restconf-server dependencies
We have a ton of unused dependencies here, clean them up.
JIRA: NETCONF-873
Change-Id: Ic602b052ba9cb68ee851942fa73d667c29186234
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 30 Aug 2024 06:09:53 +0000 (08:09 +0200)]
Revert "Fix jira link"
This reverts commit
c5f2790eed5c7989d74191e0b2b92474c897849c, as the
underlying problem has been resolved.
Change-Id: I9c6511645057adf3e35ac0da738821f064d4fb7d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 11 Aug 2024 07:45:27 +0000 (09:45 +0200)]
Split out JavaCommonCounters
We are maintaining a native view of CommonCounters, which are defined to
be wrapping unsigned 32bit counters.
Our intermal use does not correctly truncate these, as the original code
got confused by 'Long' representing 'uint32' in Binding long time ago.
There is no need to store these counters in long form -- we can convert
that on demand via a newly-introduced JavaCommonCounters -- which extend
CommonCounters, i.e. the Binding interface generated for the grouping.
Add two implementations, mutable and immutable, and expose the ability
to increment as MutableJavaCommonCounters.
This allows us to to expose the read-only view from NetconfServerSession
without giving users access to directly modify them -- making the class
more convenient.
One side effect of us implementing CommonCounters is that we can use
SessionBuilder(CommonCounters) constructor, which performs an automatic
initialization to current state.
Change-Id: I9287fb1a8d552f236f649c84cfefdf9433c09a5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 11 Aug 2024 04:35:10 +0000 (06:35 +0200)]
Derive SourceHost from Channel.remoteAddress()
This removes reliance on hello backchannel for source host information.
It ends up removing a chunk of code.
Change-Id: I7c2897ce3b506af7fdc19123de5e94b0e8f22959
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 11 Aug 2024 02:17:38 +0000 (04:17 +0200)]
Deprecate NetconfHelloMessageAdditionalHeader
This class should not exist, but getting rid of it requires us to do
quite some work, which in turn has impacts in netconf-{codec,netty-util}
and perhaps somewhere else as well.
Deprecate this class for removal to drive its replacements. Also provide
a lot of FIXMEs explaining the various changes to
netconf-{api,codec,client,server} that need to happen to solidify the
pipeline layout, the fool-proof the end user APIs and provide reliable
operation.
Change-Id: I8ec055dc6f032df3171cd0dddc78f33498956fde
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 11 Aug 2024 08:59:55 +0000 (10:59 +0200)]
Refactor ThreadLocalTransformers
Rather than being a plain holder class with duplicated code for each
constant, rename the class ThreadLocalTransformer so that it extends
ThreadLocal<Transformer>, being abstract and requiring instances to
provide configure() method.
The instances themselves have a nice place in MessageWriter, as that
is where they are used.
Since we have a dedicated class and constants, these replace the boolean
-- instead we store the reference to the ThreadLocalTransformer instance
which produces corresponding transformers.
The equivalent of getters is provided by ThreadLocalTransformer.get(),
i.e. getPrettyTransformer() becomes PRETTY_TRANSFORMER.get() without any
intermediates.
Since we are in the area, let's not access the thread local immediately
-- expose threadLocalTransformer(), which just does ThreadLocal.get(),
so that subclasses defer access to when they actually need it.
Change-Id: I3e641e2f8fd3406052e04e15af9a6a74247d9777
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 11 Aug 2024 08:27:12 +0000 (10:27 +0200)]
Move {Hello,XML}XMLMessageWriter
XMLMessageWriter is a well-defined writer, independent of anything else
in netconf.nettyutil. Move it to netconf.codec, whence it can be freely
used without bringing in nettyutil baggage.
Change-Id: Id2d2ed69db2b01d053b723df41d0a99c392aa06b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>