summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2022-03-01 11:10:58 -0500
committerDan Timoney <dtimoney@att.com>2022-03-22 18:04:32 +0000
commit7c0ec3e4540c1a10a03efcfbae06c4a7915977a6 (patch)
treeca6c6fd9616f24efb786ee8620ad499cb258a4d9 /core
parentb64e61b3631a022f6f166e6fc15026537ff46c63 (diff)
Migrate SLI to OpenDaylight Phosphorus
Updated ccsdk/sli to use Phosphorus SR1 version of parent poms and updated Java Reflection code to handle changes in Phosphorus: - use Uint8/Uint16/Uint32/Uint64 classes in place of char/Short/Long/BigInteger, respectively - add code for toMap method to handle change in representation of yang list from java List to java Map - Add new YangUtils class to replace removed ODL yangtools SchemaUtils class - Update restconf-client due to changes in yangtools Issue-ID: CCSDK-3567 Signed-off-by: Dan Timoney <dtimoney@att.com> Change-Id: Iea581c7f39b1038ce95cc0ca6728fe56dd023f3e
Diffstat (limited to 'core')
-rwxr-xr-xcore/artifacts/pom.xml2
-rwxr-xr-xcore/dblib/installer/pom.xml2
-rwxr-xr-xcore/dblib/pom.xml2
-rwxr-xr-xcore/dblib/provider/pom.xml2
-rw-r--r--core/features/ccsdk-dblib/pom.xml2
-rw-r--r--core/features/ccsdk-filters/pom.xml2
-rw-r--r--core/features/ccsdk-sli-core-all/pom.xml2
-rw-r--r--core/features/ccsdk-sli/pom.xml2
-rw-r--r--core/features/ccsdk-sliPluginUtils/pom.xml2
-rw-r--r--core/features/ccsdk-sliapi/pom.xml2
-rw-r--r--core/features/ccsdk-slicore-utils/pom.xml2
-rw-r--r--core/features/features-sli-core/pom.xml2
-rwxr-xr-xcore/features/installer/pom.xml2
-rwxr-xr-xcore/features/pom.xml2
-rwxr-xr-xcore/filters/installer/pom.xml2
-rw-r--r--core/filters/pom.xml2
-rwxr-xr-xcore/filters/provider/pom.xml2
-rwxr-xr-xcore/pom.xml2
-rwxr-xr-xcore/sli/common/pom.xml2
-rwxr-xr-xcore/sli/installer/pom.xml2
-rwxr-xr-xcore/sli/model/pom.xml2
-rwxr-xr-xcore/sli/model/src/main/yang/test-model@2019-07-23.yang190
-rwxr-xr-xcore/sli/pom.xml2
-rw-r--r--core/sli/provider-base/pom.xml2
-rwxr-xr-xcore/sli/provider/pom.xml2
-rwxr-xr-xcore/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java348
-rw-r--r--core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/YangUtils.java410
-rwxr-xr-xcore/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java80
-rw-r--r--core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToPropTest.java26
-rwxr-xr-xcore/sliPluginUtils/installer/pom.xml2
-rwxr-xr-xcore/sliPluginUtils/pom.xml2
-rwxr-xr-xcore/sliPluginUtils/provider/pom.xml2
-rwxr-xr-xcore/sliapi/installer/pom.xml2
-rwxr-xr-xcore/sliapi/model/pom.xml2
-rw-r--r--core/sliapi/model/swagger/pom.xml2
-rwxr-xr-xcore/sliapi/model/yang/pom.xml2
-rwxr-xr-xcore/sliapi/pom.xml2
-rwxr-xr-xcore/sliapi/provider/pom.xml2
-rw-r--r--core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java2
-rw-r--r--core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java33
-rwxr-xr-xcore/utils/installer/pom.xml2
-rwxr-xr-xcore/utils/pom.xml2
-rw-r--r--core/utils/provider/pom.xml2
43 files changed, 930 insertions, 231 deletions
diff --git a/core/artifacts/pom.xml b/core/artifacts/pom.xml
index a756c0ce6..af4bfe769 100755
--- a/core/artifacts/pom.xml
+++ b/core/artifacts/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/dblib/installer/pom.xml b/core/dblib/installer/pom.xml
index 1bea19fb4..4e6283125 100755
--- a/core/dblib/installer/pom.xml
+++ b/core/dblib/installer/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/dblib/pom.xml b/core/dblib/pom.xml
index 1197c6355..1ec425601 100755
--- a/core/dblib/pom.xml
+++ b/core/dblib/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/dblib/provider/pom.xml b/core/dblib/provider/pom.xml
index 00e0cc7dd..a67d49df9 100755
--- a/core/dblib/provider/pom.xml
+++ b/core/dblib/provider/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/features/ccsdk-dblib/pom.xml b/core/features/ccsdk-dblib/pom.xml
index c7a872a96..519288d0d 100644
--- a/core/features/ccsdk-dblib/pom.xml
+++ b/core/features/ccsdk-dblib/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/features/ccsdk-filters/pom.xml b/core/features/ccsdk-filters/pom.xml
index 51492a052..e71580557 100644
--- a/core/features/ccsdk-filters/pom.xml
+++ b/core/features/ccsdk-filters/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/features/ccsdk-sli-core-all/pom.xml b/core/features/ccsdk-sli-core-all/pom.xml
index 474783562..d4d946a4f 100644
--- a/core/features/ccsdk-sli-core-all/pom.xml
+++ b/core/features/ccsdk-sli-core-all/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/features/ccsdk-sli/pom.xml b/core/features/ccsdk-sli/pom.xml
index c2bc88cc2..7fdf43ec7 100644
--- a/core/features/ccsdk-sli/pom.xml
+++ b/core/features/ccsdk-sli/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/features/ccsdk-sliPluginUtils/pom.xml b/core/features/ccsdk-sliPluginUtils/pom.xml
index 46a6564ba..148296466 100644
--- a/core/features/ccsdk-sliPluginUtils/pom.xml
+++ b/core/features/ccsdk-sliPluginUtils/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/features/ccsdk-sliapi/pom.xml b/core/features/ccsdk-sliapi/pom.xml
index 4184797bf..eb7e3e914 100644
--- a/core/features/ccsdk-sliapi/pom.xml
+++ b/core/features/ccsdk-sliapi/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/features/ccsdk-slicore-utils/pom.xml b/core/features/ccsdk-slicore-utils/pom.xml
index a760460fd..4f07a6240 100644
--- a/core/features/ccsdk-slicore-utils/pom.xml
+++ b/core/features/ccsdk-slicore-utils/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/features/features-sli-core/pom.xml b/core/features/features-sli-core/pom.xml
index b563e846c..f51b99f25 100644
--- a/core/features/features-sli-core/pom.xml
+++ b/core/features/features-sli-core/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>feature-repo-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/features/installer/pom.xml b/core/features/installer/pom.xml
index cb06f365e..2fccfa027 100755
--- a/core/features/installer/pom.xml
+++ b/core/features/installer/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/features/pom.xml b/core/features/pom.xml
index f69502858..0943cda02 100755
--- a/core/features/pom.xml
+++ b/core/features/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/filters/installer/pom.xml b/core/filters/installer/pom.xml
index fb9a27b83..c6359f6d8 100755
--- a/core/filters/installer/pom.xml
+++ b/core/filters/installer/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/filters/pom.xml b/core/filters/pom.xml
index 76898e9bb..a58a1dede 100644
--- a/core/filters/pom.xml
+++ b/core/filters/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/filters/provider/pom.xml b/core/filters/provider/pom.xml
index 9163d544f..0e899ad5b 100755
--- a/core/filters/provider/pom.xml
+++ b/core/filters/provider/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/pom.xml b/core/pom.xml
index 67a3dc96f..4714363f1 100755
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/sli/common/pom.xml b/core/sli/common/pom.xml
index 2a4874e25..1a6b5a76e 100755
--- a/core/sli/common/pom.xml
+++ b/core/sli/common/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/sli/installer/pom.xml b/core/sli/installer/pom.xml
index dd4c04325..8d0e5932f 100755
--- a/core/sli/installer/pom.xml
+++ b/core/sli/installer/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/sli/model/pom.xml b/core/sli/model/pom.xml
index 350b63aff..1e39e6b1b 100755
--- a/core/sli/model/pom.xml
+++ b/core/sli/model/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/sli/model/src/main/yang/test-model@2019-07-23.yang b/core/sli/model/src/main/yang/test-model@2019-07-23.yang
index fc8e8b007..87419f838 100755
--- a/core/sli/model/src/main/yang/test-model@2019-07-23.yang
+++ b/core/sli/model/src/main/yang/test-model@2019-07-23.yang
@@ -18,43 +18,43 @@ module test-model {
revision "2019-07-23" {
description
- "First release of the test model";
+ "First release of the test model";
}
identity sample-identity {
- description
- "Base identity";
+ description
+ "Base identity";
}
- typedef percentage {
- type uint8 {
- range "0 .. 100";
- }
- description "represents a percentage";
- }
+ typedef percentage {
+ type uint8 {
+ range "0 .. 100";
+ }
+ description "represents a percentage";
+ }
grouping builtin {
leaf sample-binary {
type binary;
}
leaf sample-bits {
- type bits{
- bit fan-running {
- position 0;
- }
- bit hd-led {
- position 1;
- }
- bit power-led {
- position 2;
- }
+ type bits {
+ bit fan-running {
+ position 0;
+ }
+ bit hd-led {
+ position 1;
+ }
+ bit power-led {
+ position 2;
+ }
}
}
leaf sample-boolean {
type boolean;
}
leaf sample-decimal64 {
- type decimal64{
+ type decimal64 {
fraction-digits 1;
}
}
@@ -62,7 +62,7 @@ module test-model {
type empty;
}
leaf sample-enumeration {
- type enumeration{
+ type enumeration {
enum "shelf.slot.port";
enum "not available";
enum "CURRENTLY_AVAILABLE";
@@ -71,9 +71,9 @@ module test-model {
}
}
leaf sample-identityref {
- type identityref {
- base "sample-identity";
- }
+ type identityref {
+ base "sample-identity";
+ }
}
leaf sample-int8 {
type int8;
@@ -88,9 +88,9 @@ module test-model {
type int64;
}
leaf sample-leafref {
- type leafref {
- path "../sample-boolean";
- }
+ type leafref {
+ path "../sample-boolean";
+ }
}
leaf sample-string {
type string;
@@ -108,103 +108,121 @@ module test-model {
type uint64;
}
leaf sample-union {
- type union {
- type int32;
- type enumeration {
- enum "unbounded";
- }
- }
- }
- leaf percent-completed {
- type percentage;
- }
+ type union {
+ type int32;
+ type enumeration {
+ enum "unbounded";
+ }
+ }
+ }
+ leaf percent-completed {
+ type percentage;
+ }
}
grouping inet-types-grouping {
leaf ip-version {
- type inet:ip-version;
+ type inet:ip-version;
}
leaf dscp {
- type inet:dscp;
+ type inet:dscp;
}
leaf port-number {
- type inet:port-number;
+ type inet:port-number;
}
leaf ipv6-flow-label {
- type inet:ipv6-flow-label;
+ type inet:ipv6-flow-label;
}
leaf as-number {
- type inet:as-number;
+ type inet:as-number;
}
leaf ip-address {
- type inet:ip-address;
+ type inet:ip-address;
}
leaf ipv4-address {
- type inet:ipv4-address;
+ type inet:ipv4-address;
}
leaf ipv6-address {
- type inet:ipv6-address;
+ type inet:ipv6-address;
}
leaf ip-address-no-zone {
- type inet:ip-address-no-zone;
+ type inet:ip-address-no-zone;
}
leaf ipv4-address-no-zone {
- type inet:ipv4-address-no-zone;
+ type inet:ipv4-address-no-zone;
}
leaf ipv6-address-no-zone {
- type inet:ipv6-address-no-zone;
+ type inet:ipv6-address-no-zone;
}
leaf ip-prefix {
- type inet:ip-prefix;
+ type inet:ip-prefix;
}
leaf ipv4-prefix {
- type inet:ipv4-prefix;
+ type inet:ipv4-prefix;
}
leaf ipv6-prefix {
- type inet:ipv6-prefix;
+ type inet:ipv6-prefix;
}
leaf domain-name {
- type inet:domain-name;
+ type inet:domain-name;
}
leaf host {
- type inet:host;
+ type inet:host;
}
leaf uri {
- type inet:uri;
+ type inet:uri;
}
- anyxml data;
+ anyxml data;
}
container sample-container {
- leaf customer-name {
- type string;
- }
-
- leaf-list customer-nicknames {
- type string;
- }
-
- container login {
- leaf message {
- type string;
- description
- "Message given at start of login session";
- }
-
- list customer-addresses {
- key "address-name";
- leaf address-name {
- type string;
- }
- leaf street-address {
- type string;
- }
- leaf state {
- type string;
- }
- }
- }
- uses builtin;
- uses inet-types-grouping;
- }
+ leaf customer-name {
+ type string;
+ }
+
+ leaf-list customer-nicknames {
+ type string;
+ }
+
+ container login {
+ leaf message {
+ type string;
+ description
+ "Message given at start of login session";
+ }
+
+ list customer-addresses {
+ key "address-name";
+ leaf address-name {
+ type string;
+ }
+ leaf street-address {
+ type string;
+ }
+ leaf state {
+ type string;
+ }
+ }
+ }
+ list ip-address-list {
+ key "ip-addr";
+ leaf ip-addr {
+ type inet:ip-address;
+ }
+ }
+ leaf-list ip-address-leaf-list {
+ type inet:ip-address;
+ }
+ list ip-address-names {
+ key "ip-addr";
+ leaf ip-addr {
+ type inet:ip-address;
+ }
+ leaf fqdn {
+ type string;
+ }
+ }
+ uses builtin;
+ uses inet-types-grouping;
+ }
}
diff --git a/core/sli/pom.xml b/core/sli/pom.xml
index ca79c3ae7..e0f9caa74 100755
--- a/core/sli/pom.xml
+++ b/core/sli/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/sli/provider-base/pom.xml b/core/sli/provider-base/pom.xml
index 5d4142839..ccd0c71b9 100644
--- a/core/sli/provider-base/pom.xml
+++ b/core/sli/provider-base/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/sli/provider/pom.xml b/core/sli/provider/pom.xml
index e4dd45692..6b67441be 100755
--- a/core/sli/provider/pom.xml
+++ b/core/sli/provider/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java b/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
index d13122f91..37a6a5b24 100755
--- a/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
+++ b/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
@@ -32,20 +32,9 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
+import java.util.*;
+
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.*;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.RouteDistinguisher;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.RouteDistinguisherBuilder;
import org.opendaylight.yangtools.yang.binding.Identifier;
@@ -176,8 +165,16 @@ public class MdsalHelper {
toProperties(props, pfx + "[" + i + "]", fromList.get(i), fromClass, useLegacyEnumerationMapping);
}
setProperty(props, pfx + "_length", Integer.toString(fromList.size()));
- } else if (fromClass.isEnum())
- {
+ } else if (fromObj instanceof Map) {
+ Map fromMap = (Map) fromObj;
+ Iterator<Object> mapIter = fromMap.values().iterator();
+ int idx = 0;
+ while (mapIter.hasNext()) {
+ toProperties(props, pfx + "[" + idx + "]", mapIter.next(), fromClass, useLegacyEnumerationMapping);
+ idx++;
+ }
+ setProperty(props, pfx + "_length", Integer.toString(idx));
+ } else if (fromClass.isEnum()) {
try {
if (useLegacyEnumerationMapping) {
Method m = fromClass.getMethod(getStringValueMethod(simpleTypeName), null);
@@ -581,6 +578,86 @@ public class MdsalHelper {
}
+ public static Map toMap(Properties props, String pfx, Map toObj, Class elemType) {
+
+ int maxIdx = -1;
+ boolean foundValue = false;
+
+ if (props.containsKey(pfx + "_length")) {
+ try {
+ int listLength = Integer.parseInt(props.getProperty(pfx + "_length"));
+
+ if (listLength > 0) {
+ maxIdx = listLength - 1;
+ }
+ } catch (NumberFormatException e) {
+ LOG.info("Invalid input for length ", e);
+ }
+ }
+
+ String arrayKey = pfx + "[";
+ int arrayKeyLength = arrayKey.length();
+ if (maxIdx == -1) {
+ // Figure out array size
+ for (Object pNameObj : props.keySet()) {
+ String key = (String) pNameObj;
+
+ if (key.startsWith(arrayKey)) {
+ String idxStr = key.substring(arrayKeyLength);
+ int endloc = idxStr.indexOf("]");
+ if (endloc != -1) {
+ idxStr = idxStr.substring(0, endloc);
+ }
+ try {
+ int curIdx = Integer.parseInt(idxStr);
+ if (curIdx > maxIdx) {
+ maxIdx = curIdx;
+ }
+ } catch (Exception e) {
+ LOG.error("Illegal subscript in property {}", key, e);
+ }
+
+ }
+ }
+ }
+
+ for (int i = 0; i <= maxIdx; i++) {
+
+ String curBase = pfx + "[" + i + "]";
+
+ // Maps are used to represent yang lists.
+ // Each entry in the Map is an yang-generated object,
+ // to be constructed by a builder.
+ String builderName = elemType.getName() + "Builder";
+ try {
+ Class elemClass = Class.forName(elemType.getName());
+ Class builderClass = Class.forName(builderName);
+ Object builderObj = builderClass.newInstance();
+ Method buildMethod = builderClass.getMethod("build");
+ builderObj = toBuilder(props, curBase, builderObj, true);
+ if (builderObj != null) {
+ Object builtObj = buildMethod.invoke(builderObj);
+ Method keyMethod = builtObj.getClass().getMethod("key");
+ keyMethod.setAccessible(true);
+ Object builtObjKey = keyMethod.invoke(builtObj);
+ toObj.put(builtObjKey, builtObj);
+ foundValue = true;
+ }
+
+ } catch (ClassNotFoundException e) {
+ LOG.warn("Could not find builder class {}", builderName, e);
+ } catch (Exception e) {
+ LOG.error("Caught exception trying to populate list from {}", pfx, e);
+ }
+ }
+
+ if (foundValue) {
+ return (toObj);
+ } else {
+ return (null);
+ }
+ }
+
public static Object toBuilder(Properties props, String pfx, Object toObj) {
return (toBuilder(props, pfx, toObj, false));
}
@@ -679,6 +756,7 @@ public class MdsalHelper {
String simpleName = paramClass.getSimpleName();
+
if (IPV4_ADDRESS.equals(simpleName) || IPV6_ADDRESS.equals(simpleName)
|| IP_ADDRESS.equals(simpleName)) {
@@ -762,9 +840,21 @@ public class MdsalHelper {
LOG.error("Caught exception calling " + toClass.getName() + "." + m.getName()
+ "(" + paramValue + ")", e);
}
+
+ }
+ } else if ("Host".equals(simpleName)) {
+ if ((paramValue != null) && (paramValue.length() > 0)) {
+ try {
+ Host host = HostBuilder.getDefaultInstance(paramValue);
+ m.invoke(toObj, host);
+ foundValue = true;
+ } catch (Exception e) {
+ LOG.error("Caught exception calling " + toClass.getName() + "." + m.getName()
+ + "(" + paramValue + ")", e);
+ }
+
}
- }
- else {
+ } else {
// setter expects a yang-generated class. Need
// to
// create a builder to set it.
@@ -828,6 +918,56 @@ public class MdsalHelper {
}
}
+ if (constObj == null) {
+ // Is there a Uint64 constructor?
+ for (Constructor c : constructors) {
+ Class[] cParms = c.getParameterTypes();
+ if ((cParms != null) && (cParms.length == 1)) {
+ if (Uint64.class.isAssignableFrom(cParms[0])) {
+ constObj = c.newInstance(Uint64.valueOf(paramValue));
+ }
+ }
+ }
+
+ }
+
+ if (constObj == null) {
+ // Is there a Uint32 constructor?
+ for (Constructor c : constructors) {
+ Class[] cParms = c.getParameterTypes();
+ if ((cParms != null) && (cParms.length == 1)) {
+ if (Uint32.class.isAssignableFrom(cParms[0])) {
+ constObj = c.newInstance(Uint32.valueOf(paramValue));
+ }
+ }
+ }
+
+ }
+ if (constObj == null) {
+ // Is there a Uint16 constructor?
+ for (Constructor c : constructors) {
+ Class[] cParms = c.getParameterTypes();
+ if ((cParms != null) && (cParms.length == 1)) {
+ if (Uint16.class.isAssignableFrom(cParms[0])) {
+ constObj = c.newInstance(Uint16.valueOf(paramValue));
+ }
+ }
+ }
+
+ }
+
+ if (constObj == null) {
+ // Is there a Uint8 constructor?
+ for (Constructor c : constructors) {
+ Class[] cParms = c.getParameterTypes();
+ if ((cParms != null) && (cParms.length == 1)) {
+ if (Uint8.class.isAssignableFrom(cParms[0])) {
+ constObj = c.newInstance(Uint8.valueOf(paramValue));
+ }
+ }
+ }
+
+ }
if (constObj == null) {
@@ -919,9 +1059,36 @@ public class MdsalHelper {
} else {
// Setter's argument is not a yang-generated class. See
- // if it is a List.
+ // if it is a Map or a List
+ if (Map.class.isAssignableFrom(paramClass)) {
+ Type paramType = m.getGenericParameterTypes()[0];
+ Type elementType = ((ParameterizedType) paramType).getActualTypeArguments()[1];
+ Object paramObj = new LinkedHashMap();
+ try {
+ paramObj = toMap(props, propName, (Map) paramObj, (Class)elementType);
+ } catch (Exception e) {
+ LOG.error("Caught exception trying to create map expected as argument to {}.{}",
+ toClass.getName(), m.getName(), e);
+ }
+ if (paramObj != null) {
+ try {
+ boolean isAccessible = m.isAccessible();
+ if (!isAccessible) {
+ m.setAccessible(true);
+ }
+ m.invoke(toObj, paramObj);
+ if (!isAccessible) {
+ m.setAccessible(isAccessible);
+ }
+ foundValue = true;
- if (List.class.isAssignableFrom(paramClass)) {
+ } catch (Exception e) {
+ LOG.error("Caught exception trying to convert List returned by" + toClass.getName()
+ + "." + m.getName() + "() to Properties entry", e);
+ }
+ }
+ }
+ else if (List.class.isAssignableFrom(paramClass)) {
// Figure out what type of args are in List and pass
// that to toList().
@@ -960,59 +1127,124 @@ public class MdsalHelper {
Object constObj = null;
- try {
- // See if I can find a constructor I can use
- Constructor[] constructors = paramClass.getConstructors();
- // Is there a String constructor?
- for (Constructor c : constructors) {
- Class[] cParms = c.getParameterTypes();
- if ((cParms != null) && (cParms.length == 1)) {
- if (String.class.isAssignableFrom(cParms[0])) {
- constObj = c.newInstance(paramValue);
- }
- }
- }
+ // Handle Uint classes as special case
+ if (Uint64.class.isAssignableFrom(paramClass)) {
+ constObj = Uint64.valueOf(paramValue);
+ } else if (Uint32.class.isAssignableFrom(paramClass)) {
+ constObj = Uint32.valueOf(paramValue);
+ } else if (Uint16.class.isAssignableFrom(paramClass)) {
+ constObj = Uint16.valueOf(paramValue);
+ } else if (Uint8.class.isAssignableFrom(paramClass)) {
+ constObj = Uint8.valueOf(paramValue);
+ }
- if (constObj == null) {
- // Is there a Long constructor?
+ if (constObj != null) {
+ try {
+ m.invoke(toObj, constObj);
+ foundValue = true;
+ } catch (Exception e2) {
+ LOG.error("Caught exception trying to call " + m.getName(), e2);
+ }
+ } else {
+ try {
+ // See if I can find a constructor I can use
+ Constructor[] constructors = paramClass.getConstructors();
+ // Is there a String constructor?
for (Constructor c : constructors) {
Class[] cParms = c.getParameterTypes();
if ((cParms != null) && (cParms.length == 1)) {
- if (Long.class.isAssignableFrom(cParms[0])) {
- constObj = c.newInstance(Long.parseLong(paramValue));
+ if (String.class.isAssignableFrom(cParms[0])) {
+ constObj = c.newInstance(paramValue);
}
}
}
- }
+ if (constObj == null) {
+ // Is there a Long constructor?
+ for (Constructor c : constructors) {
+ Class[] cParms = c.getParameterTypes();
+ if ((cParms != null) && (cParms.length == 1)) {
+ if (Long.class.isAssignableFrom(cParms[0])) {
+ constObj = c.newInstance(Long.parseLong(paramValue));
+ }
+ }
+ }
+ }
- if (constObj != null) {
- try {
- m.invoke(toObj, constObj);
- foundValue = true;
- } catch (Exception e2) {
- LOG.error("Caught exception trying to call " + m.getName(), e2);
+ if (constObj == null) {
+ // Is there a Uint64 constructor?
+ for (Constructor c : constructors) {
+ Class[] cParms = c.getParameterTypes();
+ if ((cParms != null) && (cParms.length == 1)) {
+ if (Uint64.class.isAssignableFrom(cParms[0])) {
+ constObj = c.newInstance(Uint64.valueOf(paramValue));
+ }
+ }
+ }
}
- } else {
- try {
- boolean isAccessible = m.isAccessible();
- if (!isAccessible) {
- m.setAccessible(true);
+ if (constObj == null) {
+ // Is there a Uint32 constructor?
+ for (Constructor c : constructors) {
+ Class[] cParms = c.getParameterTypes();
+ if ((cParms != null) && (cParms.length == 1)) {
+ if (Uint32.class.isAssignableFrom(cParms[0])) {
+ constObj = c.newInstance(Uint32.valueOf(paramValue));
+ }
+ }
}
- m.invoke(toObj, paramValue);
- if (!isAccessible) {
- m.setAccessible(isAccessible);
+ }
+ if (constObj == null) {
+ // Is there a Uint16 constructor?
+ for (Constructor c : constructors) {
+ Class[] cParms = c.getParameterTypes();
+ if ((cParms != null) && (cParms.length == 1)) {
+ if (Uint16.class.isAssignableFrom(cParms[0])) {
+ constObj = c.newInstance(Uint16.valueOf(paramValue));
+ }
+ }
}
- foundValue = true;
+ }
+ if (constObj == null) {
+ // Is there a Uint8 constructor?
+ for (Constructor c : constructors) {
+ Class[] cParms = c.getParameterTypes();
+ if ((cParms != null) && (cParms.length == 1)) {
+ if (Uint8.class.isAssignableFrom(cParms[0])) {
+ constObj = c.newInstance(Uint8.valueOf(paramValue));
+ }
+ }
+ }
+ }
+
+
+ if (constObj != null) {
+ try {
+ m.invoke(toObj, constObj);
+ foundValue = true;
+ } catch (Exception e2) {
+ LOG.error("Caught exception trying to call " + m.getName(), e2);
+ }
+ } else {
+ try {
+ boolean isAccessible = m.isAccessible();
+ if (!isAccessible) {
+ m.setAccessible(true);
+ }
+ m.invoke(toObj, paramValue);
+ if (!isAccessible) {
+ m.setAccessible(isAccessible);
+ }
+ foundValue = true;
- } catch (Exception e) {
- LOG.error("Caught exception trying to convert value returned by"
- + toClass.getName() + "." + m.getName() + "() to Properties entry",
- e);
+ } catch (Exception e) {
+ LOG.error("Caught exception trying to convert value returned by"
+ + toClass.getName() + "." + m.getName() + "() to Properties entry",
+ e);
+ }
}
+ } catch (Exception e1) {
+ LOG.warn("Could not find a suitable constructor for " + paramClass.getName(), e1);
}
- } catch (Exception e1) {
- LOG.warn("Could not find a suitable constructor for " + paramClass.getName(), e1);
}
}
diff --git a/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/YangUtils.java b/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/YangUtils.java
new file mode 100644
index 000000000..573444bf2
--- /dev/null
+++ b/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/YangUtils.java
@@ -0,0 +1,410 @@
+package org.onap.ccsdk.sli.core.sli.provider;
+
+import static com.google.common.base.Preconditions.checkState;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.Revision;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.model.api.ActionNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.AugmentationTarget;
+import org.opendaylight.yangtools.yang.model.api.CaseSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.NotificationNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.OperationDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaNode;
+
+public final class YangUtils {
+
+ private YangUtils() {
+ }
+ /**
+ * Find the first schema with specified QName.
+ *
+ * @param qname schema node to find
+ * @param dataSchemaNode Iterable of schemaNodes to look through
+ * @return schema node with newest revision or absent if no schema node with matching qname is found
+ */
+ public static Optional<DataSchemaNode> findFirstSchema(final QName qname,
+ final Iterable<? extends DataSchemaNode> dataSchemaNode) {
+ DataSchemaNode schema = null;
+ if (dataSchemaNode != null && qname != null) {
+ for (final DataSchemaNode dsn : dataSchemaNode) {
+ if (qname.isEqualWithoutRevision(dsn.getQName())) {
+ if (schema == null || Revision.compare(schema.getQName().getRevision(),
+ dsn.getQName().getRevision()) < 0) {
+ schema = dsn;
+ }
+ } else if (dsn instanceof ChoiceSchemaNode) {
+ for (final CaseSchemaNode choiceCase : ((ChoiceSchemaNode) dsn).getCases()) {
+ final Optional<DataSchemaNode> dataChildByName = choiceCase.findDataChildByName(qname);
+ if (dataChildByName.isPresent()) {
+ return dataChildByName;
+ }
+ final Optional<DataSchemaNode> foundDsn = findFirstSchema(qname, choiceCase.getChildNodes());
+ if (foundDsn.isPresent()) {
+ return foundDsn;
+ }
+ }
+ }
+ }
+ }
+ return Optional.ofNullable(schema);
+ }
+ /**
+ * Find child schema node identified by its QName within a provided schema node.
+ *
+ * @param schema schema for parent node - search root
+ * @param qname qname(with or without a revision) of a child node to be found in the parent schema
+ * @return found schema node
+ * @throws java.lang.IllegalStateException if the child was not found in parent schema node
+ */
+ public static DataSchemaNode findSchemaForChild(final DataNodeContainer schema, final QName qname) {
+ // Try to find child schema node directly, but use a fallback that compares QNames without revisions
+ // and auto-expands choices
+ final Optional<DataSchemaNode> dataChildByName = schema.findDataChildByName(qname);
+ return dataChildByName.isPresent() ? dataChildByName.get()
+ : findSchemaForChild(schema, qname, schema.getChildNodes());
+ }
+ public static @Nullable DataSchemaNode findSchemaForChild(final DataNodeContainer schema, final QName qname,
+ final boolean strictMode) {
+ if (strictMode) {
+ return findSchemaForChild(schema, qname);
+ }
+ final Optional<DataSchemaNode> childSchemaOptional = findFirstSchema(qname, schema.getChildNodes());
+ if (!childSchemaOptional.isPresent()) {
+ return null;
+ }
+ return childSchemaOptional.get();
+ }
+ public static DataSchemaNode findSchemaForChild(final DataNodeContainer schema, final QName qname,
+ final Iterable<? extends DataSchemaNode> childNodes) {
+ final Optional<DataSchemaNode> childSchema = findFirstSchema(qname, childNodes);
+ checkState(childSchema.isPresent(), "Unknown child(ren) node(s) detected, identified by: %s, in: %s", qname,
+ schema);
+ return childSchema.get();
+ }
+ public static DataSchemaNode findSchemaForChild(final ChoiceSchemaNode schema, final QName childPartialQName) {
+ for (final CaseSchemaNode choiceCaseNode : schema.getCases()) {
+ final Optional<DataSchemaNode> childSchema = findFirstSchema(childPartialQName,
+ choiceCaseNode.getChildNodes());
+ if (childSchema.isPresent()) {
+ return childSchema.get();
+ }
+ }
+ throw new IllegalStateException(String.format("Unknown child(ren) node(s) detected, identified by: %s, in: %s",
+ childPartialQName, schema));
+ }
+ public static AugmentationSchemaNode findSchemaForAugment(final AugmentationTarget schema,
+ final Set<QName> qnames) {
+ final Optional<AugmentationSchemaNode> schemaForAugment = findAugment(schema, qnames);
+ checkState(schemaForAugment.isPresent(), "Unknown augmentation node detected, identified by: %s, in: %s",
+ qnames, schema);
+ return schemaForAugment.get();
+ }
+ public static AugmentationSchemaNode findSchemaForAugment(final ChoiceSchemaNode schema, final Set<QName> qnames) {
+ for (final CaseSchemaNode choiceCaseNode : schema.getCases()) {
+ final Optional<AugmentationSchemaNode> schemaForAugment = findAugment(choiceCaseNode, qnames);
+ if (schemaForAugment.isPresent()) {
+ return schemaForAugment.get();
+ }
+ }
+ throw new IllegalStateException(String.format("Unknown augmentation node detected, identified by: %s, in: %s",
+ qnames, schema));
+ }
+ private static Optional<AugmentationSchemaNode> findAugment(final AugmentationTarget schema,
+ final Set<QName> qnames) {
+ for (final AugmentationSchemaNode augment : schema.getAvailableAugmentations()) {
+ final Set<QName> qNamesFromAugment = ImmutableSet.copyOf(Collections2.transform(augment.getChildNodes(),
+ DataSchemaNode::getQName));
+ if (qnames.equals(qNamesFromAugment)) {
+ return Optional.of(augment);
+ }
+ }
+ return Optional.empty();
+ }
+ /**
+ * Recursively find all child nodes that come from choices.
+ *
+ * @param schema schema
+ * @return Map with all child nodes, to their most top augmentation
+ */
+ public static Map<QName, ChoiceSchemaNode> mapChildElementsFromChoices(final DataNodeContainer schema) {
+ return mapChildElementsFromChoices(schema, schema.getChildNodes());
+ }
+ private static Map<QName, ChoiceSchemaNode> mapChildElementsFromChoices(final DataNodeContainer schema,
+ final Iterable<? extends DataSchemaNode> childNodes) {
+ final Map<QName, ChoiceSchemaNode> mappedChoices = new LinkedHashMap<>();
+ for (final DataSchemaNode childSchema : childNodes) {
+ if (childSchema instanceof ChoiceSchemaNode) {
+ if (isFromAugment(schema, childSchema)) {
+ continue;
+ }
+ for (final CaseSchemaNode choiceCaseNode : ((ChoiceSchemaNode) childSchema).getCases()) {
+ for (final QName qname : getChildNodesRecursive(choiceCaseNode)) {
+ mappedChoices.put(qname, (ChoiceSchemaNode) childSchema);
+ }
+ }
+ }
+ }
+ return mappedChoices;
+ }
+ private static boolean isFromAugment(final DataNodeContainer schema, final DataSchemaNode childSchema) {
+ if (!(schema instanceof AugmentationTarget)) {
+ return false;
+ }
+ for (final AugmentationSchemaNode augmentation : ((AugmentationTarget) schema).getAvailableAugmentations()) {
+ if (augmentation.findDataChildByName(childSchema.getQName()).isPresent()) {
+ return true;
+ }
+ }
+ return false;
+ }
+ /**
+ * Recursively find all child nodes that come from augmentations.
+ *
+ * @param schema schema
+ * @return Map with all child nodes, to their most top augmentation
+ */
+ public static Map<QName, AugmentationSchemaNode> mapChildElementsFromAugments(final AugmentationTarget schema) {
+ final Map<QName, AugmentationSchemaNode> childNodesToAugmentation = new LinkedHashMap<>();
+ // Find QNames of augmented child nodes
+ final Map<QName, AugmentationSchemaNode> augments = new HashMap<>();
+ for (final AugmentationSchemaNode augmentationSchema : schema.getAvailableAugmentations()) {
+ for (final DataSchemaNode dataSchemaNode : augmentationSchema.getChildNodes()) {
+ augments.put(dataSchemaNode.getQName(), augmentationSchema);
+ }
+ }
+ // Augmented nodes have to be looked up directly in augmentationTarget
+ // because nodes from augment do not contain nodes from other augmentations
+ if (schema instanceof DataNodeContainer) {
+ for (final DataSchemaNode child : ((DataNodeContainer) schema).getChildNodes()) {
+ // If is not augmented child, continue
+ if (!augments.containsKey(child.getQName())) {
+ continue;
+ }
+ final AugmentationSchemaNode mostTopAugmentation = augments.get(child.getQName());
+ // recursively add all child nodes in case of augment, case and choice
+ if (child instanceof AugmentationSchemaNode || child instanceof CaseSchemaNode) {
+ for (final QName qname : getChildNodesRecursive((DataNodeContainer) child)) {
+ childNodesToAugmentation.put(qname, mostTopAugmentation);
+ }
+ } else if (child instanceof ChoiceSchemaNode) {
+ for (final CaseSchemaNode choiceCaseNode : ((ChoiceSchemaNode) child).getCases()) {
+ for (final QName qname : getChildNodesRecursive(choiceCaseNode)) {
+ childNodesToAugmentation.put(qname, mostTopAugmentation);
+ }
+ }
+ } else {
+ childNodesToAugmentation.put(child.getQName(), mostTopAugmentation);
+ }
+ }
+ }
+ // Choice Node has to map child nodes from all its cases
+ if (schema instanceof ChoiceSchemaNode) {
+ for (final CaseSchemaNode choiceCaseNode : ((ChoiceSchemaNode) schema).getCases()) {
+ if (!augments.containsKey(choiceCaseNode.getQName())) {
+ continue;
+ }
+ for (final QName qname : getChildNodesRecursive(choiceCaseNode)) {
+ childNodesToAugmentation.put(qname, augments.get(choiceCaseNode.getQName()));
+ }
+ }
+ }
+ return childNodesToAugmentation;
+ }
+ /**
+ * Recursively list all child nodes. In case of choice, augment and cases, step in.
+ *
+ * @param nodeContainer node container
+ * @return set of QNames
+ */
+ public static Set<QName> getChildNodesRecursive(final DataNodeContainer nodeContainer) {
+ final Set<QName> allChildNodes = new HashSet<>();
+ for (final DataSchemaNode childSchema : nodeContainer.getChildNodes()) {
+ if (childSchema instanceof ChoiceSchemaNode) {
+ for (final CaseSchemaNode choiceCaseNode : ((ChoiceSchemaNode) childSchema).getCases()) {
+ allChildNodes.addAll(getChildNodesRecursive(choiceCaseNode));
+ }
+ } else if (childSchema instanceof AugmentationSchemaNode || childSchema instanceof CaseSchemaNode) {
+ allChildNodes.addAll(getChildNodesRecursive((DataNodeContainer) childSchema));
+ } else {
+ allChildNodes.add(childSchema.getQName());
+ }
+ }
+ return allChildNodes;
+ }
+ /**
+ * Retrieves real schemas for augmented child node.
+ *
+ * <p>
+ * Schema of the same child node from augment, and directly from target is not the same.
+ * Schema of child node from augment is incomplete, therefore its useless for XML/NormalizedNode translation.
+ *
+ * @param targetSchema target schema
+ * @param augmentSchema augment schema
+ * @return set of nodes
+ */
+ public static Set<DataSchemaNode> getRealSchemasForAugment(final AugmentationTarget targetSchema,
+ final AugmentationSchemaNode augmentSchema) {
+ if (!targetSchema.getAvailableAugmentations().contains(augmentSchema)) {
+ return ImmutableSet.of();
+ }
+ if (targetSchema instanceof DataNodeContainer) {
+ return getRealSchemasForAugment((DataNodeContainer)targetSchema, augmentSchema);
+ }
+ final Set<DataSchemaNode> realChildNodes = new HashSet<>();
+ if (targetSchema instanceof ChoiceSchemaNode) {
+ for (final DataSchemaNode dataSchemaNode : augmentSchema.getChildNodes()) {
+ for (final CaseSchemaNode choiceCaseNode : ((ChoiceSchemaNode) targetSchema).getCases()) {
+ if (getChildNodesRecursive(choiceCaseNode).contains(dataSchemaNode.getQName())) {
+ realChildNodes.add(choiceCaseNode.getDataChildByName(dataSchemaNode.getQName()));
+ }
+ }
+ }
+ }
+ return realChildNodes;
+ }
+ public static Set<DataSchemaNode> getRealSchemasForAugment(final DataNodeContainer targetSchema,
+ final AugmentationSchemaNode augmentSchema) {
+ final Set<DataSchemaNode> realChildNodes = new HashSet<>();
+ for (final DataSchemaNode dataSchemaNode : augmentSchema.getChildNodes()) {
+ final DataSchemaNode realChild = targetSchema.getDataChildByName(dataSchemaNode.getQName());
+ realChildNodes.add(realChild);
+ }
+ return realChildNodes;
+ }
+
+ public static boolean belongsToCaseAugment(final CaseSchemaNode caseNode,
+ final AugmentationIdentifier childToProcess) {
+ for (final AugmentationSchemaNode augmentationSchema : caseNode.getAvailableAugmentations()) {
+ final Set<QName> currentAugmentChildNodes = new HashSet<>();
+ for (final DataSchemaNode dataSchemaNode : augmentationSchema.getChildNodes()) {
+ currentAugmentChildNodes.add(dataSchemaNode.getQName());
+ }
+ if (childToProcess.getPossibleChildNames().equals(currentAugmentChildNodes)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ /**
+ * Tries to find in {@code parent} which is dealed as augmentation target node with QName as {@code child}. If such
+ * node is found then it is returned, else null.
+ *
+ * @param parent parent node
+ * @param child child node
+ * @return augmentation schema
+ */
+ public static AugmentationSchemaNode findCorrespondingAugment(final DataSchemaNode parent,
+ final DataSchemaNode child) {
+ if (!(parent instanceof AugmentationTarget) || parent instanceof ChoiceSchemaNode) {
+ return null;
+ }
+ for (final AugmentationSchemaNode augmentation : ((AugmentationTarget) parent).getAvailableAugmentations()) {
+ final Optional<DataSchemaNode> childInAugmentation = augmentation.findDataChildByName(child.getQName());
+ if (childInAugmentation.isPresent()) {
+ return augmentation;
+ }
+ }
+ return null;
+ }
+ /**
+ * Find child data schema node identified by its QName within a provided schema node. This method performs lookup
+ * in the namespace of all leafs, leaf-lists, lists, containers, choices, rpcs, actions, notifications, anydatas
+ * and anyxmls according to RFC6050/RFC7950 section 6.2.1.
+ *
+ * @param node
+ * schema node
+ * @param qname
+ * QName
+ * @return data child schema node
+ * @throws IllegalArgumentException
+ * if the schema node does not allow children
+ */
+ public static @Nullable SchemaNode findDataChildSchemaByQName(final SchemaNode node, final QName qname) {
+ if (node instanceof DataNodeContainer) {
+ SchemaNode child = ((DataNodeContainer) node).dataChildByName(qname);
+ if (child == null && node instanceof SchemaContext) {
+ child = tryFind(((SchemaContext) node).getOperations(), qname).orElse(null);
+ }
+ if (child == null && node instanceof NotificationNodeContainer) {
+ child = tryFind(((NotificationNodeContainer) node).getNotifications(), qname).orElse(null);
+ }
+ if (child == null && node instanceof ActionNodeContainer) {
+ child = tryFind(((ActionNodeContainer) node).getActions(), qname).orElse(null);
+ }
+ return child;
+ }
+ if (node instanceof ChoiceSchemaNode) {
+ return ((ChoiceSchemaNode) node).findCase(qname).orElse(null);
+ }
+ if (node instanceof OperationDefinition) {
+ switch (qname.getLocalName()) {
+ case "input":
+ return ((OperationDefinition) node).getInput();
+ case "output":
+ return ((OperationDefinition) node).getOutput();
+ default:
+ return null;
+ }
+ }
+ throw new IllegalArgumentException(String.format("Schema node %s does not allow children.", node));
+ }
+ /**
+ * Find child schema node identified by its QName within a provided schema node. This method performs lookup in both
+ * the namespace of groupings and the namespace of all leafs, leaf-lists, lists, containers, choices, rpcs,
+ * actions, notifications, anydatas and anyxmls according to RFC6050/RFC7950 section 6.2.1.
+ *
+ * <p>
+ * This method returns collection of SchemaNodes, because name conflicts can occur between the namespace
+ * of groupings and namespace of data nodes. This method finds and collects all schema nodes with supplied QName
+ * and returns them all as collection of schema nodes.
+ *
+ * @param node
+ * schema node
+ * @param qname
+ * QName
+ * @return collection of child schema nodes
+ * @throws IllegalArgumentException
+ * if the schema node does not allow children
+ */
+ public static Collection<SchemaNode> findChildSchemaNodesByQName(final SchemaNode node, final QName qname) {
+ final List<SchemaNode> childNodes = new ArrayList<>();
+ final SchemaNode dataNode = findDataChildSchemaByQName(node, qname);
+ if (dataNode != null) {
+ childNodes.add(dataNode);
+ }
+ if (node instanceof DataNodeContainer) {
+ tryFind(((DataNodeContainer) node).getGroupings(), qname).ifPresent(childNodes::add);
+ }
+ return childNodes.isEmpty() ? ImmutableList.of() : ImmutableList.copyOf(childNodes);
+ }
+ private static <T extends SchemaNode> Optional<T> tryFind(final Collection<T> nodes, final QName qname) {
+ return nodes.stream().filter(node -> qname.equals(node.getQName())).findFirst();
+ }
+
+ public static Module findParentModule(final SchemaContext context, final SchemaNode schemaNode) {
+ final QName qname = schemaNode.getPath().getLastComponent();
+ checkState(qname != null, "Schema Path contains invalid state of path parts. "
+ + "The Schema Path MUST contain at least ONE QName which defines namespace and Local name of path.");
+ return context.findModule(qname.getModule()).orElse(null);
+ }
+
+}
diff --git a/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java b/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java
index 21ba4cdd0..0c06923e2 100755
--- a/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java
+++ b/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java
@@ -24,24 +24,23 @@ package org.onap.ccsdk.sli.core.sli.provider;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.Inet6Address;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
+import java.util.*;
+
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.Mode;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterKey;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.testmodel.rev190723.Builtin.SampleBits;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.testmodel.rev190723.Builtin.SampleEnumeration;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.testmodel.rev190723.Builtin.SampleUnion;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.testmodel.rev190723.Percentage;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.testmodel.rev190723.SampleContainer;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.testmodel.rev190723.SampleContainerBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.testmodel.rev190723.sample.container.LoginBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.testmodel.rev190723.sample.container.*;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.testmodel.rev190723.sample.container.login.CustomerAddresses;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.testmodel.rev190723.sample.container.login.CustomerAddressesBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.testmodel.rev190723.sample.container.login.CustomerAddressesKey;
import org.opendaylight.yang.gen.v1.test.IpFragmentFlagEnumType;
import org.opendaylight.yang.gen.v1.test.TestObjectBuilder;
import org.opendaylight.yang.gen.v1.test.WrapperObj;
@@ -64,7 +63,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
-import org.opendaylight.yangtools.yang.common.Empty;
+import org.opendaylight.yangtools.yang.common.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import junit.framework.TestCase;
@@ -92,45 +91,53 @@ public class MdsalHelperTest extends TestCase {
ExecuteGraphInputBuilder execBuilder = new ExecuteGraphInputBuilder();
SliParameterBuilder parmBuilder = new SliParameterBuilder();
- List<SliParameter> params = new LinkedList<SliParameter>();
+ Map<SliParameterKey, SliParameter> params = new HashMap<>();
parmBuilder.setParameterName("boolean-parm");
parmBuilder.setBooleanValue(Boolean.TRUE);
- params.add(parmBuilder.build());
+ SliParameter newParm = parmBuilder.build();
+ params.put(newParm.key(), newParm);
parmBuilder.setParameterName("int-parm");
parmBuilder.setBooleanValue(null);
parmBuilder.setIntValue(1);
- params.add(parmBuilder.build());
+ newParm = parmBuilder.build();
+ params.put(newParm.key(), newParm);
parmBuilder.setParameterName("str-parm");
parmBuilder.setIntValue(null);
parmBuilder.setStringValue("hello");
- params.add(parmBuilder.build());
+ newParm = parmBuilder.build();
+ params.put(newParm.key(), newParm);
parmBuilder.setParameterName("ipaddress4-parm");
parmBuilder.setStringValue(null);
parmBuilder.setIpaddressValue(IpAddressBuilder.getDefaultInstance("127.0.0.1"));
- params.add(parmBuilder.build());
+ newParm = parmBuilder.build();
+ params.put(newParm.key(), newParm);
parmBuilder.setParameterName("ipaddress6-parm");
parmBuilder.setIpaddressValue(IpAddressBuilder.getDefaultInstance("ef::1"));
- params.add(parmBuilder.build());
+ newParm = parmBuilder.build();
+ params.put(newParm.key(), newParm);
parmBuilder.setParameterName("ipprefix-parm");
parmBuilder.setIpaddressValue(null);
parmBuilder.setIpprefixValue(IpPrefixBuilder.getDefaultInstance("10.0.0.0/24"));
- params.add(parmBuilder.build());
+ newParm = parmBuilder.build();
+ params.put(newParm.key(), newParm);
parmBuilder.setParameterName("portnumber-parm");
parmBuilder.setIpprefixValue(null);
parmBuilder.setPortNumber(PortNumber.getDefaultInstance("8080"));
- params.add(parmBuilder.build());
+ newParm = parmBuilder.build();
+ params.put(newParm.key(), newParm);
parmBuilder.setParameterName("dcsp-parm");
parmBuilder.setPortNumber(null);
parmBuilder.setDscp(Dscp.getDefaultInstance("57"));
- params.add(parmBuilder.build());
+ newParm = parmBuilder.build();
+ params.put(newParm.key(), newParm);
execBuilder.setMode(Mode.Sync);
execBuilder.setModuleName("my-module");
@@ -574,7 +581,8 @@ public class MdsalHelperTest extends TestCase {
public void testToPropertiesWithuInt8() throws Exception {
SampleContainerBuilder sampleBuilder = new SampleContainerBuilder();
- Short myShort = new Short("255");
+
+ Uint8 myShort = Uint8.valueOf("255");
sampleBuilder.setSampleUint8(myShort);
Properties props = new Properties();
MdsalHelper.toProperties(props, sampleBuilder);
@@ -583,7 +591,7 @@ public class MdsalHelperTest extends TestCase {
public void testToPropertiesWithuInt16() throws Exception {
SampleContainerBuilder sampleBuilder = new SampleContainerBuilder();
- Integer myInt = new Integer("65535");
+ Uint16 myInt = Uint16.valueOf("65535");
sampleBuilder.setSampleUint16(myInt);
Properties props = new Properties();
MdsalHelper.toProperties(props, sampleBuilder);
@@ -592,7 +600,7 @@ public class MdsalHelperTest extends TestCase {
public void testToPropertiesWithuInt32() throws Exception {
SampleContainerBuilder sampleBuilder = new SampleContainerBuilder();
- Long myLong = new Long("4294967295");
+ Uint32 myLong = Uint32.valueOf("4294967295");
sampleBuilder.setSampleUint32(myLong);
Properties props = new Properties();
MdsalHelper.toProperties(props, sampleBuilder);
@@ -601,7 +609,7 @@ public class MdsalHelperTest extends TestCase {
public void testToPropertiesWithuInt64() throws Exception {
SampleContainerBuilder sampleBuilder = new SampleContainerBuilder();
- BigInteger myBigInt = new BigInteger("2432902008176640000");
+ Uint64 myBigInt = Uint64.valueOf("2432902008176640000");
sampleBuilder.setSampleUint64(myBigInt);
Properties props = new Properties();
MdsalHelper.toProperties(props, sampleBuilder);
@@ -628,7 +636,7 @@ public class MdsalHelperTest extends TestCase {
SampleContainerBuilder sampleBuilder = new SampleContainerBuilder();
Properties props = new Properties();
- Short myShort = new Short("99");
+ Uint8 myShort = Uint8.valueOf("99");
Percentage myPercent = new Percentage(myShort);
sampleBuilder.setPercentCompleted(myPercent);
MdsalHelper.toProperties(props, sampleBuilder);
@@ -661,21 +669,21 @@ public class MdsalHelperTest extends TestCase {
SampleContainerBuilder sampleBuilder = new SampleContainerBuilder();
LoginBuilder lb = new LoginBuilder();
lb.setMessage("WELCOME!");
- List<CustomerAddresses> addresses = new ArrayList<CustomerAddresses>();
+ Map<CustomerAddressesKey, CustomerAddresses> addresses = new LinkedHashMap<>();
CustomerAddressesBuilder cab = new CustomerAddressesBuilder();
cab.setAddressName("home");
cab.setState("NJ");
cab.setStreetAddress("yellowbrick road");
CustomerAddresses addressOne = cab.build();
- addresses.add(addressOne);
+ addresses.put(addressOne.key(), addressOne);
cab.setAddressName("vacation house");
cab.setState("FL");
cab.setStreetAddress("ocean ave");
CustomerAddresses addressTwo = cab.build();
- addresses.add(addressTwo);
+ addresses.put(addressTwo.key(), addressTwo);
lb.setCustomerAddresses(addresses);
sampleBuilder.setLogin(lb.build());
@@ -766,6 +774,13 @@ public class MdsalHelperTest extends TestCase {
props.put("sample-container.ipv6-prefix", "2001:db8:aaaa:1111::100/64");
props.put("sample-container.ipv6-prefix.value", "2001:db8:aaaa:1111::100/64");
props.put("sample-container.port-number", "2");
+ props.put("sample-container.ip-address-list[0].ip-addr", "127.0.0.1");
+ props.put("sample-container.ip-address-list[1].ip-addr", "10.20.0.1");
+ props.put("sample-container.ip-address-list_length", 2);
+ props.put("sample-container.ip-address-leaf-list[0]", "127.0.0.1");
+ props.put("sample-container.ip-address-names[0].ip-addr", "127.0.0.1");
+ props.put("sample-container.ip-address-names[0].fqdn", "localhost");
+
props.put("sample-container.uri", "http://wiki.onap.org:8080");
props.put("sample-container.uri.value", "http://wiki.onap.org:8080");
SampleContainerBuilder sampleBuilder = new SampleContainerBuilder();
@@ -790,6 +805,23 @@ public class MdsalHelperTest extends TestCase {
assertEquals(Ipv6Prefix.getDefaultInstance("2001:db8:aaaa:1111::100/64"), result.getIpv6Prefix());
assertEquals(PortNumber.getDefaultInstance("2"), result.getPortNumber());
assertEquals(Uri.getDefaultInstance("http://wiki.onap.org:8080"), result.getUri());
+ Map<IpAddressListKey, IpAddressList> ipAddrList = result.getIpAddressList();
+
+ Iterator<IpAddressList> ipAddrIter = ipAddrList.values().iterator();
+ assertEquals(true, ipAddrIter.hasNext());
+ assertEquals("127.0.0.1", ipAddrIter.next().getIpAddr().stringValue());
+ assertEquals(true, ipAddrIter.hasNext());
+ assertEquals("10.20.0.1", ipAddrIter.next().getIpAddr().stringValue());
+ assertEquals(1, result.getIpAddressLeafList().size());
+ assertEquals("127.0.0.1", result.getIpAddressLeafList().get(0).stringValue());
+ Map<IpAddressNamesKey, IpAddressNames> ipNamesMap = result.getIpAddressNames();
+ Iterator<IpAddressNames> ipNamesIter = ipNamesMap.values().iterator();
+ assertEquals(true, ipNamesIter.hasNext());
+ IpAddressNames ipNames = ipNamesIter.next();
+ assertEquals("127.0.0.1", ipNames.getIpAddr().stringValue());
+ assertEquals("localhost", ipNames.getFqdn());
+
+
}
public void testToLowerHyphen() throws Exception {
diff --git a/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToPropTest.java b/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToPropTest.java
index 10bbbd91a..ada933d88 100644
--- a/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToPropTest.java
+++ b/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToPropTest.java
@@ -23,17 +23,21 @@
package org.onap.ccsdk.sli.core.sli.provider;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.Mode;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResultsBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterKey;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResultBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResultKey;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder;
import org.slf4j.Logger;
@@ -57,38 +61,38 @@ public class PrintYangToPropTest {
egBuilder.setModuleName("my-module");
egBuilder.setRpcName("my-rpc");
- List<SliParameter> pList = new LinkedList<>();
+ Map<SliParameterKey, SliParameter> pMap = new HashMap<>();
SliParameterBuilder pBuilder = new SliParameterBuilder();
pBuilder.setParameterName("string-param");
pBuilder.setStringValue("hi");
- pList.add(pBuilder.build());
+ pMap.put(new SliParameterKey(pBuilder.getParameterName()), pBuilder.build());
pBuilder.setParameterName("int-param");
pBuilder.setIntValue(1);
pBuilder.setStringValue(null);
- pList.add(pBuilder.build());
+ pMap.put(new SliParameterKey(pBuilder.getParameterName()), pBuilder.build());
pBuilder.setParameterName("bool-param");
pBuilder.setIntValue(null);
pBuilder.setBooleanValue(true);
- pList.add(pBuilder.build());
+ pMap.put(new SliParameterKey(pBuilder.getParameterName()), pBuilder.build());
pBuilder.setParameterName("ipaddress-value1");
pBuilder.setBooleanValue(null);
pBuilder.setIpaddressValue(IpAddressBuilder.getDefaultInstance("127.0.0.1"));
- pList.add(pBuilder.build());
+ pMap.put(new SliParameterKey(pBuilder.getParameterName()), pBuilder.build());
pBuilder.setParameterName("ipaddress-value2");
pBuilder.setIpaddressValue(IpAddressBuilder.getDefaultInstance("::1"));
- pList.add(pBuilder.build());
+ pMap.put(new SliParameterKey(pBuilder.getParameterName()), pBuilder.build());
pBuilder.setParameterName("ipprefix-value1");
pBuilder.setIpaddressValue(null);
pBuilder.setIpprefixValue(IpPrefixBuilder.getDefaultInstance("192.168.0.0/16"));
- pList.add(pBuilder.build());
+ pMap.put(new SliParameterKey(pBuilder.getParameterName()), pBuilder.build());
pBuilder.setParameterName("ipprefix-value2");
pBuilder.setIpprefixValue(IpPrefixBuilder.getDefaultInstance("2001:db8:3c4d::/48"));
- pList.add(pBuilder.build());
+ pMap.put(new SliParameterKey(pBuilder.getParameterName()), pBuilder.build());
- egBuilder.setSliParameter(pList);
+ egBuilder.setSliParameter(pMap);
// Generate properties
@@ -113,12 +117,12 @@ public class PrintYangToPropTest {
TestResultBuilder resultBuilder = new TestResultBuilder();
// Set builder with values
- List<TestResult> resultList = new LinkedList<>();
+ Map<TestResultKey, TestResult> resultList = new HashMap<>();
resultBuilder.setTestIdentifier("test1");
List<String> results = new LinkedList<>();
results.add("pass");
resultBuilder.setResults(results);
- resultList.add(resultBuilder.build());
+ resultList.put(new TestResultKey(resultBuilder.getTestIdentifier()), resultBuilder.build());
resultsBuilder.setTestResult(resultList);
// Generate properties
diff --git a/core/sliPluginUtils/installer/pom.xml b/core/sliPluginUtils/installer/pom.xml
index 7f66197b7..c5571ee0b 100755
--- a/core/sliPluginUtils/installer/pom.xml
+++ b/core/sliPluginUtils/installer/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/sliPluginUtils/pom.xml b/core/sliPluginUtils/pom.xml
index 1968d88a0..dea15a631 100755
--- a/core/sliPluginUtils/pom.xml
+++ b/core/sliPluginUtils/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/sliPluginUtils/provider/pom.xml b/core/sliPluginUtils/provider/pom.xml
index a2383860a..99ab72818 100755
--- a/core/sliPluginUtils/provider/pom.xml
+++ b/core/sliPluginUtils/provider/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/sliapi/installer/pom.xml b/core/sliapi/installer/pom.xml
index ca5c89a95..018f4eca8 100755
--- a/core/sliapi/installer/pom.xml
+++ b/core/sliapi/installer/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/sliapi/model/pom.xml b/core/sliapi/model/pom.xml
index 77a090086..f09441ba4 100755
--- a/core/sliapi/model/pom.xml
+++ b/core/sliapi/model/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/sliapi/model/swagger/pom.xml b/core/sliapi/model/swagger/pom.xml
index c90a3361f..8e5e9537e 100644
--- a/core/sliapi/model/swagger/pom.xml
+++ b/core/sliapi/model/swagger/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
</parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
diff --git a/core/sliapi/model/yang/pom.xml b/core/sliapi/model/yang/pom.xml
index 255d00ae2..b53b6aea2 100755
--- a/core/sliapi/model/yang/pom.xml
+++ b/core/sliapi/model/yang/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/sliapi/pom.xml b/core/sliapi/pom.xml
index c7cb55506..93cf051ff 100755
--- a/core/sliapi/pom.xml
+++ b/core/sliapi/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/sliapi/provider/pom.xml b/core/sliapi/provider/pom.xml
index 6e852ed0d..bda7226e0 100755
--- a/core/sliapi/provider/pom.xml
+++ b/core/sliapi/provider/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java b/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java
index a00131efb..015ef5e57 100644
--- a/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java
+++ b/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java
@@ -258,7 +258,7 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
String propValue = "";
- Boolean boolval = sliParm.isBooleanValue();
+ Boolean boolval = sliParm.getBooleanValue();
if (boolval != null) {
propValue = boolval.toString();
diff --git a/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java b/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java
index cd7dd2058..73c613aa7 100644
--- a/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java
+++ b/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java
@@ -27,11 +27,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.io.InputStream;
import java.net.URL;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
+import java.util.*;
import java.util.concurrent.Future;
import org.junit.After;
import org.junit.Before;
@@ -72,6 +68,7 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.Hea
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.SLIAPIService;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.VlbcheckInput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterKey;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterBuilder;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
@@ -173,20 +170,23 @@ public class TestSliapiProvider {
inputBuilder.setMode(ExecuteGraphInput.Mode.Sync);
inputBuilder.setModuleName("sli");
inputBuilder.setRpcName("healthcheck");
- List<SliParameter> pList = new LinkedList<>();
+ Map<SliParameterKey, SliParameter> pMap = new LinkedHashMap<>();
SliParameterBuilder pBuilder = new SliParameterBuilder();
pBuilder.setParameterName("int-parameter");
pBuilder.setIntValue(1);
- pList.add(pBuilder.build());
+ SliParameter sliParm = pBuilder.build();
+ pMap.put(sliParm.key(), sliParm);
pBuilder.setParameterName("bool-parameter");
pBuilder.setIntValue(null);
pBuilder.setBooleanValue(true);
- pList.add(pBuilder.build());
+ sliParm = pBuilder.build();
+ pMap.put(sliParm.key(), sliParm);
pBuilder.setParameterName("str-parameter");
pBuilder.setBooleanValue(null);
pBuilder.setStringValue("value");
- pList.add(pBuilder.build());
- inputBuilder.setSliParameter(pList);
+ sliParm = pBuilder.build();
+ pMap.put(sliParm.key(), sliParm);
+ inputBuilder.setSliParameter(pMap);
provider.executeGraph(inputBuilder.build());
@@ -194,20 +194,23 @@ public class TestSliapiProvider {
inputBuilder.setMode(ExecuteGraphInput.Mode.Sync);
inputBuilder.setModuleName("sli");
inputBuilder.setRpcName("no-such-graph");
- pList = new LinkedList<>();
+ pMap = new LinkedHashMap<>();
pBuilder = new SliParameterBuilder();
pBuilder.setParameterName("int-parameter");
pBuilder.setIntValue(1);
- pList.add(pBuilder.build());
+ sliParm = pBuilder.build();
+ pMap.put(sliParm.key(), sliParm);
pBuilder.setParameterName("bool-parameter");
pBuilder.setIntValue(null);
pBuilder.setBooleanValue(true);
- pList.add(pBuilder.build());
+ sliParm = pBuilder.build();
+ pMap.put(sliParm.key(), sliParm);
pBuilder.setParameterName("str-parameter");
pBuilder.setBooleanValue(null);
pBuilder.setStringValue("value");
- pList.add(pBuilder.build());
- inputBuilder.setSliParameter(pList);
+ sliParm = pBuilder.build();
+ pMap.put(sliParm.key(), sliParm);
+ inputBuilder.setSliParameter(pMap);
provider.executeGraph(inputBuilder.build());
assertTrue(provider.vlbcheck(mock(VlbcheckInput.class)) instanceof Future<?>);
diff --git a/core/utils/installer/pom.xml b/core/utils/installer/pom.xml
index b9c0b7175..a7a7417b1 100755
--- a/core/utils/installer/pom.xml
+++ b/core/utils/installer/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/utils/pom.xml b/core/utils/pom.xml
index 8a52c1467..0da7ce110 100755
--- a/core/utils/pom.xml
+++ b/core/utils/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/core/utils/provider/pom.xml b/core/utils/provider/pom.xml
index 6e99c7756..35cadb918 100644
--- a/core/utils/provider/pom.xml
+++ b/core/utils/provider/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
<relativePath/>
</parent>