yangtools.git
5 years agoRemove NormalizedNodePruner.findSchemaNodeForNodePath()
Robert Varga [Thu, 28 Mar 2019 10:16:27 +0000 (11:16 +0100)]
Remove NormalizedNodePruner.findSchemaNodeForNodePath()

DataSchemaContextTree.findChild() provides equivalent functionality,
so use that instead of brewing our own.

JIRA: CONTROLLER-1887
Change-Id: Ia55ac99ce8fa37daf06ce0e7e1615f1bd0a07123
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDo not use Optional in NormalizedNodeWrapper
Robert Varga [Thu, 28 Mar 2019 09:58:49 +0000 (10:58 +0100)]
Do not use Optional in NormalizedNodeWrapper

Use nullable schema instead, as the caller is package-private and
ends up unpacking the return anyway. This simplifies
NormalizedNodePruner a bit.

JIRA: CONTROLLER-1887
Change-Id: I395dd8266bd7198f66890c4ae3633ecda9281726
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoHide NormalizedNodeBuilderWrapper
Robert Varga [Thu, 28 Mar 2019 07:48:02 +0000 (08:48 +0100)]
Hide NormalizedNodeBuilderWrapper

This class is not instantiable outside of the package is it does
not leak from NormalizedNodePruner -- therefore it cannot be used
by anyone else. Make sure it's package-private and clean it up
a bit.

JIRA: CONTROLLER-1887
Change-Id: I17911508273d68c2795d38e2156c9407522f55fe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove NormalizedNodePruner.SimpleStack
Robert Varga [Wed, 27 Mar 2019 22:51:57 +0000 (23:51 +0100)]
Remove NormalizedNodePruner.SimpleStack

This custom implementation is highly inefficient, because:
1) peek/pop operations perform get(int) and remove(int) operations
   on ArrayList, which are highly inefficient O(N)
2) it allocates an object for each entry

Replace this class with a stock Deque, which takes care of the first
problem, as push/pop/peek are amortized O(1).

For implementation use an ArrayDeque, which takes care of the second
problem, as stack entries are reused.

Change-Id: Ie59e2fb47f841e4e5fc08c3ab7e164ad0cb368ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoClean up NormalizedNodePruner
Robert Varga [Wed, 27 Mar 2019 22:45:15 +0000 (23:45 +0100)]
Clean up NormalizedNodePruner

- shorten YangInstanceIdentifier.PathArgument references
- do not declare runtime exceptions as thrown
- use a space after comma

Change-Id: Id0f09d2cd72bc619331c2d16e8f184db784c9976
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUse a simple list for string code table
Robert Varga [Fri, 15 Mar 2019 11:33:05 +0000 (12:33 +0100)]
Use a simple list for string code table

Since the codes are assigned in a linear fashion, we can use
a simple ArrayList to track assignes codes, preventing the need
for boxing integer during population and lookups. Lookups also
end up requiring an array offset lookup rather than needing
to go through multiple indirections.

While this can in theory lead to a large array being allocated,
the set of strings we keep in the table is limited by the
SchemaContext and thus will be typically capped ad couple of
thousand.

The cost of growing the lookup should not be significantly
higher, even if ArrayList grows slower:
- 10, 16, 25, 38,  58,  88
versus HashMap (with .75 load factor)
- 12, 24, 48, 96, 192, 384

each resize operation is significantly faster.

Change-Id: I00c7a2e0985dbf901b6857a16424bf157e5af39d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoImprove NormalizedNodeInputStreamReader defensiveness
Robert Varga [Fri, 15 Mar 2019 11:20:24 +0000 (12:20 +0100)]
Improve NormalizedNodeInputStreamReader defensiveness

If face of corrupted streams, for example due to CONTROLLER-1752,
we can end up interpreting unknown bytes as null strings, potentially
corrupting data.

This patch uses explicit type dispatch and detects wrong string
value types, as well as rejecting unknown string value codes.

Change-Id: Ic2e7887bc1d32a1dc7a364d1bff195752edd762d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoReduce JSR305 proliferation
Robert Varga [Thu, 7 Feb 2019 16:53:09 +0000 (17:53 +0100)]
Reduce JSR305 proliferation

retention=runtime annotations are mixing really badly with Java EE
injection and Java 11.

Make sure we do not use javax.annotation package in APIs and reduce
overall proliferation inside implementations.

Change-Id: I569815f0336efdc0de662c3b80f0fa6e5dd47d8a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoSwitch to spotbugs
Robert Varga [Thu, 27 Dec 2018 03:46:10 +0000 (04:46 +0100)]
Switch to spotbugs

Rather than using findbugs, use spotbugs, which works with Java 9.

Change-Id: I8807b2dc34fdb4ddfd476a2a0ed9cf0db2e044cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoImprove timeout check error message
Robert Varga [Wed, 5 Dec 2018 10:26:34 +0000 (11:26 +0100)]
Improve timeout check error message

Report the value being set in checkArgument.

Change-Id: I76e88504f794300634f61b293876e1677c549792
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoImprove NormalizedNodeInputStreamReader
Robert Varga [Sun, 25 Nov 2018 17:29:17 +0000 (18:29 +0100)]
Improve NormalizedNodeInputStreamReader

We really want to retain source iteration order of predicates
being streamed into the system, as they usually match the order
locally.

Refactor NormalizedNodeInputStreamReader to read complete
NodeIdentifierWithPredicate objects, thus allowing us to use
ImmutableOffsetMapTemplate to skip some data checks and copying
around.

MDSAL: YANGTOOLS-917
Change-Id: I162919c7e56109fc98933a4eeae8669b030dc992
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUse pre-sized ImmutableLists for yang-data-api
Robert Varga [Sun, 25 Nov 2018 17:23:50 +0000 (18:23 +0100)]
Use pre-sized ImmutableLists for yang-data-api

ImmutableList.builder() did not pre-size its arrays correctly,
leading to poor performance. That is no longer the case and we can
correctly pre-allocate it -- giving us the ArrayList equivalent in
immutable form, hence skipping copying in
{SchemaPath,YangInstanceIdentifier}.create()

Change-Id: I4a070dca26138f28de69e4a0e1f9b0298ee2312b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoIntegrate MRI projects for Neon
Robert Varga [Mon, 6 Aug 2018 13:27:49 +0000 (15:27 +0200)]
Integrate MRI projects for Neon

This patch bumps:
- odlparent to 4.0.2
- yangtools to 2.1.2
- mdsal to 3.0.1

It also deals with:
- DOMRpcError.getErrors() changing
- java.util.Optional being used in MD-SAL
- xmlunit upgrade via xmlunit-legacy
- any(Class) not matching nulls
- lists disappearing and hence requiring at least one item
- remove explicit <null/> in blueprints, as that breaks blueprint-core
- adjust sal-binding-it to include byte-buddy, which is a mockito dependency
- adjust dependencies to account for ietf-{inet,yang}-types movement
- moving to tech.pantheon.triemap
- mdsal.common.api removals

JIRA: CONTROLLER-1860
Change-Id: I31b2d011015846537a99f963ded1d38e7b29d71e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump to Dropwizard Metrics 4.0.3
Stephen Kitt [Tue, 25 Sep 2018 10:24:24 +0000 (12:24 +0200)]
Bump to Dropwizard Metrics 4.0.3

This also cleans up some duplicate dependencies.

Release notes:
* 4.0.0: https://metrics.dropwizard.io/4.0.0/about/release-notes.html
* 4.0.1: https://github.com/dropwizard/metrics/releases/tag/v4.0.1
* 4.0.2: https://github.com/dropwizard/metrics/releases/tag/v4.0.1
* 4.0.3: none available, see
  https://github.com/dropwizard/metrics/compare/v4.0.2...v4.0.3

Change-Id: I29050a587aebafcf0d169425242b6281dbb43519
Signed-off-by: Stephen Kitt <skitt@redhat.com>
5 years agoFix findbugs warnings
Robert Varga [Mon, 20 Aug 2018 23:07:54 +0000 (01:07 +0200)]
Fix findbugs warnings

Upgraded findbugs finds these, fix them up.

Change-Id: Id5a008cddc6616c3a93f0528efca00b86843fc3c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoMigrate to UntypedAbstractActor
Robert Varga [Fri, 6 Apr 2018 12:15:35 +0000 (14:15 +0200)]
Migrate to UntypedAbstractActor

As per the 2.4-to-2.5 migration guide using UntypedAbstractActor
UntypedActor is our cheapest migration option. This requires
updating MeteringBehavior to integrate with Receive.

Change-Id: I692f723dffc966bb7e117124b7a0cd714572ab4f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agosimplify a statement in NormalizedNodeInputStreamReader
Michael Vorburger [Wed, 25 Jul 2018 21:47:46 +0000 (23:47 +0200)]
simplify a statement in NormalizedNodeInputStreamReader

and fix a JavaDoc warning in NormalizedNodeOutputStreamWriter

Change-Id: I471dc3d4c8d1327fa8adaca89b8ca1d46036929d
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
5 years agoSimplify code using Java 8 features
Stephen Kitt [Mon, 23 Jul 2018 15:31:33 +0000 (17:31 +0200)]
Simplify code using Java 8 features

* List::sort
* lambda expressions
* Comparator::comparing...
* Collection::removeIf
* method references
* Map::computeIfAbsent
* Map::merge

Change-Id: I1793591c071c7ce5465939afe8b4846b769b5953
Signed-off-by: Stephen Kitt <skitt@redhat.com>
5 years agoRemove unused exceptions
Stephen Kitt [Mon, 23 Jul 2018 14:45:38 +0000 (16:45 +0200)]
Remove unused exceptions

This drops exception declarations which are never used.

Change-Id: Icc8938b9c3b437a0d5961ec1b481fd06c52d47f2
Signed-off-by: Stephen Kitt <skitt@redhat.com>
6 years agoRemove CSS modules
Tom Pantelis [Mon, 4 Jun 2018 21:46:56 +0000 (17:46 -0400)]
Remove CSS modules

The CSS features are still installed until we can work
out the ModuleInfoBackedContext/ClassLoaderStrategy situation
that is currently provided by the ConfigManagerActivator.

Change-Id: Id3b2cc287d17532482a2dd893c41e2dcd8d29ff0
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoHandle empty type in NormalizedNode streaming
Tom Pantelis [Sat, 20 Jan 2018 00:19:03 +0000 (19:19 -0500)]
Handle empty type in NormalizedNode streaming

The yang "empty" type is now represented as
org.opendaylight.yangtools.yang.common.Empty so handle it.

NormalizedNode no longer allows a null value but we still need
to handle NULL_TYPE on input for backwards compatibility. NULL_TYPE
is translated to Empty.

Change-Id: I99b87138d7358d37170cf603d993cd1a4f6a2087
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
6 years agoAdjust to yangtools-2.0.0 changes
Robert Varga [Wed, 11 Oct 2017 19:31:07 +0000 (21:31 +0200)]
Adjust to yangtools-2.0.0 changes

Change-Id: Ib86747e5ed19c0c00bb46b8d7e4936f4d90c4364
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Stephen Kitt <skitt@redhat.com>
6 years agoFix checkstyle reported by odlparent-3.0.0
Robert Varga [Thu, 16 Nov 2017 02:34:13 +0000 (03:34 +0100)]
Fix checkstyle reported by odlparent-3.0.0

Change-Id: I08c548fbbbef8527ad7b037b0def33d3c1c09bf6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix some sonar/checkstyle issues
David Suarez [Sat, 14 Oct 2017 13:49:21 +0000 (15:49 +0200)]
Fix some sonar/checkstyle issues

- Remove unnecessary boxing
- Utility classes should be final and implement a private constructor
- Remove unnecessary types
- Remove two duplicated entries in pom.xml

Change-Id: I2f4539babf7d4ea6d4550d81b71deb4399dc1dc3
Signed-off-by: David Suarez <david.suarez.fuentes@gmail.com>
6 years agoString performance and maintenability
Stephen Kitt [Thu, 18 May 2017 13:28:46 +0000 (15:28 +0200)]
String performance and maintenability

Use StringBuilder for strings built in loops. Use plain concatenation
for string construction not involving loops.

Change-Id: I8299eb54a347d132f0d19dfb39c8fb52366049f2
Signed-off-by: Stephen Kitt <skitt@redhat.com>
6 years agoBug 9008: Fix the error of the persisted journal data format
HeYunBo [Fri, 18 Aug 2017 12:31:39 +0000 (20:31 +0800)]
Bug 9008: Fix the error of the persisted journal data format

We have to clear the lastLeafSetQName while processing the end event for node
in NormalizedNodeInputStreamReader and AbstractNormalizedNodeDataOutput.

Otherwise while processing the leaf-list node, the leaf-list entry node
may use the other LeafSetQName as it's node identifier incorrectly.
The DataTree reconstructed from the persisted journal after the controller
restart will be not equal to the DataTree before restart under certain
circumstances.

Change-Id: I4ee823f59fe477d08f982ae73e3850433dfea8ee
Signed-off-by: HeYunBo <he.yunbo@zte.com.cn>
6 years agoBUG-9028: make NonPersistentDataProvider schedule invocation
Robert Varga [Tue, 22 Aug 2017 17:59:21 +0000 (19:59 +0200)]
BUG-9028: make NonPersistentDataProvider schedule invocation

We need to make NonPersistentDataProvider behave in a fashion
similar to what PersistentDataProvider does for asynchronous
persistence calls, which is schedule execution of the provided
procedure rather than direct execution (which is fair for synchronous
execution).

In order to make that work we introduce ExecuteInSelfActor, which
has an executeInSelf() method, which uses internal mechanics to
schedule the call at a later point.

Change-Id: I116708d98154c8244ea80b4a1a1aa615abc3075d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b66d6180f06097e3501a88aac9fb684336addd58)

6 years agoSlice front-end request messages
Tom Pantelis [Wed, 19 Jul 2017 20:47:28 +0000 (16:47 -0400)]
Slice front-end request messages

Added infrastructure to use the MessageSlicer to slice SliceableMessages in
the TransmitQueue.Transmitting class on the front-end. A MessageAssembler is
used on the Shard side to re-assemble. Currently only the
front-end ModifyTransactionRequest is a SliceableMessage as it contains a
NormalizedNode which can be arbitrarily large - the others are small and
don't require slicing.

Change-Id: I7b09e4864e19d3fdb215c2b9dbcb64c14b6a143c
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
6 years agoSimplify QuarantinedMonitorActor
Robert Varga [Mon, 17 Jul 2017 12:57:08 +0000 (14:57 +0200)]
Simplify QuarantinedMonitorActor

As per the comments, upstream has provided a dedicated event, hence
use that instead of digging inside akka internals.

Change-Id: I4731dfbbdd228d562ddd32ec5fd3d0e9af0855d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoCleanup warnings
Robert Varga [Tue, 27 Jun 2017 21:43:40 +0000 (23:43 +0200)]
Cleanup warnings

- pom.xml groupId duplicate
- Futures.addCallback()
- Throwables.propagate*()
- pontentially-static methods
- remove 'throws Exception' where it is not really needed

Change-Id: Ib47e6255e0f510ab7dd0dcd08f71f2dd124df7b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 years agoFix incorrect spelling of fileBackedStreamFactory
Tom Pantelis [Fri, 7 Jul 2017 08:53:14 +0000 (04:53 -0400)]
Fix incorrect spelling of fileBackedStreamFactory

filedBackedStreamFactory should be fileBackedStreamFactory.

Change-Id: Ib0b65d68d37c5b0ded4f1739d4ddc578973fe6ec
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
7 years agoBug 7449: Add slicer Id to MessageSliceIdentifier
Tom Pantelis [Mon, 3 Jul 2017 17:00:07 +0000 (13:00 -0400)]
Bug 7449: Add slicer Id to MessageSliceIdentifier

Both Shard and RaftActor (via AbstractLeader) (will) have separate
MessageSlicer instances and we need to determine to which instance
MessageSliceReply messages should be forwarded otherwise the first
MessageSlicer will drop messages destined for the second MessageSlicer.
Therefore add a slicerId field to MessageSliceIdentifier which is
checked by MessageSlicer#handleMessage.

Change-Id: Ib39ede29789d5bfaf1fdaea66a8d2994fe6ebcd6
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
7 years agoBug 2890: Chunk AppendEntries when single payload size exceeds threshold
Tom Pantelis [Thu, 18 May 2017 13:23:04 +0000 (09:23 -0400)]
Bug 2890: Chunk AppendEntries when single payload size exceeds threshold

Utilizes the MessageSlicer in AbstractLeader to slice/chunk AppendEntries
messages whose single log entry payloas exceeds the max size threshold.
The MessageAssembler is used in the Follower to re-assemble.

For efficiency, with multiple followers, the AbstractLeader reuses the
FileBackedOutputStream containing the serialized AppendEntries data.
However, since the MessageSlicer takes ownership of the FileBackedOutputStream
and cleans it up when slicing is complete, I added a
SharedFileBackedOutputStream class that maintains a usage count and
performs cleanup when the usage count reaches 0. The AbstractLeader maintains
a Map of SharedFileBackedOutputStream instances keyed by log index.

The FollowerLogInformation keeps track of whether or not slicing is in
progress for the follower. Same as with install snapshot, we only want to send
empty AppendEntries as heartbeats.

Change-Id: Id163944b9989f6cb39a6aaaa98d1f3c4b0026bbe
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
7 years agoBug 7449: Move Dispatchers to sal-clustering-commons
Tom Pantelis [Fri, 23 Jun 2017 11:49:48 +0000 (07:49 -0400)]
Bug 7449: Move Dispatchers to sal-clustering-commons

Moved Dispatchers to a common package so it can be used in
cds-access-client.

Change-Id: I4cea4c586dded9e413c1feee698b04d981b19ea2
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
7 years agoBug 7449: Add message slicing/re-assembly classes
Tom Pantelis [Thu, 20 Apr 2017 13:10:05 +0000 (09:10 -0400)]
Bug 7449: Add message slicing/re-assembly classes

Added re-usable classes for slicing messages into smaller chunks and
re-assembling them. The process is similar to the current raft
install snapshot chunking.

The 2 main classes are MessageSlicer and MessageAssembler. The basic workflow
is:

 - MessageSlicer#slice method is called which serializes the message,
   creates and caches a SlicedMessageState instance and determines the number
   of slices based on the serialized size and the maximum message slice size,
   then sends the first MessageSlice message.
 - The MessageAssembler on the other end receives the MessageSlice, creates an
   AssembledMessageState instance if necessary and appends the byte[] chunk to
   the assembled stream. A MessageSliceReply is returned.
 - The MessageSlicer receives the MessageSliceReply and sends the next
   MessageSlice chunk, if necessary.
 - Once the last MessageSlice chunk is received by the MessageAssembler, it
   re-assembles the original message by de-serializing the assembled stream
   and notifies the user-supplied callback (of type Consumer<Object>) to handle
   the message.

Both MessageSlicer and MessageAssembler use a guava Cache and can be configured
to evict state that has been inactive for a period of time, ie if a message hasn't
been received by the other end.

The MessageSliceReply can propagate a MessageSliceException. If the
MessageSliceException indicates it's re-triable, the MessageSlicer will restart
slicing from the beginning. Otherwise slicing is aborted and the user-supplied
failure callback is notified.

Change-Id: Iceea212b12f49c3944bade50afded92244e4b31a
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
7 years agoLower UnboundedDequeBasedControlAwareMailbox logging
Robert Varga [Mon, 19 Jun 2017 11:53:26 +0000 (13:53 +0200)]
Lower UnboundedDequeBasedControlAwareMailbox logging

Using debug logging seems excessive, leading to a lot of messages
at debug level. I think we can downgrade to trace instead.

Change-Id: I2a7f87760a1eefe9794eac3b4025b6a3891c30a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 27193873ccddbdc8126a24cdb9b0536c5e98ae5f)

7 years agoRemove deprecated NormalizedNodeInputStreamReader ctor
Tom Pantelis [Tue, 30 May 2017 13:16:28 +0000 (09:16 -0400)]
Remove deprecated NormalizedNodeInputStreamReader ctor

The intent is for NormalizedNodeInputStreamReader to be package-scoped
and to create instances via NormalizedNodeInputOutput#newDataInput.
Thus the deprecated public constructor was removed and the remaining
users were converted to use NormalizedNodeInputOutput#newDataInput.
However newDataInput has the side-effect of validating the input stream
first which failed for a couple users who need to lazily do the
validation so I added a newDataInputWithoutValidation method.

Change-Id: Ieb97ab77d05d7a4401dd0526cd4df3a5eafc9eda
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
7 years agoBug 5740: Add Deque-based control-aware mailbox
Tom Pantelis [Thu, 25 May 2017 13:39:40 +0000 (09:39 -0400)]
Bug 5740: Add Deque-based control-aware mailbox

Since akka persistence uses stashing, it requires a mailbox to be
Deque-based to provide the enqueueFirst method. However, the
control-aware mailboxes provided by akka are not Deque-based so we
need one that is.

Change-Id: I74f214c725eff16aba093aad3f2f6eed80948ee4
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
7 years agoLower debugging in sal-clustering-commons
Robert Varga [Tue, 16 May 2017 11:54:24 +0000 (13:54 +0200)]
Lower debugging in sal-clustering-commons

Since this component is under controller.cluster.datastore,
it floods logs with serialization details when we really just
want to understand what the data store is doing. Lower the logs
to TRACE.

Change-Id: Ib9a4735bc439a726452fb98fb5f79d2b7dea2047
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 years agosal-clustering-commons: use lambdas
Stephen Kitt [Tue, 16 May 2017 15:51:11 +0000 (17:51 +0200)]
sal-clustering-commons: use lambdas

This series of patches uses lambdas instead of anonymous classes for
functional interfaces when possible. Lambdas are replaced with method
references when appropriate.

Change-Id: I2a4a800267cd00e9564dfa8b3af069fc14542f61
Signed-off-by: Stephen Kitt <skitt@redhat.com>
7 years agoBug 8444 - Persistent prefix-based shard cannot load its snapshot
Jakub Morvay [Mon, 15 May 2017 15:13:53 +0000 (17:13 +0200)]
Bug 8444 - Persistent prefix-based shard cannot load its snapshot

Since the name is URL-encoded, we have to make sure it does not get
double-encoded -- hence we need to make a pass of URL-decoding before
we use the result.

Change-Id: I20fe8702ad7e405a8b68d8bda2f9ce4522f2dfd0
Signed-off-by: Jakub Morvay <jmorvay@cisco.com>
7 years agoDon't use File(In/Out)putStream in FileBackedOutputStream
Tom Pantelis [Fri, 12 May 2017 15:13:19 +0000 (11:13 -0400)]
Don't use File(In/Out)putStream in FileBackedOutputStream

As per https://www.cloudbees.com/blog/fileinputstream-fileoutputstream-considered-harmful
FileInputStream/FileOutputStream can incur unnecessary GC overhead due to
finalize. Use Files.newInputStream and Files.newOutputStream instead.

Change-Id: Ic4130ba650fef312e82a5039e9e11a573bd9d406
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
7 years agoFix logger formatting strings
Robert Varga [Thu, 4 May 2017 15:51:43 +0000 (17:51 +0200)]
Fix logger formatting strings

Fix %s/{} mixups.

Change-Id: I916996e17839a61802a83ddff31d162ac662f934
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 years agoBUG 8301: Convert queue to a local variable
Tomas Cere [Wed, 3 May 2017 11:12:31 +0000 (13:12 +0200)]
BUG 8301: Convert queue to a local variable

There's a possibility that this might race and an
actor can have it's queue overwritten by another thread, so convert
this to a local variable.

Change-Id: Ic84922c6d109d8361a48debbf971fddd9cee1d3e
Signed-off-by: Tomas Cere <tcere@cisco.com>
7 years agoLower AbstractNormalizedNodeDataOutput debugs to trace
Robert Varga [Tue, 25 Apr 2017 14:19:17 +0000 (16:19 +0200)]
Lower AbstractNormalizedNodeDataOutput debugs to trace

Setting debug to org.opendaylight.controller.cluster.datastore
also catches the clustering-commons, leading to a lot of logs
from serialization. Lower its logging to trace.

Change-Id: Ic0e9f9c60020675c45e79c7638dcb500d6de5091
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 years agoBUG-8073: Improve handling of temporary files
Robert Varga [Fri, 24 Mar 2017 10:54:44 +0000 (11:54 +0100)]
BUG-8073: Improve handling of temporary files

This patch reworks the logic so we end up with atomic move operations
and non-overlapping file names.

Change-Id: I4383baf664e51d8e6acfaf51f9dc5f62d77f5c14
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 7521: Add custom local snapshot store
Tom Pantelis [Thu, 26 Jan 2017 16:49:43 +0000 (11:49 -0500)]
Bug 7521: Add custom local snapshot store

Akka's LocalSnapshotStore serializes to a byte[] before persisting
to the file so we need to write our LocalSnapshotStore that serializes
directly to the file. I patterned the code after akka's LocalSnapshotStore,
mainly translated from scala.

Akka's LocalSnapshotStore wraps the payload data in a Snapshot class
and uses the SnapshotSerializer which locates the serializer for the payload
class and writes some header data before delegating to the payload
serializer. To handle backwards compatibility for a snapshot previously
serialized with akka's format, java de-serialization will detect and fail
with an invalid stream header, in which case we fall back and try
de-serialization via the SnapshotSerializer.

Akka has a standard test suite in SnapshotStoreSpec for testing custom
snapshot store plugins. I derived a LocalSnapshotStoreSpecTest class
that does the setup and teardown with SnapshotStoreSpec doing the rest.
SnapshotStoreSpec uses ScalaTest stuff so need to be run with scala's
JUnitRunner.

I also added a regular LocalSnapshotStoreTest class to cover a few cases
that SnapshotStoreSpec doesn't.

Change-Id: I1ca11682f37aa39d60d3ce57c874c299627e8ca6
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoFix NPE in YangTextSchemaSourceSerializationProxy#getRepresentation
Jakub Morvay [Tue, 28 Feb 2017 07:28:01 +0000 (08:28 +0100)]
Fix NPE in YangTextSchemaSourceSerializationProxy#getRepresentation

According to its general contract, when revision is not found,
SourceIdentifier#getRevision method returns null. Wrap revision in
Optional#fromNullable to avoid possible NPE.

Change-Id: I78f544374f179c9486cc8dd09cbcf1eea379e1e9
Signed-off-by: Jakub Morvay <jmorvay@cisco.com>
7 years agoBug 7521: Add FileBackedOutputStream and use for snapshot chunking
Tom Pantelis [Sun, 22 Jan 2017 05:38:05 +0000 (00:38 -0500)]
Bug 7521: Add FileBackedOutputStream and use for snapshot chunking

Added a FileBackedOutputStream class, similar to the one in guava except:
  - allows for the temp dir to be confgured
  - keeps track of the count of bytes written for efficiency
  - uses a PhantomReference to delete the temp file instead of using finalize.

FileBackedOutputStream is now used in chunking the snapshop on the leader
side and re-assembling on the follower side.

Change-Id: Ieea4bc1388ffe18d6803783d2bb714089716b7b1
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoCheckstyle: fix ParenPad violations
Lorand Jakab [Fri, 3 Feb 2017 13:44:55 +0000 (15:44 +0200)]
Checkstyle: fix ParenPad violations

Enforcing no space(s) after a left parenthesis and before a right
parenthesis is a proposed change [0] which can only be merged when all
violations are fixed in projects enforcing checkstyle. This patch fixes
those violations.

[0] https://git.opendaylight.org/gerrit/#/c/51316/

Change-Id: Id3e4853bf1cee789d584d4fb528f5415084e26ab
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
7 years agoBUG-7594: Expand NormalizedNodeData{Input,Output} to handle SchemaPath
Robert Varga [Thu, 19 Jan 2017 10:26:11 +0000 (11:26 +0100)]
BUG-7594: Expand NormalizedNodeData{Input,Output} to handle SchemaPath

These utility classes are already dealing with QNames, so it makes
sense to expand their capabilities to include SchemaPath serialization.

Change-Id: Ibcb931f78959eb57f834cd2892511c4963638caa
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoMake sure MetricsReporter cache is constant
Robert Varga [Wed, 23 Nov 2016 14:57:48 +0000 (15:57 +0100)]
Make sure MetricsReporter cache is constant

Add a missing final keyword, plus the general
auto-format.

Change-Id: I0027784b6773e4b862bc58d7cc573303dcc57b31
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoFix javadocs and enable doclint
Robert Varga [Thu, 24 Nov 2016 22:56:18 +0000 (23:56 +0100)]
Fix javadocs and enable doclint

This eliminates the doclint suppression and fixes up javadoc, so they
work with Java 8 out of the box.

Change-Id: I7294f0dcd570e3e3c445e54cc8989078175d05d7
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 5419: Add persistAsync method to DataPersistenceProvider
Tom Pantelis [Thu, 17 Nov 2016 07:03:26 +0000 (02:03 -0500)]
Bug 5419: Add persistAsync method to DataPersistenceProvider

Change-Id: I7558cdbc59bb3db1d2ea6311ff37eec47efff92e
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoChanges for akka 2.4.11
Tom Pantelis [Mon, 31 Oct 2016 02:37:42 +0000 (22:37 -0400)]
Changes for akka 2.4.11

- Fixed compile error in MeteringBehavior as signature of onReceive now
  declares Throwable.

- Fixed intermittent failure in
  ShardManagerGetSnapshotReplyActorTest#testGetSnapshotTimeout. On failure,
  the actor would not get the ReceiveTimeout message from akka. However,
  oddly the test didn't fail if just testGetSnapshotTimeout was run - it
  would only fail if run with at least one of the other 2 tests. I tried
  creating a different ActorSystem for each test but that didn't fix it.
  I finally narrowed it down to creating the actors via the TestActorFactory
  although the exact reason is unknown. The tests don't really need to use
  the TestActorFactory so I remove its use.

- Fixed intermittent failure in
  ShardTransactionTest#testShardTransactionInactivity. This was the same issue
  as the ShardManagerGetSnapshotReplyActorTest, i.e. the actor would not get
  the ReceiveTimeout message when no other message was sent. I found the
  TestActorFactory was again the culprit. I narrowed it down to the
  verifyActorReady method which creates an ActorSelection and sends an
  Identify message. This was put in to work around messages intermittently
  going to dead letters shortly after actor creaton. It seems this code
  somehow may interfere with the ReceiveTimeout functionality. So to workaround
  this, I allowed the caller to elide the verifyActorReady call.

Change-Id: Ic8474def917414fa9bbe0f19b30b213f3052a1aa
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoRemove legacy NormalizedNode serialization classes
Tom Pantelis [Wed, 26 Oct 2016 18:55:01 +0000 (14:55 -0400)]
Remove legacy NormalizedNode serialization classes

Removed the pre-Lithium protobuff-based NormalizedNode classes and
related classes as they are no longer used.

Change-Id: I6ae34c9f3778f31bfa26cb4b6d30f3f3eb1f6fc8
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoMove SerializationUtils to sal-clustering-commons
Tom Pantelis [Wed, 26 Oct 2016 19:05:20 +0000 (15:05 -0400)]
Move SerializationUtils to sal-clustering-commons

Moved the SerializationUtils class from saldistributed-datastore to
sal-clustering-commons for re-use (will be used in sal-remoterpc-connector).

Change-Id: I0f1775152ffd2badd5468c5b6321e3274b319736
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoFix FindBugs warnings in sal-clustering-commons
Tom Pantelis [Thu, 13 Oct 2016 22:20:56 +0000 (18:20 -0400)]
Fix FindBugs warnings in sal-clustering-commons

Fixed FindBugs warnings in sal-clustering-commons and enabled the maven plugin to
run and fail the build on violations.

For some reason, the plugin sometimes creates a local .fbExcludeFilterFile that
is a copy of the one in odlparent. It may be that it doesn't always clean it up
at the end. So I added it to the .gitignore

Change-Id: Id1ad5582f533bd4bfe714e54ae1e79d00a411552
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoFix CS warnings in sal-clustering-commons and enable enforcement
Tom Pantelis [Wed, 12 Oct 2016 20:28:13 +0000 (16:28 -0400)]
Fix CS warnings in sal-clustering-commons and enable enforcement

Fixed checkstyle warnings and enabled enforcement. Most of the
warnings/changes were for:
 - white space before if/for/while/catch
 - white space before beginning brace
 - line too long
 - illegal catching of Exception (suppressed)
 - variable name too short
 - indentation
 - local vars/params hiding a field
 - putting overloaded methods close to one another
 - remove unused vars
 - convert functional interfaces to lambdas (eclipse save action)
 - empty catch block - added comment or Throwables.propagate as appropriate
 - missing period after first sentence in javadoc
 - missing first sentence in javadoc
 - adding final for locals declared too far from first usage

Change-Id: I0a6690f97820e8fb670f209221d8e4e2f1cf5d8b
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoBug 6910: Fix anyxml node streaming
Tom Pantelis [Mon, 10 Oct 2016 20:57:32 +0000 (16:57 -0400)]
Bug 6910: Fix anyxml node streaming

On output, changed AbstractNormalizedNodeDataOutput to transform the
DOMSource to a result String that is serialized to the stream. On input,
modified NormalizedNodeInputStreamReader to parse the XML string into
a org.w3c.dom.Node and create a DOMSource.

Change-Id: Ib10822c4444331351cf7f25e1f26d981f7d41dc7
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoUpdate to akka 2.4.11
Robert Varga [Fri, 7 Oct 2016 16:03:03 +0000 (18:03 +0200)]
Update to akka 2.4.11

Akka has changed declarations, hence we need to deal with
Throwable instanceof of Exception.

Change-Id: If20161ce109a2eb1a839ec3f34b64878eac43932
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoMechanical code cleanup (sal-clustering-commons)
Stephen Kitt [Thu, 22 Sep 2016 15:25:04 +0000 (17:25 +0200)]
Mechanical code cleanup (sal-clustering-commons)

* Remove unnecessary type specifiers (use Java 7 <>)
* Remove unnecessary "extends Object" declarations
* Remove unnecessary semi-colons
* Merge identical catch blocks
* Remove redundant modifiers:
  - enum constructors are private by default
  - interface properties are public static final by default
  - interface methods are public abstract by default
  - interfaces are abstract by default
  - inner interfaces are static by default
  - inner classes in interfaces are public static by default

Change-Id: I37133b6c4737bd33926021056c244789856622c2
Signed-off-by: Stephen Kitt <skitt@redhat.com>
7 years agoBUG-5280: add ExplicitAsk utility class
Robert Varga [Thu, 25 Aug 2016 09:31:24 +0000 (11:31 +0200)]
BUG-5280: add ExplicitAsk utility class

Akka's support for Explicit Ask with Java functions
is broken and requires a workaround. This patch moves
the previous implementation site to a reusable place
and fixes a caller which was broken.

Change-Id: Idc0fc961b1808c23e01a4ae8c4eafdc93b7974f2
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoChange InstallSnapshot and reply to use Externalizable Proxy
Tom Pantelis [Tue, 26 Jul 2016 22:36:06 +0000 (18:36 -0400)]
Change InstallSnapshot and reply to use Externalizable Proxy

This makes InstallSnapshot cleaner with no public no-arg constructor.

I also removed the InstallSnapshot protobuff message. In addition,
SerializableUtils is no longer needed as there's no more protobuff
messages.

Change-Id: I17aa4f7195cf09b798daee5587bbf50ccbc4bff0
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoEliminate dead letters message when there's no sender
Tom Pantelis [Thu, 23 Jun 2016 18:15:17 +0000 (14:15 -0400)]
Eliminate dead letters message when there's no sender

When sending a message to close a DTCL or DCL registration, if the caller
isn't interested in the reply, it passes ActorRef.noSender() (ie null). Internally
akka translates this to the dead letters actor so you see log messages
of the form "Message [...CloseDataTreeChangeListenerRegistrationReply]
from Actor[...] to Actor[akka://opendaylight-cluster-data/deadLetters] was not
delivered. [1] dead letters encountered.".

To alleviate this we should check if the sender is the dead letters actor
before sending the reply.

Change-Id: Idfaf280acf720cf5727393262638a7783c1af539
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoBug 6106: Prevent flood of quarantine messages
Tom Pantelis [Sat, 25 Jun 2016 02:04:02 +0000 (22:04 -0400)]
Bug 6106: Prevent flood of quarantine messages

Added a "quarantined" flag to the QuarantinedMonitorActor so it only
prints the warning and attempts to restart the karaf container once
(which is invoked indirectly via the caller's Effect callback).

Change-Id: I0a57af729280abded93d1b1a575df1672e52032e
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
(cherry picked from commit 3066f54d6d2c6206fa5fabc69a795993c68d2d77)

8 years agoFix serialVersionUID
Robert Varga [Wed, 22 Jun 2016 15:04:53 +0000 (17:04 +0200)]
Fix serialVersionUID

This fixes serialVersionUID not being final. Since it was not final,
as per Serializable contract, it had no effect. To retain compatibility
we must use a generated value.

Also remove use of a deprecated method.

Change-Id: I720dcd2613481eb474072ef29e7190cb0f5a28b6
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-5280: move AbstractDataTreeModificationCursor
Robert Varga [Fri, 3 Jun 2016 12:28:42 +0000 (14:28 +0200)]
BUG-5280: move AbstractDataTreeModificationCursor

AbstractDataTreeModificationCursor functionality is useful for wide
range of users, move it to sal-clustering-commons.

Also eliminate the explicit stack, because YangInstanceIdentifier
already has O(1) methods to maintain a logical stack.

Change-Id: Ia0f8d24f32afd67c059e72cc967949f4c609fd7c
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-5280: Remove PeristentMessages
Robert Varga [Thu, 19 May 2016 16:38:28 +0000 (18:38 +0200)]
BUG-5280: Remove PeristentMessages

This class is not used by any live code, remove it along with
the previously-deprecated codepaths.

Change-Id: Iaffc428a15c3cb2822d1465411e84e1d12994e2e
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-5280: remove support for talking to pre-Boron clients
Robert Varga [Thu, 19 May 2016 15:31:22 +0000 (17:31 +0200)]
BUG-5280: remove support for talking to pre-Boron clients

Both transaction chains and transaction identifiers are being changed to
structured data. Unfortunately there is no way to reliably map string
identifiers from versions prior to Boron in a consistent manner.

Pre-Boron messages do not have a concept of a frontend identifier nor its
generation. Implementations are assigning them in a non-deterministic
order and rely on timestamps to disambiguate between generations.

Since Shard-internal state keeping and replication logic will require
these concepts, this patch marks a clean break in compatibility. This
compatibility is only needed in mixed-version clusters, which have not
been validated to work and even if the data store works, it cannot
cope with model mismatches expected from differing versions.

Change-Id: I168fa0a98be10aebd680ce3323c458aad7f15865
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoFix compilation error
Robert Varga [Mon, 6 Jun 2016 22:13:55 +0000 (00:13 +0200)]
Fix compilation error

SourceIdentifier has lost the public constructor. Use the static
factory method instead.

Change-Id: I634f8b8c9e9f7b92a4edbbad4580fb1bdf179eaf
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoEnsure AbstractUntypedActor#unknownMessage() is called
Robert Varga [Fri, 11 Mar 2016 12:20:53 +0000 (13:20 +0100)]
Ensure AbstractUntypedActor#unknownMessage() is called

Our code is silently ignoring messages while there is an abstract method
provided for use when a message is not handled. Make sure we document
the contract and update implementations to call the method when they
encounter an unknown message.

Change-Id: I3c75fdb2c154b40c537813dd5a6bab8f47dc95cc
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-5626: remove CompositeModification(ByteString)Payload
Robert Varga [Tue, 17 May 2016 16:01:53 +0000 (18:01 +0200)]
BUG-5626: remove CompositeModification(ByteString)Payload

These payloads have not been emitted since before Lithium and Lithium
codebase performs snapshot on recovery, hence we should not be seeing
these in any supported upgrade scenario. Remove them and related bits
of code.

Change-Id: Ib96fb2d4a516d1235485e2a12c2398c593bfaaba
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoMake potentially-static methods static
Robert Varga [Tue, 3 May 2016 11:54:17 +0000 (13:54 +0200)]
Make potentially-static methods static

Change-Id: Ifcb3541dced996f106a3ca4fdf5bfa52130eb6ab
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoMove ClusterAdminRpcService to its own bundle
Tom Pantelis [Tue, 29 Mar 2016 07:41:24 +0000 (03:41 -0400)]
Move ClusterAdminRpcService to its own bundle

The ClusterAdminRpcService can't be instantiated with the clustered
datastore blueprint xml b/c it needs the binding RPC registry service so
I moved it to its own bundle.

I made the ClusterAdminProviderModule a no-op since the
ClusterAdminRpcService is now created via blueprint.

I also had to export some packages from the sal-distributed-datastore
bundle.

Change-Id: Icaf025517ed9b08a82a81310f1e5dd2ac0647559
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoModify config Module impls to co-exist with blueprint
Tom Pantelis [Mon, 28 Mar 2016 17:44:11 +0000 (13:44 -0400)]
Modify config Module impls to co-exist with blueprint

Modified various config system Module implementation classes which
have corresponding instances created and advertised via blueprint to
obtain the instance in createInstance from the OSGi registry. The
instance may not be available yet so it will wait. I added a
WaitingServiceTracker class to encapsulate this logic using a ServiceTracker.

For those modules that don't advertise services, createInstance simply
returns a noop AutoCloseable since the components are created via
blueprint.

I also added the new disable-osgi-service-registration flag to the
corresponding service yang identities to prevent the CSS from
duplicating the service registrations.

This patch also adds the blueprint bundle to the mdsal features and
"turns on" blueprint.

Change-Id: I60099c82a2a248fc233ad930c4808d6ab19ea881
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoMake MessageTracker.Context implement AutoCloseable
Robert Varga [Fri, 1 Apr 2016 13:16:47 +0000 (15:16 +0200)]
Make MessageTracker.Context implement AutoCloseable

The API contract is indicative of the fact that a Context is really
a resource which needs to be closed. Express this in code and take
advantage of availability of try-with.

Change-Id: I17ebc9e458ad43888fed868a89256cbb0fca7b87
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRefactor MessageTracker
Robert Varga [Mon, 21 Mar 2016 19:34:12 +0000 (20:34 +0100)]
Refactor MessageTracker

This patch updates MessageTracker implementation with the following:
- lower overhead when dealing with StopWatch under normal conditions
- prevent Context from being instantiated from the outside
- use a Ticker instance for reliable testing
- use Stopwatch.isRunning() instead of explicit done/enable boolean
- properly reset interval timer when expected message is received
- add explicit @NotThreadSafe and @Beta annotations
- move currentMessage to CurrentMessageContext

Change-Id: Idd553a39a8fb885a5c05e391cb4ae45384a59f07
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoMove MessageTracker to sal-clustering-commons
Robert Varga [Mon, 21 Mar 2016 16:58:54 +0000 (17:58 +0100)]
Move MessageTracker to sal-clustering-commons

Message tracker is useful outside of the data store, move it to commons. This will allow
us to use it in RaftActor's recovery code.

Change-Id: Ia1d8074d6dad7ea051d3650cd417cc773292506c
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoDo not allow overrides of onReceive{Command,Recover}
Robert Varga [Wed, 16 Mar 2016 13:21:16 +0000 (14:21 +0100)]
Do not allow overrides of onReceive{Command,Recover}

We already have protected methods to handle these cases, do not allow
overrides, as they create confusion around which method does what.

Change-Id: I3d6e9b9c4dc72a53471bf60324e4c7f36845ed5b
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 5485: Improve DataTreeModification pruning on recovery
Tom Pantelis [Wed, 9 Mar 2016 04:07:02 +0000 (23:07 -0500)]
Bug 5485: Improve DataTreeModification pruning on recovery

Modified the PruningDataTreeModification and NormalizedNodePruner to
validate path and node QNames via the SchemaContext instead of just
namespaces. This allows migration support for any element to be removed
from a yang hierarchy.

Also handled SchemaValidationFailedException on ready which can happen
with writes which don't immediately validate the sctructure as merge
does. The modification tree is re-applied with pruning.

Change-Id: I8c4f84fbaa93563ce6741d7a3e15855f7fc4940f
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoDo not guard simple logging with isXXXEnabled()
Robert Varga [Fri, 11 Mar 2016 12:30:52 +0000 (13:30 +0100)]
Do not guard simple logging with isXXXEnabled()

There is not benefit in the guards, making them pure overhead.

Change-Id: I75e310a2f08e5650db436bb4a7f46d85cbde313d
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRemove commented-out logging
Robert Varga [Fri, 11 Mar 2016 12:07:26 +0000 (13:07 +0100)]
Remove commented-out logging

Remove commented-out logging lines and do not condition simple logging
on isDebugEnabled().

Change-Id: I648ee585a4cf2e4a4dfabecdcf0ce833906b4dac
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 5329: Add factory akka.conf
Tom Pantelis [Fri, 12 Feb 2016 14:08:15 +0000 (09:08 -0500)]
Bug 5329: Add factory akka.conf

Added a factory akka.conf file that is shipped to
configuration/factory/akka.conf. This file contains all the necessary
akka settings. Modified the FileAkkaConfigurationReader to load the
existing configuration/initial/akka.conf file with the factory file as
the fallback. In this manner akka will overlay/merge the initial file
with the factory file. I pared down the initial file to only contain the
settings that users would normally set or configure to setup a cluster,
ie hostname, port, seed-nodes, roles.

In the features.xml, the factory file is configured to always overwrite
so changes are picked up on upgrade. We still preserve the initial file.

Change-Id: I8e80161e21d0ad0e26f1efa1023c670b3a5ef6bc
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoRemove unused org.opendaylight.controller.xml.codec package/classes
Tom Pantelis [Fri, 19 Feb 2016 16:12:17 +0000 (11:12 -0500)]
Remove unused org.opendaylight.controller.xml.codec package/classes

The org.opendaylight.controller.xml.codec utility classes in
sal-clustering-commons are no longer used so remove them. They were
originally used by the remote RPC code for conversion of the legacy
CompositeNode class which has since been removed. The code referencing
CompositeNode et al was removed from these classes but unused
remnants were left behind.

Change-Id: Ic8f880c8075f076549bb822f6dfbaaad81595ed1
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoHide NormalizedNodeOutputStreamWriter
Robert Varga [Wed, 17 Feb 2016 15:17:32 +0000 (16:17 +0100)]
Hide NormalizedNodeOutputStreamWriter

This is an internal implementation class, hide it.

Change-Id: Ib79d5a48dcf967f832b7130b981e5c22a593ef80
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRemove InputStream constructors
Robert Varga [Wed, 17 Feb 2016 16:30:42 +0000 (17:30 +0100)]
Remove InputStream constructors

These are not used anywhere, remove them and simplify callers.

Change-Id: I1b7f28c8fb73903da2c3ddfe59defba56c44e364
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoNormalizedNodeDataOutput should be AutoCloseable
Robert Varga [Wed, 17 Feb 2016 15:13:09 +0000 (16:13 +0100)]
NormalizedNodeDataOutput should be AutoCloseable

We expect to use autocloseable in implementations, make sure this this
reflected upwards.

Change-Id: Ia7e6b27e514cf04e24b0cdf161510a035846ba12
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRemove implements NormalizedNodeStreamWriter declaration
Robert Varga [Wed, 17 Feb 2016 15:11:40 +0000 (16:11 +0100)]
Remove implements NormalizedNodeStreamWriter declaration

AbstractNormalizedNodeDataOutput already implements this class, no need
to declare it twice.

Change-Id: I4b217d00fe8054ce777b91b35157443438e65a54
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRemove NormalizedNodeStreamReader
Robert Varga [Wed, 17 Feb 2016 14:47:20 +0000 (15:47 +0100)]
Remove NormalizedNodeStreamReader

This class has been superseded by NormalizedNodeDataInput, remove it.

Change-Id: I11c915f4aff6ca217e096c42ba1115043a99a3ab
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoFix raw type warnings
Robert Varga [Fri, 12 Feb 2016 12:28:25 +0000 (13:28 +0100)]
Fix raw type warnings

Fixes NodeWithValue and similar raw type warnings. Also imports
YangInstanceIdentifier inner interfaces for more readable code.

Change-Id: Iaff9e250fff26b0da70dd9f24d7ccc72121630e4
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoDeprecate InstallSnapshot protobuff messages
Tom Pantelis [Wed, 27 Jan 2016 07:33:32 +0000 (02:33 -0500)]
Deprecate InstallSnapshot protobuff messages

Deprecated the associated InstallSnapshot protobuff message and
changed InstallSnapshot to Externalizable. Backwards compatibility
with pre-boron is maintained. Related code was modified accordingly.

Previously InstallSnapshot took a ByteString. I changed this to byte[]
to avoid the extra copy overhead with ByteString with converting to and
from byte[].

Change-Id: I532d062983e76e63c685e6df1d48e0ae38197a5c
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoRemove deprecated Helium Payload methods
Tom Pantelis [Sun, 24 Jan 2016 05:44:09 +0000 (00:44 -0500)]
Remove deprecated Helium Payload methods

Removed the deprecated encode/decode methods from Payload and its derived
classes.

Change-Id: I52beb2d3991efe9f3a7c2631b8682dc1f324e271
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoDeprecate CloseTransactionChain protobuff message
Tom Pantelis [Sat, 23 Jan 2016 05:31:21 +0000 (00:31 -0500)]
Deprecate CloseTransactionChain protobuff message

Deprecate the associated CloseTransactionChain protobuff message and
change the message classes to extend VersionedExternalizableMessage.
Backwards compatibility with pre-boron is maintained. Related code was
modified accordingly.

The CloseTransactionChainReply message isn't used so it was removed.

Change-Id: I58d29eac9cb2f300f92dd4e5cb11484b215ddc48
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoRemove unused protobuff messages
Tom Pantelis [Sat, 23 Jan 2016 05:05:24 +0000 (00:05 -0500)]
Remove unused protobuff messages

Removed the following unused protobuff messages:

   ShardManager.proto
   MockPayload.proto
   KeyValueMessages.proto
   SimpleNormalizedNode.proto

Change-Id: I245068fe7c9ead9ea70d9983e73984067c7655da
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoRemove ListenerRegistration protobuff messages
Tom Pantelis [Sat, 23 Jan 2016 00:08:10 +0000 (19:08 -0500)]
Remove ListenerRegistration protobuff messages

The ListenerRegistration protobuff messages are used to serialize the
corresponding CDS messages but we don't actually send these messages
over the wire so they don't need serialization. So the protobuff
messages were removed. If we do need to serialize these messages in he
future we won't use protobuff.

Change-Id: I3818a965e0fd4e1876364022f2de09b1bac216d5
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoRemove DataChangeListener protobuff messages
Tom Pantelis [Fri, 22 Jan 2016 23:36:56 +0000 (18:36 -0500)]
Remove DataChangeListener protobuff messages

The DataChangeListener protobuff messages are used to serialize the
corresponding CDS messages but we don't actually send these messages over
the wire so they don't need serialization. So the protobuff messages were
removed. If we do need to serialize these messages in the future we won't
use protobuff.

Change-Id: Ia72f3da2edbc6c1eeebfb022916894e2b1713840
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoDeprecate 3PC protobuff messages
Tom Pantelis [Fri, 22 Jan 2016 11:34:19 +0000 (06:34 -0500)]
Deprecate 3PC protobuff messages

Deprecated the associated protobuff messages for

  CanCommitTransaction[Reply]
  CommitTransaction[Reply]
  AbortCommitTransaction[Reply]

The message classes now extend VersionedExternalizableMessage. Related
code was modified accordingly.

The PreCommitTransaction message is no longer used so it was removed.

Backwards compatibility with pre-boron will be implemented in the next
patch as ThreePhaseCommitCohortProxy needs some refactoring so the
appropriate cohort version can be used for the messages.

Change-Id: I8164ec82c7ef1623d38b1599af2f1c73fadb5300
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoBug 5109: Handle stand alone leaf nodes in CDS streaming
Tom Pantelis [Thu, 21 Jan 2016 15:59:50 +0000 (10:59 -0500)]
Bug 5109: Handle stand alone leaf nodes in CDS streaming

Modified AbstractNormalizedNodeDataOutput to output the leaf set QName
that is now passed to leafSetEntryNode if no parent LeafSetNode QName is
present. Modified NormalizedNodeInputStreamReader accordingly.

I also found that OrderedLeafSetNode was not handled correctly.
AbstractNormalizedNodeDataOutput#startOrderedLeafSet needs to set
lastLeafSetQName.

The NormalizedNodePruner assumed a leaf set entry node must have a
parent and threw an exception if not, similarly with leaf node and anyXML
node. But all 3 can be standalone so I modified NormalizedNodePruner to
handle it.

Change-Id: I02a71d9280dac0eb466ff401699a40d3d8826220
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoRemove Helium ReadDataReply protobuff message
Tom Pantelis [Wed, 20 Jan 2016 04:02:55 +0000 (23:02 -0500)]
Remove Helium ReadDataReply protobuff message

The ReadDataReply protobuff message was kept for backwards compatibility
with Helium so remove it.

Change-Id: I3a30f113903f6d908bea698c0bb9bc773046237e
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>