mdsal.git
4 years agoFix string duplication in Ipv6Utils 04/84404/1
Robert Varga [Fri, 16 Aug 2019 11:40:52 +0000 (13:40 +0200)]
Fix string duplication in Ipv6Utils

This is minor code smell, create a method to concentrate common
functionality.

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

4 years agoRemove trailing comments 03/84403/1
Robert Varga [Fri, 16 Aug 2019 11:20:53 +0000 (13:20 +0200)]
Remove trailing comments

This fixes up minor code smells reported by sonar.

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

4 years agoFix runtime builder string duplication 02/84402/1
Robert Varga [Fri, 16 Aug 2019 11:36:16 +0000 (13:36 +0200)]
Fix runtime builder string duplication

This is a minor code smell, concentrate exception allocation to
get rid of it.

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

4 years agoFix mergeable if-the-else statements 01/84401/1
Robert Varga [Fri, 16 Aug 2019 13:32:11 +0000 (15:32 +0200)]
Fix mergeable if-the-else statements

This fixes DTOs to use simple return expressions. While we are in
the area, also optimize toString() methods to lower their footprint.

Change-Id: Ie206c2942c5fb9b6cbbdc2a31d197560559fd660
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 18748923d6759e0e301b608e6d6bb15a69583bbb)
(cherry picked from commit f9c46078ecd09194cb9f109297c70a296f349829)

4 years agoMake BaseTemplate.asArguments() take a Collection 99/84399/1
Robert Varga [Thu, 5 Sep 2019 12:25:28 +0000 (14:25 +0200)]
Make BaseTemplate.asArguments() take a Collection

This side-steps the need for IterableExtensions, make the code
a tad faster.

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

4 years agoRemove use of new Integer(String) 98/84398/1
Robert Varga [Thu, 5 Sep 2019 10:05:57 +0000 (12:05 +0200)]
Remove use of new Integer(String)

This constructor has been deprecated in Java 9, migrate to
Integer.valueOf(String) instead.

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

4 years agoOptimize array checks 97/84397/1
Robert Varga [Wed, 4 Sep 2019 14:24:01 +0000 (16:24 +0200)]
Optimize array checks

Rather than bouncing through .importedName().contains("[]"), we
can make this check through .name().endsWith("[]"), which prevents
a round-trip to import mechanics and is potentially faster.

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

4 years agoCache computed fieldName in templates 96/84396/1
Robert Varga [Wed, 4 Sep 2019 14:17:32 +0000 (16:17 +0200)]
Cache computed fieldName in templates

We end up using the same name multiple times, which really is an
invariant. Cache and reuse the constant, so that we end up with
more efficient code.

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

4 years agoFix ClassTemplate.genConstructor() declaration 95/84395/1
Robert Varga [Wed, 4 Sep 2019 12:44:47 +0000 (14:44 +0200)]
Fix ClassTemplate.genConstructor() declaration

Using an array here is forcing us to needlessly unwrap the arraylist
(a perfectly iterable thing) to an array, which is only iterater over.

Fix this by passing down an iterable, which means the list can be
passed down as is.

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

4 years agoAcquire first value manually in ClassTemplate 94/84394/1
Robert Varga [Wed, 4 Sep 2019 12:40:35 +0000 (14:40 +0200)]
Acquire first value manually in ClassTemplate

xtend's get(0) extension ends up creating a temporary list
holding a copy of the (single) value. This is not entirely
efficient, as we can get the same result from plain iterator.

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

4 years agoAcquire first entry of type constants in BuilderTemplate 93/84393/1
Robert Varga [Wed, 4 Sep 2019 12:30:47 +0000 (14:30 +0200)]
Acquire first entry of type constants in BuilderTemplate

Current code is relying on xtend Conversions to get first entry
from keySet/values separately. That code ends up copying the entire
collection into an array before picking the first element, which
is ... far from optimal.

Peel the first entrySet item using iterator().next() and then
reference key/value from there, which removes a dependency on
Conversions and is way more efficient.

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

4 years agoOptimize allProperties sorting 92/84392/1
Robert Varga [Wed, 4 Sep 2019 11:55:25 +0000 (13:55 +0200)]
Optimize allProperties sorting

Java 8 has list.sort(), which we can easily short-circuit to
ArrayList's implementation by using 'val' declaration. We can
also make the comparator a constant, so that it is widely reused.

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

4 years agoOptimize ClassTemplate.allProperties 91/84391/1
Robert Varga [Wed, 4 Sep 2019 11:46:14 +0000 (13:46 +0200)]
Optimize ClassTemplate.allProperties

This variable is guaranteed to be a List, declare it as such,
adding following benefits:
- eliminates ClassTemplate's reliance on IterableExtensions
- a few isEmpty() checks get be eliminated, as size() is now
  handled through List.size()

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

4 years agoOptimize BuilderTemplate string references 90/84390/1
Robert Varga [Wed, 4 Sep 2019 11:34:38 +0000 (13:34 +0200)]
Optimize BuilderTemplate string references

AUGMENTATION_FIELD.toFirstUpper is a true constant, make sure we
compute it only once.

Also, in case of augmentable, the augmentable imported name is an
invariant, hence precompute the string and use it multiple times
in the template.

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

4 years agoImprove generated builder documentation 89/84389/1
Robert Varga [Tue, 3 Sep 2019 20:01:24 +0000 (22:01 +0200)]
Improve generated builder documentation

This adds some sorely-needed guidelines as to how to use generated
builders.

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

4 years agoBump yangtools to 2.1.12 68/84368/2
Robert Varga [Fri, 13 Sep 2019 06:58:51 +0000 (08:58 +0200)]
Bump yangtools to 2.1.12

Pick up latest fixes.

Change-Id: Ifb9874f0ef47e4c6f90a5ef3c69aedfbf7dbc45c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove javadoc plugin override 67/84367/2
Robert Varga [Fri, 13 Sep 2019 06:57:06 +0000 (08:57 +0200)]
Remove javadoc plugin override

odlparent is shipping v3.1.1, hence we do not need to provide
an explicit version.

Change-Id: I0e5d8cf2200a39de46f975f9cd84174b443b76ca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent to 4.0.12 66/84366/2
Robert Varga [Fri, 13 Sep 2019 06:56:32 +0000 (08:56 +0200)]
Bump odlparent to 4.0.12

This bumps odlparent to the latest release.

Change-Id: I32b4a951974d0f5538eebf1f46c16ec0beceb9b5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix curly braces 88/84388/1
Robert Varga [Tue, 6 Aug 2019 12:24:20 +0000 (14:24 +0200)]
Fix curly braces

These anonymous classes should be properly spelled out, as should
private constructors.

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

4 years agoFix checkstyle in javadocs 87/84387/1
Robert Varga [Tue, 6 Aug 2019 11:29:45 +0000 (13:29 +0200)]
Fix checkstyle in javadocs

Updated checkstyle is catching more violations, fix them up.

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

4 years agoFix bad javadoc license headers 86/84386/1
Robert Varga [Mon, 5 Aug 2019 14:20:31 +0000 (16:20 +0200)]
Fix bad javadoc license headers

License headers should not be javadocs, fix that up.

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

4 years agoFix Builder javadoc mis-reference 85/84185/1
Robert Varga [Tue, 3 Sep 2019 19:24:17 +0000 (21:24 +0200)]
Fix Builder javadoc mis-reference

Builders should reference target type in their documentation.

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

4 years agoImprove BaseYangTypes lookups 53/84153/1
Robert Varga [Mon, 2 Sep 2019 15:42:40 +0000 (17:42 +0200)]
Improve BaseYangTypes lookups

Update constant definition to be bound to ImmutableSet, so that
JIT has an easier time optimizing these lookups.

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

4 years agoGuard generator lookup against nulls 56/83956/1
Robert Varga [Sat, 24 Aug 2019 08:46:16 +0000 (10:46 +0200)]
Guard generator lookup against nulls

If we encounter an unsupported type we can end up throwing a NPE
without any details. This hardens the lookup to verify we have
a hit, and report the type if we have a miss.

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

4 years agoEliminate 'txt' temporary 88/83688/1
Robert Varga [Thu, 15 Aug 2019 11:29:15 +0000 (13:29 +0200)]
Eliminate 'txt' temporary

This variable is not really needed and the way it is used SpotBugs
reports a (valid) dead local store. Eliminate the variable completely.

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

4 years agoFix use of StringTokenizer methods 74/83674/1
Robert Varga [Thu, 15 Aug 2019 11:21:56 +0000 (13:21 +0200)]
Fix use of StringTokenizer methods

Rather than using Enumeration-related methods (*Element()), use
the methods provided by StringTokenizer (*Token()), which have
the same functionality, but are not down-casted to Object.

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

4 years agoMake AlphabeticallyTypeMemberComparator Serializable 73/83673/1
Robert Varga [Thu, 15 Aug 2019 11:07:20 +0000 (13:07 +0200)]
Make AlphabeticallyTypeMemberComparator Serializable

Comparators are recommended to be serializable, this fulfills
the need.

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

4 years agoFix SpotBugs complaing around locale 72/83672/1
Robert Varga [Thu, 15 Aug 2019 11:05:50 +0000 (13:05 +0200)]
Fix SpotBugs complaing around locale

We are using english locale, which should work across the platform.

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

4 years agoFix InterfaceTemplate documentation 71/83671/1
Robert Varga [Thu, 15 Aug 2019 11:04:26 +0000 (13:04 +0200)]
Fix InterfaceTemplate documentation

InterfaceTemplate will fail to instantiate with a NPE if a null
type is ever passed in. Fix documentation and remove dead code.

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

4 years agoOptimize whitespace replacement 01/83601/2
Robert Varga [Tue, 6 Aug 2019 15:27:33 +0000 (17:27 +0200)]
Optimize whitespace replacement

Rather than doing two replacements, use a single two-character
matcher and a single replacement pass. While we're in the area,
also create a SPACE constant and use it where we mean ' ' as a
char (not a string).

Change-Id: I30d7c16074fe172a834ecf1bb0fe30a18fdc6bac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse bulk-close for internal registrations 27/83627/1
Robert Varga [Wed, 14 Aug 2019 14:49:59 +0000 (16:49 +0200)]
Use bulk-close for internal registrations

Rather than using wrapped registrations through the public API,
we really want to first remove all modules and then update the
context (if needed).

JIRA: MDSAL-466
Change-Id: Ib281fff7264b3dd11b222095f8286087cb488002
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a89133403cedfb24983ef5a9d945ab02232fd1bd)

4 years agoDisable updates when we are stopping 79/83579/1
Robert Varga [Tue, 6 Aug 2019 17:48:05 +0000 (19:48 +0200)]
Disable updates when we are stopping

We should not be propagating bundle updates when we know we are
stopping. This patch marks that knowledge in the tracker.

JIRA: MDSAL-466
Change-Id: Ie4e8b96907a8909150b4080000888d1d10ce8e54
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 7a739663d766c8ee83fb17e0e4199a3945ad674f)

4 years agoDo not lose newlines/tabs from javadoc 31/83431/1
Robert Varga [Tue, 6 Aug 2019 14:24:44 +0000 (16:24 +0200)]
Do not lose newlines/tabs from javadoc

When we are formatting javadoc for a accessor method, we must treat
any newlines/tabs as whitespace and not lose them, otherwise we would
end up with concatenated words.

JIRA: MDSAL-416
Change-Id: I3c0fc296692a141d6787a5cba8b17738a108274e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions for 3.0.11-SNAPSHOT 06/83106/1
Robert Varga [Thu, 18 Jul 2019 10:59:08 +0000 (12:59 +0200)]
Bump versions for 3.0.11-SNAPSHOT

This starts the next development iteration.

Change-Id: I8255d7cf0dcc4b8d7ea4ba94dc9d50d7dba774bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove unneeded null check 50/82950/1
Robert Varga [Mon, 8 Jul 2019 09:24:06 +0000 (11:24 +0200)]
Remove unneeded null check

We are performing a null and an instanceof check, where the latter
can also serve as a a null check. Remove the explicit null check.

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

4 years agoRemove unneeded temporary variables 49/82949/1
Robert Varga [Mon, 8 Jul 2019 09:16:24 +0000 (11:16 +0200)]
Remove unneeded temporary variables

getRpcs/getNotifications() result is only ever iterated over,
we do not need a full Set.

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

4 years agoMake LogicalDatastoreType a WritableObject 23/82923/1
Robert Varga [Wed, 3 Jul 2019 22:37:53 +0000 (00:37 +0200)]
Make LogicalDatastoreType a WritableObject

This is a low-cardinality enum, which we need to serialize quite
often. Make it a simple WritableObject, so users can get common
handling. One specific user is sal-remoterpc-connector, which
needs to be able to serialize DOMDataTreeIdentifier.

JIRA: CONTROLLER-1894
Change-Id: Iee4610e093639629039a2e21ab1cfc852b756169
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b0c200e4da8fced37726872197c510766a7ed4fd)

4 years agoUse cached AugmentationIdentifiers in BindingRuntimeContext 98/82898/2
Robert Varga [Fri, 31 May 2019 10:55:50 +0000 (12:55 +0200)]
Use cached AugmentationIdentifiers in BindingRuntimeContext

AugmentationIdentifiers allocated from BindingRuntimeContext
end up being used across the system. This ensures we squash
instances to system-wide cache.

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

4 years agoImprove getResolvedAugmentationSchema() 97/82897/2
Robert Varga [Fri, 31 May 2019 10:11:08 +0000 (12:11 +0200)]
Improve getResolvedAugmentationSchema()

This method is used for instantiating prototypes, from whence
it is used all over the place. Sharing a single instance allows
us to slightly improve lookups.

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

4 years agoTake advantage of AbstractAugmentable 99/82899/1
Robert Varga [Wed, 1 May 2019 14:34:35 +0000 (16:34 +0200)]
Take advantage of AbstractAugmentable

Rather than hand-rolling Augmentable implementations, take advantage
of AbstractAugmentable as the holder of augmentations -- reducing
the amount of generated code.

Since this leads to generated code not being exposed to augmentation(),
we can now rename the generic argument there to a full-compliant
name.

JIRA: MDSAL-445
Change-Id: I2459489074e9e50e82bd9d1c8eb051f9833b7a0b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4fe6932b0f3911ee4a7684d3c9616efbbeb053a1)

4 years agoFix augmented action code generation 90/82890/1
Robert Varga [Tue, 2 Jul 2019 11:49:06 +0000 (13:49 +0200)]
Fix augmented action code generation

When an action is introduced as part of an augment statement, we
attempt to generate it in the augmented module, which refuses to
generate its input/output statements, leading to a NPE.

This patch updates codegen to ignore augmenting actions in the
augmented module and process them as part of augmentation.

JIRA: MDSAL-459
Change-Id: Ibd7d7abc5ec1eec6d32ee1885da00a0de69b2445
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit dee452d009946a175273ac2a21dca4174b2142af)

4 years agoBump versions to 3.0.10-SNAPSHOT 12/82812/1
Robert Varga [Mon, 1 Jul 2019 06:37:45 +0000 (08:37 +0200)]
Bump versions to 3.0.10-SNAPSHOT

This starts the next development iteration.

Change-Id: Iedb025a8e224ef2262687829c316843f7cfa07b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump yangtools to 2.1.11 10/82810/1
Robert Varga [Mon, 1 Jul 2019 04:14:15 +0000 (06:14 +0200)]
Bump yangtools to 2.1.11

This picks up the latest improvements.

Change-Id: Ide1aecefbcd747770d78fd9ff49e1cef14ff64f4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent to 4.0.11 09/82809/1
Robert Varga [Mon, 1 Jul 2019 04:13:44 +0000 (06:13 +0200)]
Bump odlparent to 4.0.11

This picks up the latest updates.

Change-Id: Iad627fdf7c2261aa0c49a7b8a7502d3564b38cad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoResolve bits/union nested type naming 62/82762/1
Robert Varga [Tue, 25 Jun 2019 13:07:06 +0000 (15:07 +0200)]
Resolve bits/union nested type naming

The cases where we allocate an enumeration, bits or union type
for a leaf-like construct (leaf, leaf-list) need to handle an
edge case -- JLS does not allow nested classes to be named the
same as the enclosing class.

Enumeration case was already handled in
AbstractGeneratedTypeBuilder, this patch extends that support
to handle bits and union.

JIRA: MDSAL-458
Change-Id: Idc19b179274c7973ed205ffdae1d2242cbd2dbf6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 30952238d240260310d357c2e80be55021ccb1fc)

4 years agoRemove unused Matcher 45/82745/2
Robert Varga [Wed, 26 Jun 2019 11:20:33 +0000 (13:20 +0200)]
Remove unused Matcher

DOT_MATCHER is not used anywhere, remove it.

Change-Id: Ibc9cbdab0d9008cfd63522db951c93843ea20a66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoReuse SUCCESS_FUTURE 47/82747/1
Robert Varga [Mon, 24 Jun 2019 15:36:40 +0000 (17:36 +0200)]
Reuse SUCCESS_FUTURE

Rather than allocating new temporary objects reuse a constant
we have handy.

Change-Id: I3b27eb1cc75c967e4f880e2c5f287c040276f674
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFlatten submodule hierarchy for YangModuleInfo 70/82670/1
Anna Bencurova [Mon, 10 Jun 2019 12:55:49 +0000 (14:55 +0200)]
Flatten submodule hierarchy for YangModuleInfo

YANG inherently contains modules and submodules, where submodules
do not really have further submodules. While YANG 1.0 allowed
inclusion of submodules in other submodules, and that is modeled
in yang-model-api, this practice has been deprecated with YANG 1.1.

If we are faced with multiple such includes, for example both
module and submodule including a second submodule, we could end up
generating superfluous classes, just to represent the second
submodule twice (once for module's purposes and once for submodule's
purposes) -- hence when all of them are collected recursively, we
would end up with two distinct instances for the same source.

Since submodules are not directly visible outside of the main class,
this hierarchy is not public API and is a purely internal thing.

This patch re-organizes generation so that we present all submodules
as dependencies of the main module, which automatically solves the
problem, while also making for nicer class layout, as we do not get
multiply-nested classes.

JIRA: MDSAL-457
Change-Id: Ic78edaf852f3497f3c4c96fdca3a77de30b7f8c1
Signed-off-by: Anna Bencurova <Anna.Bencurova@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4a8ae0d2fbffc56edc956cde9a9ecde28f3e9a34)

4 years agoCheck registration being closed 56/82556/1
Robert Varga [Tue, 30 Apr 2019 03:35:41 +0000 (05:35 +0200)]
Check registration being closed

Check if the registration has been closed before firing events.
This way we stop delivering events a bit sooner, improving shutdown
speed and correctness.

JIRA: MDSAL-429
Change-Id: I533f2b07e8cd14597c29d2d3d9c11c44a1bb7ff5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d90336420645d32d2c4684c7fd3839827e903774)

4 years agoAdd a simplified SimpleDOMActionResult constructor 38/82238/1
Robert Varga [Fri, 24 May 2019 14:59:11 +0000 (16:59 +0200)]
Add a simplified SimpleDOMActionResult constructor

If the user is not providing any errors, it should be a fair
game to provide just the value.

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

5 years agoGroupingDefinitionDependencySort needs to consider actions 26/82126/1
Robert Varga [Wed, 15 May 2019 12:01:19 +0000 (14:01 +0200)]
GroupingDefinitionDependencySort needs to consider actions

In order to be able to correctly process actions/notifications
which can refer to other groupings, we must properly sort them
within each module.

To do that, GroupingDefinitionDependencySort must consider
uses nodes within them to properly construct the dependency
graph.

JIRA: MDSAL-448
Change-Id: I627702e39b1ab235b1c77ceaa2717ee03b3b2e39
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6fca42e6bde88795354a2a2386bc7a6d76aaec47)

5 years agoDo not issue immediate build when looking up grouping 90/82090/1
Robert Varga [Wed, 15 May 2019 11:52:34 +0000 (13:52 +0200)]
Do not issue immediate build when looking up grouping

If we fail to find a grouping, we will end up with a NPE which
does not provide any information. Move the .build() call so that
the proper ISE kicks in.

JIRA: MDSAL-448
Change-Id: I57d6a74074b49def9bbc814732cfc48cd5265072
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e802061e56eea9779e13eede5f949aa96666ea28)

5 years agoAllow SnapshotBackedReadTransaction customization 52/81952/1
Robert Varga [Tue, 7 May 2019 13:03:57 +0000 (15:03 +0200)]
Allow SnapshotBackedReadTransaction customization

In some specific cases we need to customize abort-like handling,
which is already implemented for write-like transactions, but is
not present for read-only transaction.

This patch adds the capability to attach a close() handler and
makes sure AbstractSnapshotBackedTransactionChain takes advantage
of it.

JIRA: CONTROLLER-1879
Change-Id: Ic7027956556b5dd25120ee81613a6151e5dbc501
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit bd73bf5803137b27e25a647ff056da3f59e0a682)

5 years agoFix memory leak in BA mount service 03/81903/1
Robert Varga [Sun, 5 May 2019 18:15:19 +0000 (20:15 +0200)]
Fix memory leak in BA mount service

The cache used in BA mount service uses weakKeys() so the keys
(DOM mountpoint) could be GCed when no except cache, referenced
them).

However the values in the cache (BA mountpoint) also kept a reference
to the key, so the key was never weakly reachable and thus never GCed
resulting in a memory leak.

This is especially visible in case of frequent reconnects of netconf
mountpoints where after every reconnect a new DOM mountpoint is
created, requiring a new BA mountpoint creating new entry in the
cache of BA mount service.

This patch updates the entire suite of adapters, as it is shared
across all instances.

Change-Id: I9c109dd6d499d6185842d6a1ad5a59d75565af5c
Signed-off-by: Maros Marsalek <mmarsalek@frinx.io>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8ae89c54f8019f53327001d1b916a53963097b34)

5 years agoSpeed up BindingReflections.getAugmentations() 81/81881/1
Robert Varga [Wed, 24 Apr 2019 09:05:38 +0000 (11:05 +0200)]
Speed up BindingReflections.getAugmentations()

One of the ways in which we can acquire augmentations is through
AugmentationHolder interface. While this is handled through
AugmentationFieldGetter.getGetter(), that is not really efficient
as it requires indirection through multiple implementations.

Since AugmentationFieldGetter is a package-internal implementation
detail, factor the check out into BindingReflections, where it can
execute directly. This not only improves locality, but also allows
us to remove one AugmentationFieldGetter implementation, resulting
in bimorphic invocation.

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

5 years agoIntroduce AbstractAugmentable 80/81880/1
Robert Varga [Wed, 1 May 2019 14:29:00 +0000 (16:29 +0200)]
Introduce AbstractAugmentable

Binding generated code hand-implements handling of augmentations,
which leads to some amount of duplicated code, but notably a lot
of distinct implementations of Augmentatable.augmentation().

We can improve the situation by providing a simple base class which
holds an immutable map of augmentations implementing
AugmentationHolder and Augmentable interfaces.

JIRA: MDSAL-445
Change-Id: I693cd4fbec3d236f039e01448dc4994722b5582d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 5e590b00d38ddbc28079d6f10928275136aa6b78)

5 years agoOptimize DataObjectCodecContext memory footprint 73/81873/1
Robert Varga [Thu, 2 May 2019 10:27:58 +0000 (12:27 +0200)]
Optimize DataObjectCodecContext memory footprint

Examining heap dumps while working on MDSAL-442/MDSAL-443 revealed
a slight inefficiency in DataObjectCodecContext: we are forcing
byStreamClass's entrySet to be instantiated for the purposes of
copying it into byBindingArgClassBuilder.

This patch corrects the mistake by using byStreamClassBuilder
as the source of copied entries -- which holds the same content,
but we will be throwing it away.

Furthermore byStreamClass and byBindingArgClass are only distinct
when we have a choice child, hence we also run comparison on the
two builders and reuse byStreamClass if they are equal.

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

5 years agoSpeed up DataContainerCodecPrototype.get() a bit 16/81716/1
Robert Varga [Tue, 23 Apr 2019 09:38:33 +0000 (11:38 +0200)]
Speed up DataContainerCodecPrototype.get() a bit

We can use less byte code to initialize both the local handle
and the cache field.

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

5 years agoAdd binding/dom codec class loader support 02/81702/2
Robert Varga [Thu, 18 Apr 2019 11:07:22 +0000 (13:07 +0200)]
Add binding/dom codec class loader support

Our current codec implementation relies on creating classes in
classloaders holding compile-time-generated code, effectively
polluting them, in two distinct ways.

The first, less intrusive, is the instantiation of dynamic
proxies, which support LazyDataObject and ForeignOpaqueObject
instances. Since this is done via JVM interfaces, the JVM
takes care of reusing these classes, but still they cannot
be removed when the binding-dom-codec is unloaded -- fortunately
their nature of being derived from yang-binding and compile-time
generated interfaces allows them to be reused.

The second, more intrusive, is the instantiation of dynamic
streamers to support emitting NormalizedNode structures from
DataObject instances. While there are some provisions to reuse
them, they are inherently tied to how BindingRuntimeContext
interprets generated classes -- if the underlying SchemaContext
ends up interpreting them incompatibly (for example, by leaf
changing to anyxml), we end up between a rock and a hard place --
the classes do not match NormalizedNode world and they cannot
be reloaded to rectify the problem.

This patch adds the infrastructure for separating out compile-time
and run-time worlds by introducing StaticClassPool and
CodecClassLoader. StaticClassPool is used to bind Javassist code
generator to the classloader into which binding-dom-codec is loaded.

CodecClassLoader allows effective bridging of StaticClassPool and
whatever classloader is loading compile-time-generated classes,
and provides a place where new classes can be defined without
polluting either classloader.

Change-Id: I963c7bc6eefd5dd77a80e06442896265116664c0
JIRA: MDSAL-442
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 57c0721d7660c83dadf2194923d75f7e4d664b7e)

5 years agoMake LazySerializedDOMNotification a DOMEvent 01/81701/2
Robert Varga [Thu, 11 Apr 2019 20:10:16 +0000 (22:10 +0200)]
Make LazySerializedDOMNotification a DOMEvent

DOMEvent carries the information about when the event occurred,
make sure we propagate it when available and backfill it on
submission.

It also retrofits some @NonNull annotations to make it clear we
are not propagating nulls.

JIRA: MDSAL-282
Change-Id: I2153b007af2accbad41f5aea00dbced21030a67d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2188563bd18dccb50bbbfa13235ca4955c7eb7dc)

5 years agoOptimize source generation 99/81699/2
Robert Varga [Sun, 14 Apr 2019 14:22:50 +0000 (16:22 +0200)]
Optimize source generation

Since StringBuilder is fluent, we can optimize some of the source
generation utilities to have less bytecode. Also mark FIXMEs for
future improvement, as these would allow better devirtualization.

Furthermore we expose Class-based cast/assign operations, which
trim down code duplication a tiny bit.

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

5 years agoExtend AugmentableExtension to handle AugmentationHolder 00/81700/1
Robert Varga [Wed, 17 Apr 2019 14:04:28 +0000 (16:04 +0200)]
Extend AugmentableExtension to handle AugmentationHolder

This class seems to be a duplicate of BindingReflections'
functionality, completely missing out on AugmentationHolder, which
can be used as an alternative to expose augmentations.

Change-Id: Iadcc4e2f4587ceeb27d6a47c42b0319705fc1e58
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDefine OpaqueData/OpaqueObject hashCode/equals 46/81646/2
Robert Varga [Fri, 12 Apr 2019 02:09:33 +0000 (04:09 +0200)]
Define OpaqueData/OpaqueObject hashCode/equals

This adds baseline hashCode/equals specification, so that we do not
rely on identity for comparisons.

JIRA: MDSAL-439
Change-Id: I41291935a0402f6fce13b6e49531d85e2fc905d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4c82af2a3ed7b1dc78b8e50b749dbd2b0c82268c)

5 years agoTag generated QNAME field with @NonNull 45/81645/1
Robert Varga [Sun, 14 Apr 2019 07:33:15 +0000 (09:33 +0200)]
Tag generated QNAME field with @NonNull

Improve code generation, so that users can be sure QNAME is never
nullable, improving interactions with APIs which take a QName.

Change-Id: I0454ba448fb9edb605d04e97901381ae0f8a79d0
JIRA: MDSAL-441
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 046cf58dc3b606edb90ebb8919f1121b8e4f2540)

5 years agoTag InstanceIdentifier methods with @Nullable/@NonNull 44/81644/1
Robert Varga [Sun, 14 Apr 2019 07:08:33 +0000 (09:08 +0200)]
Tag InstanceIdentifier methods with @Nullable/@NonNull

Most of these methods are guaranteed to return non-null, tag them
as such, improving user experience.

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

5 years agoTag NotificationPublishService.REJECTED as non-null 02/81602/1
Robert Varga [Thu, 11 Apr 2019 20:08:37 +0000 (22:08 +0200)]
Tag NotificationPublishService.REJECTED as non-null

This can only ever be a non-null constant, tag is as such.

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

5 years agoBump versions to 3.0.9-SNAPSHOT 76/81576/1
Robert Varga [Thu, 11 Apr 2019 16:42:42 +0000 (18:42 +0200)]
Bump versions to 3.0.9-SNAPSHOT

This starts the next development cycle.

Change-Id: I8f9550618fe1b3b2cda1e5e067b9c065f6d57328
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump yangtools to 2.1.10 65/81565/1
Robert Varga [Thu, 11 Apr 2019 11:09:50 +0000 (13:09 +0200)]
Bump yangtools to 2.1.10

Use yangtools version aligned with odlparent-4.0.10.

Change-Id: I95024bfcba252539926074b7ee10d2c4ad3b093a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump odlparent to 4.0.10 64/81564/1
Robert Varga [Thu, 11 Apr 2019 11:09:16 +0000 (13:09 +0200)]
Bump odlparent to 4.0.10

Adopt latest upgrades from odlparent.

Change-Id: I13ebcbe5c20aa208ca3d638494f32fc5d9140271
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump versions to 3.0.8-SNAPSHOT 63/81563/1
Robert Varga [Thu, 11 Apr 2019 11:08:40 +0000 (13:08 +0200)]
Bump versions to 3.0.8-SNAPSHOT

This starts the next development cycle.

Change-Id: I6c85e4f82eff7550545992f452626353bcf75075
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoEnable spotbugs in ietf-type-util 56/81556/1
Robert Varga [Fri, 22 Mar 2019 19:01:31 +0000 (20:01 +0100)]
Enable spotbugs in ietf-type-util

This is just a trivial flipping of the switch.

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

5 years agoFix ietf-type-util checkstyle 55/81555/1
Robert Varga [Fri, 22 Mar 2019 18:46:53 +0000 (19:46 +0100)]
Fix ietf-type-util checkstyle

This fixes checkstyle violations, adding a few suppressions and
remove UnsupportedExceptionThrows and related reflection-based tests.

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

5 years agoBindingAdapterFactory should be Immutable 54/81554/1
Robert Varga [Tue, 26 Mar 2019 13:04:05 +0000 (14:04 +0100)]
BindingAdapterFactory should be Immutable

This class is immutable, which implies thread-safety, removing
the need for @ThreadSafe.

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

5 years agoRemove @(Not)ThreadSafe annotation 53/81553/1
Robert Varga [Tue, 26 Mar 2019 13:03:15 +0000 (14:03 +0100)]
Remove @(Not)ThreadSafe annotation

Use documentation rather than JSR305 to document non-thread-safety.
In package-private classes these annotations often do not make
sense.

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

5 years agoDo not fail if invoking of listener fails 52/81552/1
Jakub Morvay [Sat, 6 Apr 2019 09:19:13 +0000 (11:19 +0200)]
Do not fail if invoking of listener fails

DOMMountPointServiceImpl should not fail and propagate uncaught
exceptions from mount point listeners. When invocation of a registered
listener onMounPpointCreated or onMounPointRemoved callback fails, just
log the error and continue execution.

Change-Id: I5d182b610c0b5749cfe01efc13bc1dddfffa5283
Signed-off-by: Jakub Morvay <jakub.morvay@gmail.com>
(cherry picked from commit 2ef4a8d7750fee095a21318236d401727b1c8ae0)

5 years agoFix small formatting issue 51/81551/1
Jakub Morvay [Sat, 6 Apr 2019 16:17:25 +0000 (18:17 +0200)]
Fix small formatting issue

Change-Id: I48128fee6f2ff9f8e27fb5714cec1fbbd44af2e9
Signed-off-by: Jakub Morvay <jakub.morvay@gmail.com>
(cherry picked from commit 6fe135d7aceb33c860fc3fbd01a289dc30804fcf)

5 years agoAdd AbstractDOMSchemaService and FixedDOMSchemaService 50/81550/1
Michael Vorburger [Mon, 28 Jan 2019 21:11:36 +0000 (22:11 +0100)]
Add AbstractDOMSchemaService and FixedDOMSchemaService

AbstractDOMSchemaService allows more code reuse between implementations
by holding the common bits needed to interface with SchemaContextProviders.

Also use these to implement a FixedDOMSchemaService for use in situations
when the SchemaContext and the set of associated sources are known to
never change.

This also slightly simplifies ScanningSchemaSourceProvider.

JIRA: MDSAL-418
Change-Id: I554837f8ae93e5bbb741b4cb801c31b8ebfcaa03
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
(cherry picked from commit 6f527c4f41f6d363cbd486e925e2447c4ab26995)

5 years agoReduce use of getDataChildByName() 49/81549/1
Robert Varga [Tue, 9 Apr 2019 06:47:51 +0000 (08:47 +0200)]
Reduce use of getDataChildByName()

Using findDataChildByName() is null-safe, allowing us to reduce
the number of assertions.

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

5 years agoClean up tryToUseCacheElse() 48/81548/1
Robert Varga [Wed, 10 Apr 2019 12:51:00 +0000 (14:51 +0200)]
Clean up tryToUseCacheElse()

Generated code is a bit ugly for the case of accessing cache,
with missing newline and misplaced whitespace. Clean that up.

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

5 years agoDocument BindingCodec/Serializer/Deserializer 47/81547/1
Robert Varga [Wed, 10 Apr 2019 11:10:57 +0000 (13:10 +0200)]
Document BindingCodec/Serializer/Deserializer

These interfaces are not documented at all, owing partly to the fact
they are are implementation of mdsal-binding-dom-codec, whose design
currently requires placing codecs into the same class loader as
generated code -- hence they leak to the common binding support
package.

Change-Id: Ib576b9aeddcc644d5b1f44a2047e775cc5266245
JIRA: MDSAL-401
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 3c45e3dec46d38b7c6fe121ca23d48ac602fe55f)

5 years agoBump yangtools to 2.1.9 45/81545/1
Robert Varga [Wed, 10 Apr 2019 23:40:52 +0000 (01:40 +0200)]
Bump yangtools to 2.1.9

This adopts the latest yangtools release.

Change-Id: Ia603a7c56c0e1ce77bff66b9e963653cee1b5a11
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd Opaque{Data,Object} interfaces 26/81326/3
Robert Varga [Wed, 27 Mar 2019 15:31:07 +0000 (16:31 +0100)]
Add Opaque{Data,Object} interfaces

This adds the baseline interfaces needed for generating
manifestations of anydata and anyxml node sin Binding world.

Since they are conceptually the same and cannot have the same
identifier, we can support them with a single BindingObject
sub-interface.

JIRA: MDSAL-428
Change-Id: I7d7e0ff6c7bcd7d2375d50c4e976bf68d4e47143
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 25952d26001a7ef4a04f713312f864b8af397f69)

5 years agoAdd yang-binding interfaces for annotations 25/81325/1
Robert Varga [Wed, 27 Mar 2019 13:53:01 +0000 (14:53 +0100)]
Add yang-binding interfaces for annotations

Binding users are interested in having a way to access RFC7952
metadata. While the actual codegen/runtime implementation requires
some work, we know what Binding Specification extension we will
need to support the generated classes.

This patch introduces Annotation and AnnotationAware, so a future
codegen version can bind to it.

JIRA: MDSAL-357
Change-Id: I2fed30ea34b21c36b626388bb37890cc73875176
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4bd8c8ccb296b0982fe2b5b287976a55610511f8)

5 years agoAdd EventInstantAware interface 24/81324/1
Robert Varga [Wed, 27 Mar 2019 12:55:15 +0000 (13:55 +0100)]
Add EventInstantAware interface

This interface will be used to carry the equivalent of RFC5277
notification eventTime. It is modeled exactly the same way as
DOMEvent/DOMNotification, hence it will allow us to bridge the gap
in binding-dom-adapter, where we are losing this information.

JIRA: MDSAL-282
Change-Id: Ie93015c2609a2d1c59df6c63f76511aa68867832
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 992122145777924ad5b3a52da65188d8a91b8246)

5 years agoClarify DOMEvent and DOMNotification relationship 23/81323/1
Robert Varga [Wed, 27 Mar 2019 12:53:50 +0000 (13:53 +0100)]
Clarify DOMEvent and DOMNotification relationship

The relationship between these interfaces is realized in the
implementation, but it is not captured in the interface contract
documentation.

JIRA: MDSAL-282
Change-Id: I99d8787a16263c6628440dac8b3bd7a6bbec3f9c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit ae3fde5afcd6811321b8f9cbbf2f6da1661b5610)

5 years agoRemove use of deprecated createCursor() method 98/81198/2
Robert Varga [Tue, 26 Mar 2019 15:21:57 +0000 (16:21 +0100)]
Remove use of deprecated createCursor() method

This method has been superseded by openCursor(), use that.

Change-Id: Ie64c91106c1b1cfddbd0d68456e5081f6ef72341
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix logging arguments 99/81199/1
Robert Varga [Fri, 22 Mar 2019 18:27:10 +0000 (19:27 +0100)]
Fix logging arguments

This is caught by upgraded spotbugs, we are missing returnType
argument.

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

5 years agoTolerate unresolvable leafrefs in groupings 73/81073/1
Vratko Polak [Fri, 1 Jul 2016 11:21:15 +0000 (13:21 +0200)]
Tolerate unresolvable leafrefs in groupings

In case a grouping contains a relative leafref pointing outside of
the grouping subtree we cannot safely determine the target type, which
lead to an IllegalArgumentException.

In this case we need to resolve the return type to an Object, which
loses type safety, but really is the best we can do as we just do not
know in what contexts that grouping is used.

Unfortunately this requires API changes to mdsal-binding-generator-api
as we need to communicate the fact we are resolving a type definition
in the context of a grouping to TypeProvider implementations.

JIRA: MDSAL-182
Change-Id: Iaf96d133c08eb47f4bb27b6c4f3db1463b78f05e
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1e1d8a29875fe39cc41cc430d6d96ccebd5eb5f0)

5 years agoSpeed up ClassTemplate getDefaultInstance() generation 72/81072/1
Robert Varga [Tue, 19 Mar 2019 11:30:08 +0000 (12:30 +0100)]
Speed up ClassTemplate getDefaultInstance() generation

We can skip instantiating FQCN and just compare against constants,
which results in faster dispatch.

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

5 years agoSpeed up Union stringValue() generation 71/81071/1
Robert Varga [Tue, 19 Mar 2019 11:31:14 +0000 (12:31 +0100)]
Speed up Union stringValue() generation

We can compare against well-known Types, which is faster than
going through FQCN.

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

5 years agoSimplify UnionTemplate stringValue() dispatch 70/81070/1
Robert Varga [Tue, 19 Mar 2019 11:19:41 +0000 (12:19 +0100)]
Simplify UnionTemplate stringValue() dispatch

We have a complicated if in two cases, simplify it and take
advantage of Types.BYTE_ARRAY.

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

5 years agoCleanup RuntimeException throws 69/81069/1
Robert Varga [Tue, 19 Mar 2019 17:04:49 +0000 (18:04 +0100)]
Cleanup RuntimeException throws

We are just wrapping exceptions in these cases, switch to wrapping
with IllegalStateException to keep sonar happy.

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

5 years agoUse E$$ to capture augmentation type 02/81002/2
Robert Varga [Mon, 18 Mar 2019 13:55:43 +0000 (14:55 +0100)]
Use E$$ to capture augmentation type

'E' is a valid generated identifier, which can lead to conflicts
when generating augmentable implementations.

Change-Id: I9d69d06e18301eff788c101e389a6d0b5365ad38
JIRA: MDSAL-425
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8dbc1c0794dbd6be19ae0e724b4cc21714c6739f)

5 years agoFix check path contention when create tree producers 54/80954/2
han [Fri, 12 Oct 2018 03:16:19 +0000 (11:16 +0800)]
Fix check path contention when create tree producers

- It's not allowed to create producers with their subtrees conflicts.
  Add a map to store producers aim to do this check more simply than
  to travel 'DOMDataTreePrefixTable'.
  It's assumed there're less producers in th map that we could accept
  to do 'for' operation.

  JIRA: MDSAL-397
Change-Id: I105291402f21b530f54873307316f0f0c5640f6b
Signed-off-by: Jie Han <han.jie@zte.com.cn>
(cherry picked from commit cb18b6de35bc819764b431a4e922d8cbce634014)

5 years agoUpdate .gitreview 15/80915/2
Robert Varga [Sat, 16 Mar 2019 00:07:17 +0000 (01:07 +0100)]
Update .gitreview

This updates .gitreview for 3.0.x branch

Change-Id: Id5ba4d5b29a34980d824954ce78b52ce9ae25509
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoImplement EthertypeBuilder 30/80930/3
Robert Varga [Sat, 16 Mar 2019 11:03:00 +0000 (12:03 +0100)]
Implement EthertypeBuilder

This implements EthertypeBuilder in an efficient way, using
pre-built known ethertypes.

It also defines {compare,equal,hash}Value, methods which perform
semantic operations, treating number-based and enumeration-based
Ethertypes equally.

Change-Id: I394f65a17fa84c06a63bc598c947d274d6dd6413
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd RFC8519 models 10/80910/4
Robert Varga [Wed, 13 Mar 2019 12:29:06 +0000 (13:29 +0100)]
Add RFC8519 models

This adds RFC8519 ietf-access-control-list and ietf-packet-fields
models, which are replacing previous instantiation of these models.

Change-Id: I984db5e2fc13c4a4e0b12b3afe4141cf73c1d6d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove use of deprecated constructors 09/80909/2
Robert Varga [Fri, 15 Mar 2019 19:07:06 +0000 (20:07 +0100)]
Remove use of deprecated constructors

Java 11 deprecates most of these constructurs, so let's get rid
of them.

Change-Id: I67c03370c4e8440608e0cece182d87c7ea923258
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix logging placeholders 06/80906/3
Robert Varga [Fri, 15 Mar 2019 18:34:00 +0000 (19:34 +0100)]
Fix logging placeholders

Upgraded SpotBugs is finding these, fix them up.

Change-Id: I6209c661ccdf17d886d8c776d96fe6b6a32abc1b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix odl-mdsal-model-rfc8349 definition 24/80824/1
Robert Varga [Wed, 13 Mar 2019 12:40:22 +0000 (13:40 +0100)]
Fix odl-mdsal-model-rfc8349 definition

This feature should be polling in rfc8344, rfc8343 and rfc6991.
Due to transitive dependencies, it is enough to pull rfc8344.

Change-Id: I1098dba897dc4be27d062925799c5be3e4432117
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>