mdsal.git
8 years agoCleaned up sal-dom-* packages and removed legacy interfaces 00/25900/1
Tony Tkacik [Fri, 21 Aug 2015 10:45:19 +0000 (12:45 +0200)]
Cleaned up sal-dom-* packages and removed legacy interfaces

 - Removed deprecated interfaces from mdsal-common-api,
   some of this interfaces will be present in controller
   for backwards compatibility

 - Changed groupId to org.opendaylight.mdsal
 - Changed artifactId from sal-core to msdal-dom

Change-Id: I222bee07e5fd13fe10d19f01ba4f9bdf102bf3e5
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoCleaned up sal-common-* to common folder 79/25579/2
Tony Tkacik [Fri, 21 Aug 2015 10:41:17 +0000 (12:41 +0200)]
Cleaned up  sal-common-* to common folder

- Added mdsal- prefix
- Updated groupId to org.opendaylight.mdsal

Change-Id: I4daef4cf6c341a4f3029f3b88a17856bdd17c009
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoMigrated models to use MD-SAL provided code. 76/25576/2
Tony Tkacik [Fri, 21 Aug 2015 10:38:02 +0000 (12:38 +0200)]
Migrated models to use MD-SAL provided code.

Change-Id: Ia92933803e133604b5a54b1b2c82210480ae3ffc
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoCleaned up Java Binding code from YANG Tools 61/25561/2
Tony Tkacik [Thu, 20 Aug 2015 09:16:17 +0000 (11:16 +0200)]
Cleaned up Java Binding code from YANG Tools

- Introduced artifacts pom
- Updated groupId from .yangtools to .mdsal
- Renamed code-generator to binding folder which
  makes more sense since it contains also codecs
  and other functionality not directly related
  to code generation.
- added mdsal- prefix to artifact id to make
  it more distinguishable from YANGTools
- joined binding-model-api, binding-generator-api,
  binding-generator spi into mdsal-binding-generator-api
- joined binding-type-provider and binding-generator-impl
  into mdsal-binding-generator-impl

Change-Id: I7edb96eff81900b90b0f6195b009a412152c2b8f
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoIntroduce top-level pom file. 14/25514/3
Tony Tkacik [Thu, 20 Aug 2015 08:37:45 +0000 (10:37 +0200)]
Introduce top-level pom file.

Change-Id: Ic6ba1ee2963ee0db8ba041a46025dc994976428b
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoMerge branch 'split-mdsal' of ../controller
Andrew Grimberg [Wed, 19 Aug 2015 20:35:44 +0000 (13:35 -0700)]
Merge branch 'split-mdsal' of ../controller

8 years agoBug 4035: Fixed some sonar warnings in md.sal.binding.impl
Tony Tkacik [Tue, 28 Apr 2015 13:41:05 +0000 (15:41 +0200)]
Bug 4035: Fixed some sonar warnings in md.sal.binding.impl

Change-Id: I7b850b65a7bfc40ef757115ae37a031fa88bebeb
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoBug 4035: Remove unused implementations from sal-common-impl
Tony Tkacik [Thu, 23 Jul 2015 12:23:26 +0000 (14:23 +0200)]
Bug 4035: Remove unused implementations from sal-common-impl

Removed  left-overs from Hydrogen and Helium which are
not used anymore in Lithium codebase and will be unnecessary
in Beryllium codebase.

Removed classes were never part of public API contracts
outside of MD-SAL.

Change-Id: I2d19373b270e539598fe31b7e493db494b017100
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoBug 4035: Removed sal-common which is unused since Helium.
Tony Tkacik [Thu, 23 Jul 2015 11:26:08 +0000 (13:26 +0200)]
Bug 4035: Removed sal-common which is unused since Helium.

Change-Id: Ia6e15cc1e94fcf5794a56fbf61d260644dcb457b
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoBug 4035: Fixed some sonar / findbugs issues in DOM MD-SAL.
Tony Tkacik [Thu, 23 Jul 2015 11:11:08 +0000 (13:11 +0200)]
Bug 4035: Fixed some sonar / findbugs issues in DOM MD-SAL.

Change-Id: Id0ab9f65e4f1663f9e6cd85a6235a0a5fdee6f88
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoBug 4035: Remove references to not present artefacts.
Tony Tkacik [Thu, 23 Jul 2015 09:13:27 +0000 (11:13 +0200)]
Bug 4035: Remove references to not present artefacts.

Change-Id: Id0308a4b544572df16bf01b1742eed60246dde54
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoBug 4035: Extract dom-config from core-api and broker-impl
Tony Tkacik [Wed, 22 Jul 2015 12:59:20 +0000 (14:59 +0200)]
Bug 4035: Extract dom-config from core-api and broker-impl

This patch introduces two new artefacts sal-dom-config
and sal-dom-broker-config which hosts all config subsystem
related MD-SAL DOM Broker implementation.

This patch is required for MD-SAL split in order to
not have cyclic dependency between controller and md-sal
project.

Change-Id: Ic93c583c07ae3e088dcf0e74cbdaaf627a8e79f6
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoEnabling Data Change Notifications for all nodes in cluster.
Harman Singh [Fri, 24 Jul 2015 01:32:46 +0000 (18:32 -0700)]
Enabling Data Change Notifications for all nodes in cluster.

Two new interfaces are introduced ClusteredDataChangeListener and ClusteredDOMDataChangeListener and external applications will have to implement any of that interface,
if those applications want to listen to remote data change notifications.

Datastore registers listeners, which are instance of that interface, even on followers.

Change-Id: I0e29cdf2a08a2051de5fc8ce73b9ec8ac408e45b
Signed-off-by: Harman Singh <harmasin@cisco.com>
8 years agoDecouple message bus from netconf connector
Tomas Cere [Thu, 13 Aug 2015 09:06:22 +0000 (11:06 +0200)]
Decouple message bus from netconf connector

Change-Id: I6a143e868adc1e5c7a9b114798e7009bb6ef8675
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Signed-off-by: Tomas Cere <tcere@cisco.com>
8 years agoDecouple config and netconf subsystems.
Tomas Cere [Thu, 13 Aug 2015 09:06:54 +0000 (11:06 +0200)]
Decouple config and netconf subsystems.

Extract a common mapping for config pusher and config subsystem netconf
Add a ConfigPersisterFacade for XML that allows reads/writes from/to config
subsystem using XML format
Push notifications from YangStoreService to NetconfNotificationManager instead
of using custom listeners
Migrate netconf features from controller features, untangle features

Change-Id: I71e4ca6e0258e0b1f0d6c19119f93eb9d68b7bca
Signed-off-by: Tomas Cere <tcere@cisco.com>
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Signed-off-by: Ed Warnicke <hagbard@gmail.com>
8 years agoFix license header violations in binding-data-codec
Thanh Ha [Thu, 6 Aug 2015 03:24:47 +0000 (23:24 -0400)]
Fix license header violations in binding-data-codec

Change-Id: I797ac93efabe9eea6d2ae161ec39f3028ca78807
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoFix license header violations in binding-generator-impl
Thanh Ha [Thu, 6 Aug 2015 03:19:46 +0000 (23:19 -0400)]
Fix license header violations in binding-generator-impl

Change-Id: If155761c145d7b6db8c4378343733a7be256ba98
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoFix license header violations in binding-type-provider
Thanh Ha [Thu, 6 Aug 2015 03:11:52 +0000 (23:11 -0400)]
Fix license header violations in binding-type-provider

Change-Id: Ib00d5625f834a9de12d10f8c3d9cbaaa7e70eb05
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoFix license header violations in sal-binding-broker
Thanh Ha [Sat, 8 Aug 2015 06:00:33 +0000 (02:00 -0400)]
Fix license header violations in sal-binding-broker

Change-Id: If6b75f466f97149ce4f0290135a754ca6cba1034
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoFix license header violations in sal-dom-broker
Thanh Ha [Sat, 8 Aug 2015 05:53:27 +0000 (01:53 -0400)]
Fix license header violations in sal-dom-broker

Change-Id: I78a5b836b7ea5053ede25a31e8a40319d365fe60
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoFix license header violations in sal-inmemory-datastore
Thanh Ha [Sat, 8 Aug 2015 05:45:08 +0000 (01:45 -0400)]
Fix license header violations in sal-inmemory-datastore

Change-Id: I160d107a813c28ac75f1e5e21121068de9ccc7b8
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoFix license header violations in sal-binding-api
Thanh Ha [Sat, 8 Aug 2015 05:43:04 +0000 (01:43 -0400)]
Fix license header violations in sal-binding-api

Change-Id: I877608c114bf4479c760f5b5dafed5d100d12cf5
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoFix license header violations in sal-dom-spi
Thanh Ha [Sat, 8 Aug 2015 05:41:23 +0000 (01:41 -0400)]
Fix license header violations in sal-dom-spi

Change-Id: I82f4796c933a6cec89950d4c474a0053637b2646
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoFix license header violations in sal-dom-api
Thanh Ha [Sat, 8 Aug 2015 05:39:55 +0000 (01:39 -0400)]
Fix license header violations in sal-dom-api

Change-Id: I08a3d973bb56d6ee267576b691a32bfe27db6820
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoFix license header violations in sal-common-impl
Thanh Ha [Sat, 8 Aug 2015 05:19:29 +0000 (01:19 -0400)]
Fix license header violations in sal-common-impl

Change-Id: I0702d7954d59f92ab62f6887a780db8a80f42ffa
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoFix license header violations in sal-common-api
Thanh Ha [Sat, 8 Aug 2015 05:17:07 +0000 (01:17 -0400)]
Fix license header violations in sal-common-api

Change-Id: I58fdef120495514ef94f2e9681790786ba4e0841
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoFix license header violations in yang-binding
Thanh Ha [Thu, 6 Aug 2015 02:26:03 +0000 (22:26 -0400)]
Fix license header violations in yang-binding

Change-Id: I3c3fcd27c50ef3aa3c79ddaccddf8dfcf8bad4d8
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoBug 4035: Invert dependency binding-impl -> binding-config
Tony Tkacik [Wed, 22 Jul 2015 09:24:03 +0000 (11:24 +0200)]
Bug 4035: Invert dependency binding-impl -> binding-config

Dependency between sal-binding-broker-impl and sal-binding-config
was inverted in order to ease split-off and to provide config
wiring outside of implementation.

This is required for separation of MD-SAL Binding implementation
into MD-SAL Project.

Change-Id: Id18567b2c51045461ed12500fe5cb2f324f55b0c
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoFixed wrong format in ShardedDOMDataTree
Tony Tkacik [Thu, 23 Apr 2015 14:09:28 +0000 (16:09 +0200)]
Fixed wrong format in ShardedDOMDataTree

Change-Id: Ie32ff9ad72e4bbae9a5ef1290ff63d5780c92313
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoBUG-1485: remove deprecated range methods
Robert Varga [Fri, 5 Jun 2015 21:20:55 +0000 (23:20 +0200)]
BUG-1485: remove deprecated range methods

This Be-cycle patch removes the methods which have been removed in
Lithium, improving class size and not leaking the enforcement details.

Change-Id: I629df675eecac10c0aad1ed212123dca0f6d81d8
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoMake more mathods static
Robert Varga [Mon, 29 Jun 2015 20:22:54 +0000 (22:22 +0200)]
Make more mathods static

Private methods not touching object state can be made static, make it
so. Also remove an open-coded version of Strings.isNullOrEmpty().

Change-Id: I6e62ce1a4eb4b1556654172554eb69542df60403
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoFix some minor sonar warnings
Robert Varga [Sun, 21 Jun 2015 20:56:35 +0000 (22:56 +0200)]
Fix some minor sonar warnings

Mostly misplaced 'final' modifiers.

Change-Id: I5197b844e73db00467f7ebb852677c39176e5c94
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 3821 - Augmentation codecs may be loaded after codec creation.
Tony Tkacik [Fri, 19 Jun 2015 09:29:40 +0000 (11:29 +0200)]
Bug 3821 - Augmentation codecs may be loaded after codec creation.

In some scenarios - where schema context already contained
schema for introduced augmentation, but class was not known
at time codec creation was triggered - codec for augmenation
was not created and any subsequent uses of codec (class is
already known) failed with IncorrectNestingException.

This patch introduces

  - new exception MissingClassInLoadingStrategy
    which is subclass used by MD-SAL to retry after context update
    or timeout
  - supports loading of  augmentation codec after parent codec
    was created and augmentation is part of schema codec

Change-Id: If85f8e2be614a139947abc5daaa1e141b3c9b22c
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit acf8e80b0747bd0aa724e978288bb83f6ca338ad)

8 years agoFix features-netconf-connector not being included
Robert Varga [Mon, 22 Jun 2015 15:27:31 +0000 (17:27 +0200)]
Fix features-netconf-connector not being included

mdsal-artifacts should be listing the features it needs, so users can
pick up their versions. This was not true for
features-netconf-connector.

Change-Id: I4d53d8cf3d6ff1bce57e9de223126fea5269419d
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoTypeDefinition is a generic type
Robert Varga [Thu, 11 Jun 2015 11:15:54 +0000 (13:15 +0200)]
TypeDefinition is a generic type

Do not use it in raw format, eliminating warnings.

Change-Id: I6012f812ce7a5aba75f163a8910fb0583fefd6cc
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 35e731b1818688f2aee43f525873087aca25110e)

8 years agoBug 2583 - illegal escape character if generated files
Peter Kajsa [Fri, 16 Jan 2015 12:48:44 +0000 (13:48 +0100)]
Bug 2583 - illegal escape character if generated files

When a module file name starts with 'u' character, YangTools generates
comments in file containing '\u...' character sequences which java compiler
interprets as illegal escape character.
Problem is related most probably to windows builds only.

Change-Id: I81329b754710a68ada4e9c034c8980a1acd8a1b7
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoBug 2721: StackOverflowError for leafref FIX
Martin Ciglan [Tue, 16 Jun 2015 14:12:51 +0000 (16:12 +0200)]
Bug 2721: StackOverflowError for leafref FIX

Leafref XPath needs to be checked whether it references itself
in order to detect incoming StackOverflowError
and throw appropriate exception if necessary.

Change-Id: Iacfa1a9f9d85f947e590b1d6412c9c482b417dbf
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
8 years agoSonar: remove unused modifiers
Robert Varga [Tue, 16 Jun 2015 18:59:27 +0000 (20:59 +0200)]
Sonar: remove unused modifiers

public/static/final modifies are implied by the context, e.g. by being
declared in an interface.

Change-Id: Ic2f97172595d7cdb2119510c077eabac55fa0798
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years ago[RFC][Fix] Fix for connection in pom.xml.
Jan-Simon Möller [Wed, 3 Jun 2015 13:41:22 +0000 (15:41 +0200)]
[RFC][Fix] Fix for connection in pom.xml.

The connection value was wrong.
Apply values proposed by zxiiro.

Also fix sal-dom-xsql (wrong developerConnection).

This allows me to run  mvn site
w/o failing due to the wrong entry.

Change-Id: I15d953647a40dde4b37246a78bae120552efb15b
Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
8 years agoMake methods static
Robert Varga [Thu, 11 Jun 2015 10:40:28 +0000 (12:40 +0200)]
Make methods static

All these can be made static, so improve their efficiency.

Change-Id: Ie6aa238eab7fef728dd22af12a64a155a9db776e
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 12beaed7c9f1953562f79ef9699273d0ea53926c)

8 years agoMake BaseYangTypes.TYPE_MAP immutable
Robert Varga [Thu, 11 Jun 2015 10:32:44 +0000 (12:32 +0200)]
Make BaseYangTypes.TYPE_MAP immutable

The lookup map is expected to be immutable.

Change-Id: I0ed6c263d34e585dcca2445ec963ea785c934ab8
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit c8e3e8de1506e8571651f430024c14157cdb61bb)

8 years agoThrow an exception from private constructor
Robert Varga [Tue, 9 Jun 2015 22:58:12 +0000 (00:58 +0200)]
Throw an exception from private constructor

This is a utility class, it should never be instantiated.

Change-Id: Ic2edd90d0cf084a3a38e5a6c068172b9d774799e
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 2e0878d894f821db411c87f2ffff094e9b32b5ee)

8 years agoBug 3336 - Binding DTOs: fix binary-derived constructor
Jan Hajnar [Mon, 1 Jun 2015 14:40:16 +0000 (16:40 +0200)]
Bug 3336 - Binding DTOs: fix binary-derived constructor

* added condition to only check for null in value assignmet if class has
one property (because then CheckNull is generated before assgnment)

Change-Id: I3bd18ec60347b3d1d5dec32e7bcafa432c56b5ad
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
(cherry picked from commit 0c58b4c45c1caedd1e3ecdfa056c0c4f98185c63)

8 years agoBug 3669 - ietf-restconf binding is incomplete
Peter Kajsa [Mon, 15 Jun 2015 09:36:29 +0000 (11:36 +0200)]
Bug 3669 - ietf-restconf binding is incomplete

- added implementation of ModuleRevisionBuilder.java

Change-Id: If50041c1b0befcb5fb8678cf95f915ef4b079bfb
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoBug 3687 - StreamWriterGenerator emits UNKNOWN_SIZE
Tony Tkacik [Fri, 12 Jun 2015 10:28:04 +0000 (12:28 +0200)]
Bug 3687 - StreamWriterGenerator emits UNKNOWN_SIZE

StreamWriterGenerator always emitted sizing hint
for fully-completed data and sometimes even
counting all availble augmentations, which actually
lead-up to larger sizes of collections then needed.

Fix changes the SIZE HINT for "constant" max-sized
types (containers, augmentations, list entries)
to -1 so underlaying implementation could size
them based on actual data.

Change-Id: Ibd446f71c4b066f4dab4a7d73b1bc851d9e62c99
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit b6fdf49d349662ffa82ae6477f99bac405799a3f)

8 years agoMake methods static
Robert Varga [Sat, 6 Jun 2015 13:34:44 +0000 (15:34 +0200)]
Make methods static

These methods can be made static, make them such. Also fix raw types.

Change-Id: I4b697026857aae8579f0545e7e1284a7b8d00d04
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-3641: cache hashCode value
Robert Varga [Tue, 9 Jun 2015 23:09:51 +0000 (01:09 +0200)]
BUG-3641: cache hashCode value

Builder-derived classes can be used as HashMap keys, which means they
can see their hashcode computed multiple times. Since this is a
recursive operation, the cost of it can be quite high, so dedicate two
fields for caching the hashcode result.

Change-Id: I0d95fd94187a421e4018b2f6992dfeaf2e126732
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 0158f45b9078cdb867d3ce3c44a4ed4746f311fe)

8 years agoBug 1485: Invoke lengthCheck only on non-null object.
Tony Tkacik [Tue, 9 Jun 2015 12:59:25 +0000 (14:59 +0200)]
Bug 1485: Invoke lengthCheck only on non-null object.

Change-Id: Iec3cf2fe08fbdac4e5139acab7865cd4c4b6224f
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit 8dfd02dec37d796ce7a51866416675b021e85b7c)

8 years agoBUG-706 Ignore anyxml nodes in binding serializer
Maros Marsalek [Mon, 8 Jun 2015 12:39:02 +0000 (14:39 +0200)]
BUG-706 Ignore anyxml nodes in binding serializer

AnyXml is not supported on that level and currently leads to null pointer ex.

Change-Id: I5c2a64ab9502e4bba02efd822d2b5294ef456cef
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
(cherry picked from commit 8c4ddc66b0b1ef31a65b8cabf55173a16615bab2)

8 years agoBUG-3051: Fix error reporting string
Robert Varga [Mon, 8 Jun 2015 16:43:05 +0000 (18:43 +0200)]
BUG-3051: Fix error reporting string

The exception thrown does not accurately describe what has happened. Be
more user-friendly and report the exact pattern which failed to match.

Change-Id: I0818c92c4a8cdf8c180234635c1efe059ff1c4e2
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 3680886f73ef87fb2818c57b12d3bc76525c3669)

8 years agoBUG-1485: convert BuilderTemplate to use LengthGenerator
Robert Varga [Sun, 31 May 2015 17:51:43 +0000 (19:51 +0200)]
BUG-1485: convert BuilderTemplate to use LengthGenerator

This converts BuilderTemplate to use the LengthGenerator class as
appropriate, speeding operations up. Also removes caching fields.

Change-Id: I1a0bfc56df8ab36880ae8e14c111cb9aca68c626
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 7998081d8e1761bf4798c1642e8e6107fc4666fc)

8 years agoBUG-1485: Switch ClassTemplate length checker
Robert Varga [Sun, 31 May 2015 12:05:02 +0000 (14:05 +0200)]
BUG-1485: Switch ClassTemplate length checker

Switch ClassTemplate to use LengthGenerator. Also removes the static field
used to hold ranges, as that is only used by deprecated length() method.

Change-Id: I2a084a71d21c8c63a2d9733fc767aa7ecd3cff67
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 65cf5ea01d87cbe65633a8e13fcbb6713e334ec2)

8 years agoBUG-1485: Create LengthGenerator
Robert Varga [Sun, 31 May 2015 11:33:03 +0000 (13:33 +0200)]
BUG-1485: Create LengthGenerator

LengthGenerator is akin to AbstractRangeGenerator, only simpler. Since
the type of the checked property can only be an integer, we can live
without subclasses. One weirdness is that it needs to support both
String and byte[] fields, but that is easily catered with two distinct
methods.

Change-Id: I6b714b4094c332c18ee210451b3bd1672ca74129
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit b8e6be6a350b8dd39de74ca33fa039e92b198b17)

8 years agoMigrate to MoreObjects
Robert Varga [Sat, 6 Jun 2015 19:45:12 +0000 (21:45 +0200)]
Migrate to MoreObjects

Objects is overloaded with JDK7, use the MoreObjects class.

Change-Id: I73f9ba24e990df8160b45b6fb0763a1b2ac231d6
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoImprove BindingDOMRpcImplementationAdapter performance
Robert Varga [Thu, 28 May 2015 11:20:30 +0000 (13:20 +0200)]
Improve BindingDOMRpcImplementationAdapter performance

BindingReflections return a non-shared QNameModule instance, which means
that we may end up using suboptimal lookups when comparing QNames.
Furthermore it is not the QNameModule which we need in the fastpath, but
rather QName of the input statement, hence create a cached reference of
that -- leading to minimal object allocation in the fast path.

Change-Id: I97ceb43d80c50d53d21cc66a31bfaae6ff0193e9
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit c4ee9b293370b81b76cc0e06accf3cde31ac1722)

8 years agoInstantiate faster RpcServiceInvokers
Robert Varga [Wed, 27 May 2015 15:00:07 +0000 (17:00 +0200)]
Instantiate faster RpcServiceInvokers

Now that we have the SchemaPath->Method mapping available and
RpcServiceInvoker can instantiate efficient invokers based on the
QName->Method mapping, switch over to them by creating an intermediate
map.

Change-Id: If5e17924d9deb494045965578cfcec6d321d04d2
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 0aedb207da64e63900e2dbc85ba2a030ea7800e4)

8 years agoRework BindingDOMRpcImplementationAdapter instantiation
Robert Varga [Wed, 27 May 2015 11:45:07 +0000 (13:45 +0200)]
Rework BindingDOMRpcImplementationAdapter instantiation

Move the SchemaPath/Method map closer to where we instantiate invokers.
This has the benefit of speeding up registration code very slightly,
but more importantly it allows instantiating more efficient invokers, as
we have the SchemaPath->Method map readily available.

Change-Id: Iefc0faadcfd7df6c40240ce1f78c7b734f06c618
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 99783448ed6bbcad04b66379db638241c58e3ec8)

8 years agoBUG 3067: Added support for blocking if schema is not available.
Tony Tkacik [Tue, 5 May 2015 11:57:57 +0000 (13:57 +0200)]
BUG 3067: Added support for blocking if schema is not available.

Codecs are able to send specific exception, which describes
reason of failure for codec failing. If the reason is
missing schema (not yet loaded) we catch it and retry
serialization after schema context is upgraded.

User thread will be blocked maximally for 5 seconds
after that it will be unblocked.

Change-Id: I3494702eae644b495211a1a34c074e268c2f5f46
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit 6aba3ef282f86a84920fa5a7ccf21c91d459806b)

8 years agoTake advantage of YangInstanceIdentifier methods
Robert Varga [Fri, 22 May 2015 16:14:47 +0000 (18:14 +0200)]
Take advantage of YangInstanceIdentifier methods

YangInstanceIdentifier provides new, fast methods to acquire parent,
check if it empty and size of path arguments. Take advantage of them.

Change-Id: I527ff8cefb2799cb188ffe294c69e3b81a0d6909
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit ad7a6537b709a72e763835cae683b8cc12401ce1)

8 years agoBug 3224 - Parsing data with choice in case via augmentation results in
Jan Hajnar [Thu, 7 May 2015 15:09:37 +0000 (17:09 +0200)]
Bug 3224 - Parsing data with choice in case via augmentation results in
incorrect parsing

* added tests for multiple choices from augmentation parsing
for json, xml and bindinging aware context
* modified json parsing tests
* fixed choice augmentation resolution in ChoiceNodeCodecContext
and CompositeNodeDataWithSchema
* moved findCorrespondingAugment to SchemaUtils since it is useful for
multiple Classes
* replaced getNodeIdentifierForAugmentation code in SchemaUtils  with
the one from CompositeNodeDataWithSchema.

Change-Id: Ibf57a771b92de14ecb70dcbbe250d7c559066882
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
(cherry picked from commit a8f512b80e661dac1ff85db6c16c72bfbf7f5891)

8 years agoBUG 3566 : Get remote-rpc working again
Moiz Raja [Thu, 4 Jun 2015 17:18:30 +0000 (10:18 -0700)]
BUG 3566 : Get remote-rpc working again

Some changes to moving from CompositeNode to NormalizedNode had broken
remote rpc. This patch attempts to get it working again.

Verified everything works in a 3 node cluster with the clustering-test-app

Change-Id: I2ec714f1d21d95812bd5b486260be3575df252a2
Signed-off-by: Moiz Raja <moraja@cisco.com>
(cherry picked from commit 40217346551e20a809df37cd92955cd63c61944f)

8 years agoBUG-1485: remove holder for deprecated Class ranges
Robert Varga [Thu, 28 May 2015 20:34:01 +0000 (22:34 +0200)]
BUG-1485: remove holder for deprecated Class ranges

With the switchover to new range checks, the static caching field is not
needed. We still retain compatibility with possible users out there, but
they are now responsible for caching the result.

Change-Id: I119615255559263f98fc382b324026c4f5d35cfc
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 924235feb5540c5a453c522e85d13fbd1d140c5a)

8 years agoBUG-1485: remove holder for deprecated Builder field ranges
Robert Varga [Thu, 28 May 2015 20:05:51 +0000 (22:05 +0200)]
BUG-1485: remove holder for deprecated Builder field ranges

Caching the result was important as long as ranges were used internally,
now that they are not, do not retain them and re-generate them on each
call. Any callers out there are now responsible for caching them
themselves.

Change-Id: Idcba7fe54c59e33d6eedb6b596a2bf4f4a5ca10c
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 8d510398ba320a17ba932d27b98423e8bcad1a10)

8 years agoBUG-1485: switch BuilderTemplate to new range enforcement
Robert Varga [Thu, 28 May 2015 19:33:18 +0000 (21:33 +0200)]
BUG-1485: switch BuilderTemplate to new range enforcement

This switches the template for builders to the new range enforcement
code.

Change-Id: I1368a6a6922b2e982b9f4274dca32cf73b888d4b
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 5b7dc4042d5827c60bf9ca9daaaf369242c931f9)

8 years agoBUG-1485: switch ClassTemplate to new range enformcement
Robert Varga [Wed, 27 May 2015 20:00:18 +0000 (22:00 +0200)]
BUG-1485: switch ClassTemplate to new range enformcement

Switch range checks for simple classes (typedefs and similar) to the new
range checker. Also move printRangeConstraint() from BaseTemplate to
BuilderTemplate, as it ends up being used only there.

Change-Id: I16e4c1faf239d838ff415c0173ef3d06acc61701
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 02e503a09314f2e3192b85ed9fccaff5efb4942c)

8 years agoBUG-1485: optimize primitive range checks
Robert Varga [Thu, 28 May 2015 23:50:23 +0000 (01:50 +0200)]
BUG-1485: optimize primitive range checks

When we are dealing with a primitive type, we can force unboxing of the
type by declaring the range checker method's argument as the primitive
type. This will result in the stack not containing references for the
fast path (e.g. successful check) as well as reduce the number of
virtual calls to one. Checks will then be performed using primitive
manipulation instructions, which should result in better fast-path
execution.

The slow path will take a hit, as for throwing the exception, we will
end up re-boxing the primitive type.

Change-Id: I7e6b0e25790f9a43dc99f2fc7426bb9fe25c505c
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 9b5366d775b93f0e2a37f028cda11832ba65ce6d)

8 years agoBUG-1485: make AbstractRangeGenerator deal with GTOs
Robert Varga [Thu, 28 May 2015 14:57:20 +0000 (16:57 +0200)]
BUG-1485: make AbstractRangeGenerator deal with GTOs

For enforcement of ranges in builders, we will need to deal with types
other than ConcreteType. Also clean up internal interfaces, add some
javadocs and remove some trailing whitespace.

Also perform Number class conversion silently if it does not result in
loss of precision. Emit a warning if it does.

Change-Id: I8f3ba96c104fb28f6d2cfc4b05b5d24bb7f80aa1
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit d8f544b093f024ff156873c66eebf976f6738382)

8 years agoBUG-1485: deprecate public static range/length methods
Robert Varga [Thu, 28 May 2015 00:46:35 +0000 (02:46 +0200)]
BUG-1485: deprecate public static range/length methods

These methods are not efficient and expose implementation internals.
Mark them as deprecated for removal. This mirrors the deprecation in
ClassTemplate, which was not instantiated before due to how the code is
structured.

Change-Id: I7fcb831f00fd3baab02e1f25e10655c8288c6d4e
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit da603ecd3b0e093bf00ff75d80c0957196d9856d)

8 years agoBUG-1485: move generateLengthMethod to BuilderTemplate
Robert Varga [Thu, 28 May 2015 00:26:42 +0000 (02:26 +0200)]
BUG-1485: move generateLengthMethod to BuilderTemplate

While it looks this method is shared, it is not, as ClassTemplate
defines its own. Move it to BuilderTemplate and make it private,
reducing confusion.

Change-Id: I998f200a963dea39b1e2fedaf7a9fd1e394db58d
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit c2bf3960924fd870b8d3183f396c5e43b84e0aa3)

8 years agoBUG-1485: move *Range* methods to BuilderTemplate
Robert Varga [Thu, 28 May 2015 00:14:29 +0000 (02:14 +0200)]
BUG-1485: move *Range* methods to BuilderTemplate

printRangeConstraint and generateRangeMethod are used by BuilderTemplate
only, move them there to preserve locality and stop them from spreading.

Change-Id: I5d5421b50bd5e4ac65182ad1a11e7bfad199df51
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit c49ff3a94cc0b0f98dc73647a7fdc308fdaa3052)

8 years agoBUG-1485: Move restriction generation
Robert Varga [Wed, 27 May 2015 19:24:59 +0000 (21:24 +0200)]
BUG-1485: Move restriction generation

It is only used in the class template, so move it and make it private to
increase clarity.

Change-Id: I751c4a5a0af06dd89a79ce43546ec9c12490f166
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 76c57ce16f7b1b90325214e05f916bc486ad792d)

8 years agoBUG-3399: fix BaseYangTypes' range constraints
Robert Varga [Wed, 27 May 2015 23:06:14 +0000 (01:06 +0200)]
BUG-3399: fix BaseYangTypes' range constraints

Constraints Number type should match the Java type a particular type is
bound to. Users dealing with values trying to correlate it to the
metadata available can then rely on things like
value.getClass.cast(rangeMin) just working instead of concocting
conversions to deal with all possible combinations of types.

Also changes BaseConstraints to enforce the two components of a
constraint being the same type, preventing things like min being Integer
while max is a Long.

Change-Id: I38e646b4c08b032248349f3e618354aa2114efd3
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit af2244fc083e788645ac689b543af447efdf5b70)

8 years agoBUG-1485: Introduce AbstractRangeGenerator and friends
Robert Varga [Tue, 26 May 2015 20:49:36 +0000 (22:49 +0200)]
BUG-1485: Introduce AbstractRangeGenerator and friends

Adds utility classes for dealing with various range constraints in
generated code. These classes are implemented in pure Java and attempt
to make sure generated code runs as efficiently as possible.

Change-Id: Ie1d05b514937507e225b9bc7559b1949a7e6eb76
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit c5e1800bc2851c90273b6218295ffe2e59fccf91)

8 years agoBUG-1485: store patterns in an array
Robert Varga [Tue, 26 May 2015 18:32:20 +0000 (20:32 +0200)]
BUG-1485: store patterns in an array

Internal compiled patters are only ever iterated over, hence there is no
need to store them in a list. Convert the field into an array, improving
both CPU and memory efficiency very slightly. Also saves instantiation
of a temporary list.

Change-Id: I5140bc81d0a78d4f91d4ad2d6f81cbd6ed1f6d55
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 29c2d3351bdf371274433e71909236f133130bfb)

8 years agoMake test utilities static
Robert Varga [Thu, 28 May 2015 01:59:22 +0000 (03:59 +0200)]
Make test utilities static

These two can be static, make them static.

Change-Id: I3fe54607edbadea4250928e99260906cbaef4629
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 0341b340283af8efa8c7604c1d65ac87aaeecfd1)

8 years agoDo not instantiate augmentation HashMap in DTO builders
Robert Varga [Tue, 26 May 2015 22:18:57 +0000 (00:18 +0200)]
Do not instantiate augmentation HashMap in DTO builders

Tracing has revealed that the OpenFlowPlugin creates a lot of builders,
instantiation a million HashMaps, which accounts for 1% of CPU time.
Most of these maps are never touched, so we can easily optimize this
away by lazily instantiating a HashMap when the first augmentation is
added. Also prevents copying of empty augmentation in the copy
constructor.

Change-Id: I592fe6af65c9f3b65038def8bb4069666bfdc375
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 2cb012f4e814859e10726d02cb1c073321316ab3)

8 years agoClarify GeneratedTransferObject.getSuperType()
Robert Varga [Thu, 28 May 2015 15:23:27 +0000 (17:23 +0200)]
Clarify GeneratedTransferObject.getSuperType()

The Javadoc for this method is confusing and actually misleading.
Clarify it a bit for future's sake.

Change-Id: I52f09e2e9cf864dc00fb4883099ca4df5219327f
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit a2a7dee2cc6a9e83f53acd08408b227416f29bff)

8 years agoBindingReflections' cache should use cached references
Robert Varga [Wed, 3 Jun 2015 17:32:11 +0000 (19:32 +0200)]
BindingReflections' cache should use cached references

Since we will be giving out these all over the place, it is a good idea
to make sure the returned reference is system-global.

Change-Id: I46c4f62c5ea8f8ee13e7745e6c9efd7d865bd6d4
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 47e801b7f26d9e8ce68738bdfd0d1b6e6c83ae0c)

8 years agoFix newly-broken javadocs
Robert Varga [Tue, 12 May 2015 23:54:07 +0000 (01:54 +0200)]
Fix newly-broken javadocs

Self-closing elements are not allowed.

Change-Id: I9d9c655d04c420b575e6ace51aaf2b0af931ecef
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 484a0983ea48160af9a8c79acbed57ee984f5103)

8 years agoStop calling get on a possible absent value.
Tomas Cere [Tue, 2 Jun 2015 12:03:58 +0000 (14:03 +0200)]
Stop calling get on a possible absent value.

Change-Id: I76cc4d6decd7cf65f988dcb87553b280aab21b24
Signed-off-by: Tomas Cere <tcere@cisco.com>
8 years agoBug -3221 : Adding a new DataStoreUnavailableException for external applications.
Harman Singh [Mon, 18 May 2015 21:51:46 +0000 (14:51 -0700)]
Bug -3221 : Adding a new DataStoreUnavailableException for external applications.
If cluster member, which is a leader of one or multiple shards becomes unavailable,
Shard re-election happens after certain time period and anyone tries to access datastore,
receives akka.timeout exception. No application can act upon such exception.

DataStoreUnavailableException will help external applications to retry if they see this exception.

Change-Id: Iceb10580bbe73ae91dc8abb4bc6a183cb4fad6f8
Signed-off-by: Harman Singh <harmasin@cisco.com>
8 years agoAllow instantiation of more efficient RpcServiceInvokers
Robert Varga [Wed, 27 May 2015 10:54:03 +0000 (12:54 +0200)]
Allow instantiation of more efficient RpcServiceInvokers

Current invoker derived from binding class has the downside of
performing localName->methodName conversion on each invocation, which
costs us in the lookup path, as deriving the binding method name is a
costly operation.

Add a new static factory method for creating a RpcServiceInvoker
instance base on a QName->Method map. Provide two additional
implementations: a generic one, which performs a direct lookup in the
map and a specialized one, which performs lookup only on the localName
part of the qname. The latter is used after we have made sure all QNames
come from the same QNameModule.

Change-Id: I6a4b33f0487838b3ae6c15470823e4bc01114aa5
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit aab5a09be514bc7622416bf2a6d4d6a7465f9d7c)

8 years agoOptimize binding InstanceIdentifier methods
Robert Varga [Tue, 26 May 2015 13:09:00 +0000 (15:09 +0200)]
Optimize binding InstanceIdentifier methods

Openflow traces show some overhead from UnmodifiableIterable. As it
turns out, we are instantiating them needlessly for internal iteration.
This stems from accessing getPathArguments() instead of pathArguments,
which are exposed precisely for this optimization.

Make sure to access pathArguments directly, eliminating this overhead.

Change-Id: I3ef053baa35c80f555b6b9f0b8813692236afa48
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 96639b4fd02beb3590f62fdfc096936e71ad4a32)

8 years agoIntroduce DOMNotificationRejectedException
Robert Varga [Tue, 12 May 2015 23:54:29 +0000 (01:54 +0200)]
Introduce DOMNotificationRejectedException

DOMNotificationPublishService.REJECTED wraps a throwable, which may
cause problems with code which attempts to unwind it, as frameworks tend
to propagate Throwables rather than wrapping them.

Change-Id: I77d7ceeef8213425636dab92f6994fcd3f1443e9
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 12bf820406245feb0285317a88e5c7b3c9829ce6)

8 years agoBug 3234: Do not notify empty Rpc implementation change.
Tony Tkacik [Tue, 19 May 2015 09:48:49 +0000 (11:48 +0200)]
Bug 3234: Do not notify empty Rpc implementation change.

DOMRpcBroker was sending notifications with empty
set of RPC added or removed.

This is possible if registration for RPC already exists
and another one was registered.

Change-Id: Iab92d6f1e5c76a050dc00dee802e1698ca26eccc
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit 2b2ee780fded7fca2d2a3e4695e3aec7f6c1bcc2)

8 years agoBUG-2453 Add enum yang <-> Java mapping to BindingRuntimeContext
Maros Marsalek [Mon, 11 May 2015 14:40:26 +0000 (16:40 +0200)]
BUG-2453 Add enum yang <-> Java mapping to BindingRuntimeContext

BindingRuntimeContext already posses the information about all generated
classes from yang (also enums). This commit makes it public.

Change-Id: I638d73625bdc4720ee6427027246455c6c05aa03
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
8 years agoMigrade junit.frawork.Assert
Robert Varga [Mon, 25 May 2015 15:33:31 +0000 (17:33 +0200)]
Migrade junit.frawork.Assert

The new place s org.junit.Assert, migrate imports to squash eclipse
warnings.

Change-Id: I6900b400b32c7b3fd840497fec99159d6ec779db
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 392a8e3b69781c91cc52174dcb0c8132682c13c3)

8 years agoIntroduced Lazy DOM Rpc Result future.
Tony Tkacik [Thu, 21 May 2015 15:08:47 +0000 (17:08 +0200)]
Introduced Lazy DOM Rpc Result future.

Introduced LazyDOMRpcResultFuture which is used
when Binding Aware app invokes Binding Aware Rpc implementation.

  - This future encapsulates original future which
    is deencapsulated without any processing once returned
    back to Binding RPC implementation.

Change-Id: I4b65bdc884925a128db0ec6697ba84f37527593f
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit 4a8854a49907eb11952af93f188fa5050729d85b)

8 years agoBUG-3183: Extend notification publisher API
Michal Rehak [Tue, 12 May 2015 08:36:26 +0000 (10:36 +0200)]
BUG-3183: Extend notification publisher API

 - offer methods of notificationPublishService now return ListenableFuture
 - added exception for notification rejected outcome

Change-Id: Iff17e1edd754d49e6c53f97e357c34f5eac6a8ef
Signed-off-by: Michal Rehak <mirehak@cisco.com>
(cherry picked from commit 38c80b0fc0c559aabd0a8dce59dd99deab1c3418)

9 years agoBug 2528 - Binding Generator: Generated notification implements ChildOf
Peter Kajsa [Thu, 8 Jan 2015 12:50:02 +0000 (13:50 +0100)]
Bug 2528 - Binding Generator: Generated notification implements ChildOf
interface

Generated Notification interface implements ChildOf<DataObject> interface
which is incorrect. Generated Notification should not implement ChildOf
interface since it is not part of data tree. This could lead to use of
Notification in wrong context and may confuse consumers of APIs.

Notice: The solution replaces "implements ChildOf<DataObject>" with
"implements DataObject" in generated Notification interface. Notification
has structured content, so I think the generated Notification interface should
implements at least DataObject interface in order to be able to construct
InstanceIdentifier for the notification (analogously as it is by RPC's input
and output).

Change-Id: I55c7a8cc4ce450fd712c63f8e77881d4a18674e6
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
9 years agoBUG-2453 Remove custom hashcode/equals from Enum type
Maros Marsalek [Thu, 7 May 2015 12:12:17 +0000 (14:12 +0200)]
BUG-2453 Remove custom hashcode/equals from Enum type

Custom hashcode and equals made it impossible to match Enum types based on
packageName and name.

Change-Id: Ib3eed1f0892234b44f8e3459e48f303732a86ffe
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoBug 2988 - DTO equality appears to be broken by proxy
Martin Bobak [Mon, 25 May 2015 13:09:01 +0000 (15:09 +0200)]
Bug 2988 - DTO equality appears to be broken by proxy

Change-Id: Ib068be34371e8863ef6f2ef8d936d3d6918aba37
Signed-off-by: Martin Bobak <mbobak@cisco.com>
9 years agoBug 3148 - Fixed binding.api.NotificationListener support
Tony Tkacik [Thu, 7 May 2015 17:24:15 +0000 (19:24 +0200)]
Bug 3148 - Fixed binding.api.NotificationListener support

Change-Id: I5017e502a23f9cdb7d35dc393e84db7c2989f491
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit 9ca4deb2c87a332baefb4b58e264d544362b30f5)

9 years agoAllow DOMNotificationRouter to be tuneable
Robert Varga [Wed, 20 May 2015 15:53:21 +0000 (17:53 +0200)]
Allow DOMNotificationRouter to be tuneable

The details of how deep is the queue and how the backoff strategy is
applied should be tuneable. Model them and provide the hooks.

Change-Id: I6eda6bebc2cf506d627e09d3949a73e97ed866e4
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 1ef2ed07ea9d7d42963b8b2ce5e99004f6c33274)

9 years agoReduce SchemaContext updates on shutdown
Tom Pantelis [Mon, 18 May 2015 00:33:53 +0000 (20:33 -0400)]
Reduce SchemaContext updates on shutdown

The GlobalBundleScanningSchemaServiceImpl sends out a ton (hundreds) of
SchemaContext updates on shutdown. This because the removedBundle method
calls tryToUpdateSchemaContext even for bundles that weren't tracked, ie
bundles w/o yang URLs. So I added a check`for # URLs > 0.

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

9 years agoBug 2970: Fix GlobalBundleScanningSchemaServiceImpl to get RESOLVED bundles correctly
Tom Pantelis [Sun, 17 May 2015 14:49:00 +0000 (10:49 -0400)]
Bug 2970: Fix GlobalBundleScanningSchemaServiceImpl to get RESOLVED bundles correctly

The GlobalBundleScanningSchemaServiceImpl uses a BundleTracker to get
all RESOLVED bundles. When BundleTracker#open() is called
on start(), the BundleTracker will notify addingBundles of all current
bundles that pass the state mask. The OSGi container must resolve all
bundles before activating on startup. So after open() is called we
should have all the current bundles that have yang models and a complete
SchemaContext on startup based on the installed bundles from he last run.
However I was seeing some bundles notified during open() but others notified
later. This why CDS and other components may not see a complete
SchemaContext on startup.

The problem is that GlobalBundleScanningSchemaServiceImpl is passing the
wrong state mask constants. It's referencing constants defined in
BundleEvent but the BundleTracker checks bundle.getState() which
corresponds to constants defined in Bundle. The 2 have slightly
different constants and the values differ. When I change it to use
Bundle constants, it works as expected, ie all current bundles are
notified during open() and we have a complete SchemaContext after start().
I really don't see how this worked before at all using the wrong constants.

I also noticed that start() is being called twice, once in
GlobalBundleScanningSchemaServiceImpl#createInstance and then also in
the Activator after it calls createInstance. So 2 instances of
BundleTracker were being created resulting in double the notifications.
I removed the call to start() in the Activator.

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

9 years agoSet weak keys for binding mountpoint cache
Maros Marsalek [Fri, 15 May 2015 09:28:19 +0000 (11:28 +0200)]
Set weak keys for binding mountpoint cache

Change-Id: Ie3995beb7f2ffe51c882bde411048b2c59780184
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoCDS: Implement front-end support for local transactions
Robert Varga [Fri, 24 Apr 2015 11:33:24 +0000 (13:33 +0200)]
CDS: Implement front-end support for local transactions

Implemented support on the TransactionProxy front-end for optimizations
where the Shard is local to the controller instance. In this mode, the
Shard's DataTree obtained from the FindPrimaryShard message is used to
prepare the modifications completely on the front-end. On ready, the
DataTreeModification instance is passed to the Shard via
the ReadyLocalTransaction message. The Shard then does a direct commit,
eliding the 3PC from the front-end (it's a no-op as it is for remote
write-only txns).

TransactionContext instances are now obtained via an
AbstractTransactionContextFactory passed to TransactionProxy of which
there are 2 kinds: one for single, unchained txns and one for chained
tnxs. Each creates a different DOM transaction instance to handle
preperation of modifications. The DOM transacton is wrapped in a
LocalTransactionContext which the TransactionProxy interfaces with.

Change-Id: I0322b586f394e4b6c7793b8287ac804b41964378
Signed-off-by: Robert Varga <rovarga@cisco.com>
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
(cherry picked from commit 2f7c93174d7834a4c4aedacc9b88aa53a5a0422c)

9 years agoBug 2351 Speed-up Binding-to-Binding routed RPC Invocation.
Tony Tkacik [Mon, 27 Apr 2015 12:16:06 +0000 (14:16 +0200)]
Bug 2351 Speed-up Binding-to-Binding routed RPC Invocation.

Current RPC Broker uses LazySerializedContainerNodes
when going thru DOM RPC broker, so in case
RPC is returned it can by-pass deserialization and
use Binding DTO directly.

In case of routed RPCs full serialization to normalized
node was triggered when DOM RPC broker tried to
read RPC route.

This patchset introduces support for LazySerializedContainerNode
to precompute this value and do not use full serialization
when DOM Rpc Broker reads only routing context.

Change-Id: I6d949b5257d40a96ae9edce3bf15c4c3ff932c27
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit 313b9c3cdff6c7fbf94583db4b8933aa394bccc0)

9 years agoBug 3067: Improved error reporting in Binding Data Codec
Tony Tkacik [Wed, 29 Apr 2015 13:35:08 +0000 (15:35 +0200)]
Bug 3067: Improved error reporting in Binding Data Codec

Error reporting in Binding Data Codec was reworked
to throw three additional subclasses of IllegalArgumentException
for specific case of failure:

MissingSchema and MissingSchemaForClass - exception thrown
when schema context associated with codec does not contain
models for supplied class or DOM argument.

IncorrectNesting is thrown when schema is available an user
constructed data with invalid nesting (bypassed generic
compile-time checks).

The checks to determine type of exception are done only
if error condition is detected, so non-error fast path
should not be affected by advanced checks.

Added test which tests these types of exceptions.

Change-Id: Iad020a42317ab46df4d2240568fd6e8205383857
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit 3f754cccb393b989bafb8b194edf9da0ec3e9e8a)