From: Tony Tkacik Date: Thu, 16 Oct 2014 10:08:13 +0000 (+0000) Subject: Merge "BUG-1521 netconf-impl & netconf-monitoring line coverage." X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=9b3246b5f5ed82559bf0c75141731dc3376125f9;hp=a2e47bbc56fc232c8d89568dede6f179bb490bc1;p=controller.git Merge "BUG-1521 netconf-impl & netconf-monitoring line coverage." --- diff --git a/features/adsal-compatibility/pom.xml b/features/adsal-compatibility/pom.xml index 44b9b0900c..7b8af64445 100644 --- a/features/adsal-compatibility/pom.xml +++ b/features/adsal-compatibility/pom.xml @@ -10,14 +10,14 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../opendaylight/commons/opendaylight features-adsal-compatibility jar features.xml - 0.6.2-SNAPSHOT + 0.7.0-SNAPSHOT diff --git a/features/adsal/src/main/resources/features.xml b/features/adsal/src/main/resources/features.xml index e12ca8e5e9..a665657ba7 100644 --- a/features/adsal/src/main/resources/features.xml +++ b/features/adsal/src/main/resources/features.xml @@ -35,7 +35,6 @@ odl-adsal-core mvn:org.opendaylight.controller/clustering.services/${clustering.services.version} mvn:org.opendaylight.controller/clustering.services-implementation/${clustering.services_implementation.version} - mvn:org.opendaylight.controller/clustering.stub/${clustering.stub.version} odl-adsal-core diff --git a/features/akka/pom.xml b/features/akka/pom.xml index f1f3017c20..f804505c64 100644 --- a/features/akka/pom.xml +++ b/features/akka/pom.xml @@ -10,7 +10,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../opendaylight/commons/opendaylight features-akka @@ -20,11 +20,11 @@ features.xml - 1.0.0-SNAPSHOT - 1.4.2-SNAPSHOT + 1.1.0-SNAPSHOT + 1.5.0-SNAPSHOT 3.0.1 - 0.6.2-SNAPSHOT - 1.4.2-SNAPSHOT + 0.7.0-SNAPSHOT + 1.5.0-SNAPSHOT 2.16 @@ -42,21 +42,21 @@ org.opendaylight.yangtools features-yangtools - 0.6.2-SNAPSHOT + 0.7.0-SNAPSHOT features xml org.opendaylight.controller features-mdsal - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT features xml org.opendaylight.openflowplugin features-openflowplugin - 0.0.3-SNAPSHOT + 0.1.0-SNAPSHOT features xml diff --git a/features/akka/src/main/resources/features.xml b/features/akka/src/main/resources/features.xml index 182ff766e6..8a3b4a2e25 100644 --- a/features/akka/src/main/resources/features.xml +++ b/features/akka/src/main/resources/features.xml @@ -18,9 +18,9 @@ Necessary TODO: Add repo entries for the repositories of features you refer to in this feature file but do not define here. Examples: - mvn:org.opendaylight.yangtools/features-yangtools/0.6.2-SNAPSHOT/xml/features - mvn:org.opendaylight.controller/features-mdsal/1.1-SNAPSHOT/xml/features - mvn:org.opendaylight.openflowplugin/features-openflowplugin/0.0.3-SNAPSHOT/xml/features + mvn:org.opendaylight.yangtools/features-yangtools/0.7.0-SNAPSHOT/xml/features + mvn:org.opendaylight.controller/features-mdsal/1.2.0-SNAPSHOT/xml/features + mvn:org.opendaylight.openflowplugin/features-openflowplugin/0.1.0-SNAPSHOT/xml/features --> org.opendaylight.controller opendaylight-karaf-empty - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT zip diff --git a/features/base/src/main/resources/features.xml b/features/base/src/main/resources/features.xml index e4c455ccca..c324f6cea6 100644 --- a/features/base/src/main/resources/features.xml +++ b/features/base/src/main/resources/features.xml @@ -16,8 +16,8 @@ odl-base-jackson odl-base-spring-security - - mvn:org.opendaylight.controller/dummy-console/1.1.0-SNAPSHOT + + mvn:org.opendaylight.controller/dummy-console/1.2.0-SNAPSHOT mvn:org.osgi/org.osgi.compendium/${osgi.compendium.version} @@ -36,7 +36,7 @@ wrap:mvn:io.netty/netty-common/${netty.version} wrap:mvn:io.netty/netty-handler/${netty.version} wrap:mvn:io.netty/netty-codec-http/${netty.version} - mvn:org.opendaylight.controller.thirdparty/ganymed/1.1-SNAPSHOT + mvn:org.opendaylight.controller.thirdparty/ganymed/1.2.0-SNAPSHOT odl-base-gemini-web diff --git a/features/config-netty/pom.xml b/features/config-netty/pom.xml index bf036979cf..0057fc05c7 100644 --- a/features/config-netty/pom.xml +++ b/features/config-netty/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../../opendaylight/config/ features-config-netty diff --git a/features/config-persister/pom.xml b/features/config-persister/pom.xml index 3346c754d6..f3b42ca143 100644 --- a/features/config-persister/pom.xml +++ b/features/config-persister/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../../opendaylight/config/ features-config-persister diff --git a/features/config/pom.xml b/features/config/pom.xml index 20feceb360..461427c7ce 100644 --- a/features/config/pom.xml +++ b/features/config/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../../opendaylight/config/ features-config @@ -20,7 +20,7 @@ org.opendaylight.controller opendaylight-karaf-empty - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT zip diff --git a/features/controller/pom.xml b/features/controller/pom.xml index ddaf773151..5dd2bd4a2a 100644 --- a/features/controller/pom.xml +++ b/features/controller/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../opendaylight/commons/opendaylight controller-features diff --git a/features/extras/pom.xml b/features/extras/pom.xml index 4563190b9f..e4356e6b49 100644 --- a/features/extras/pom.xml +++ b/features/extras/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../opendaylight/commons/opendaylight extras-features diff --git a/features/flow/pom.xml b/features/flow/pom.xml index ac189737d9..ab30b0b61f 100644 --- a/features/flow/pom.xml +++ b/features/flow/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT ../../opendaylight/md-sal features-flow diff --git a/features/mdsal/pom.xml b/features/mdsal/pom.xml index 299e5b6707..036d18fb85 100644 --- a/features/mdsal/pom.xml +++ b/features/mdsal/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT ../../opendaylight/md-sal features-mdsal @@ -319,7 +319,7 @@ org.opendaylight.yangtools features-test - 0.6.2-SNAPSHOT + 0.7.0-SNAPSHOT diff --git a/features/mdsal/src/main/resources/features.xml b/features/mdsal/src/main/resources/features.xml index 2a988ced05..fb524081e7 100644 --- a/features/mdsal/src/main/resources/features.xml +++ b/features/mdsal/src/main/resources/features.xml @@ -11,7 +11,6 @@ odl-mdsal-broker odl-mdsal-clustering - odl-restconf odl-mdsal-xsql odl-toaster @@ -33,26 +32,6 @@ mvn:org.opendaylight.controller/sal-inmemory-datastore/${project.version} mvn:org.opendaylight.controller/md-sal-config/${mdsal.version}/xml/config - - odl-mdsal-broker - war - - mvn:org.opendaylight.controller/sal-remote/${project.version} - mvn:org.opendaylight.controller/sal-rest-connector/${project.version} - mvn:com.google.code.gson/gson/${gson.version} - mvn:org.opendaylight.yangtools/yang-data-codec-gson/${yangtools.version} - mvn:com.sun.jersey/jersey-core/${jersey.version} - mvn:com.sun.jersey/jersey-server/${jersey.version} - mvn:com.sun.jersey/jersey-servlet/${jersey.version} - mvn:io.netty/netty-buffer/${netty.version} - mvn:io.netty/netty-codec/${netty.version} - mvn:io.netty/netty-codec-http/${netty.version} - mvn:io.netty/netty-common/${netty.version} - mvn:io.netty/netty-handler/${netty.version} - mvn:io.netty/netty-transport/${netty.version} - mvn:org.opendaylight.controller/sal-rest-connector-config/${mdsal.version}/xml/config - odl-yangtools-common odl-yangtools-binding @@ -68,21 +47,6 @@ mvn:org.opendaylight.controller/sal-karaf-xsql/${project.version} mvn:org.opendaylight.controller/sal-dom-xsql-config/${project.version}/xml/config - - odl-restconf - mvn:org.opendaylight.controller/sal-rest-docgen/${project.version} - mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version} - mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version} - mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version} - mvn:com.fasterxml.jackson.datatype/jackson-datatype-json-org/${jackson.version} - mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/${jackson.version} - mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/${jackson.version} - mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/${jackson.version} - mvn:com.sun.jersey/jersey-core/${jersey.version} - mvn:com.sun.jersey/jersey-server/${jersey.version} - mvn:com.sun.jersey/jersey-servlet/${jersey.version} - wrap:mvn:org.json/json/${org.json.version} - odl-mdsal-broker odl-akka-system @@ -112,15 +76,4 @@ mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/moduleshardconf mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/moduleconf - - - odl-mdsal-clustering - odl-restconf - odl-yangtools-models - mvn:org.opendaylight.controller.samples/clustering-it-model/${project.version} - mvn:org.opendaylight.controller.samples/clustering-it-provider/${project.version} - mvn:org.opendaylight.controller.samples/clustering-it-config/${project.version}/xml/config - mvn:org.opendaylight.controller.samples/clustering-it-config/${project.version}/xml/testmoduleshardconf - mvn:org.opendaylight.controller.samples/clustering-it-config/${project.version}/xml/testmoduleconf - diff --git a/features/netconf-connector/pom.xml b/features/netconf-connector/pom.xml index 8b19d200a3..03d6fed605 100644 --- a/features/netconf-connector/pom.xml +++ b/features/netconf-connector/pom.xml @@ -10,7 +10,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT ../../opendaylight/md-sal features-netconf-connector jar @@ -42,21 +42,21 @@ org.opendaylight.yangtools features-yangtools - 0.6.2-SNAPSHOT + 0.7.0-SNAPSHOT features xml org.opendaylight.controller features-mdsal - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT features xml org.opendaylight.openflowplugin features-openflowplugin - 0.0.3-SNAPSHOT + 0.1.0-SNAPSHOT features xml diff --git a/features/netconf-connector/src/main/resources/features.xml b/features/netconf-connector/src/main/resources/features.xml index 3e576e47f1..6ae308eb0c 100644 --- a/features/netconf-connector/src/main/resources/features.xml +++ b/features/netconf-connector/src/main/resources/features.xml @@ -18,9 +18,9 @@ Necessary TODO: Add repo entries for the repositories of features you refer to in this feature file but do not define here. Examples: - mvn:org.opendaylight.yangtools/features-yangtools/0.6.2-SNAPSHOT/xml/features - mvn:org.opendaylight.controller/features-mdsal/1.1-SNAPSHOT/xml/features - mvn:org.opendaylight.openflowplugin/features-openflowplugin/0.0.3-SNAPSHOT/xml/features + mvn:org.opendaylight.yangtools/features-yangtools/0.7.0-SNAPSHOT/xml/features + mvn:org.opendaylight.controller/features-mdsal/1.2.0-SNAPSHOT/xml/features + mvn:org.opendaylight.openflowplugin/features-openflowplugin/0.1.0-SNAPSHOT/xml/features --> mvn:org.opendaylight.controller/features-mdsal/${mdsal.version}/xml/features mvn:org.opendaylight.yangtools/features-yangtools/${yangtools.version}/xml/features @@ -54,7 +54,7 @@ * Basic MD-SAL Provider - odl-mdsal-broker + odl-mdsal-broker odl-controller-model mvn:org.opendaylight.controller/controller-provider/${project.version} ... whatever other bundles you need @@ -62,15 +62,15 @@ * Basic MD-SAL Model feature - odl-yangtools-binding - odl-yangtools-models + odl-yangtools-binding + odl-yangtools-models mvn:org.opendaylight.controller/controller-model/${project.version} ... whatever other bundles you need * Config Subsystem example - the config file is your config subsystem configuration - odl-mdsal-broker + odl-mdsal-broker mvn:org.opendaylight.controller/controller-provider/${project.version} mvn:org.opendaylight.controller/controller-config/${project.version}/xml/config ... whatever other bundles you need @@ -78,7 +78,7 @@ * Basic MD-SAL Provider that uses openflowplugin-flow-services (which brings along odl-mdsal-broker) - odl-openflowplugin-flow-services + odl-openflowplugin-flow-services mvn:org.opendaylight.controller/controller-provider/${project.version} ... whatever other bundles you need diff --git a/features/netconf/pom.xml b/features/netconf/pom.xml index 1061f4a37d..a944bb4dec 100644 --- a/features/netconf/pom.xml +++ b/features/netconf/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../../opendaylight/netconf features-netconf diff --git a/features/nsf/pom.xml b/features/nsf/pom.xml index e677d491bc..00dc219b39 100644 --- a/features/nsf/pom.xml +++ b/features/nsf/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../opendaylight/commons/opendaylight features-nsf @@ -25,7 +25,7 @@ org.opendaylight.controller opendaylight-karaf-empty - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT zip diff --git a/features/pom.xml b/features/pom.xml index 9f10b5908b..5270e3f5cd 100644 --- a/features/pom.xml +++ b/features/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../opendaylight/commons/opendaylight features-controller @@ -28,5 +28,6 @@ adsal-compatibility akka netconf-connector + restconf \ No newline at end of file diff --git a/features/protocol-framework/pom.xml b/features/protocol-framework/pom.xml index dcd24d6216..d5387b43c3 100644 --- a/features/protocol-framework/pom.xml +++ b/features/protocol-framework/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../opendaylight/commons/opendaylight features-protocol-framework diff --git a/features/restconf/pom.xml b/features/restconf/pom.xml new file mode 100644 index 0000000000..632b4cd592 --- /dev/null +++ b/features/restconf/pom.xml @@ -0,0 +1,346 @@ + + + 4.0.0 + + org.opendaylight.controller + sal-parent + 1.2.0-SNAPSHOT + ../../opendaylight/md-sal + + + features-restconf + org.opendaylight.controller + + jar + + features.xml + + + + + + + + + org.opendaylight.yangtools + features-yangtools + ${yangtools.version} + features + xml + + + org.opendaylight.controller + features-mdsal + ${mdsal.version} + features + xml + + + org.opendaylight.aaa + features-aaa + ${aaa.version} + features + xml + + + + org.opendaylight.controller + sal-remote + + + + org.opendaylight.controller + sal-rest-connector + + + + com.google.code.gson + gson + + + + com.sun.jersey + jersey-core + + + com.sun.jersey + jersey-server + + + com.sun.jersey + jersey-servlet + + + io.netty + netty-buffer + + + io.netty + netty-codec + + + io.netty + netty-codec-http + + + io.netty + netty-common + + + io.netty + netty-handler + + + io.netty + netty-transport + + + + org.opendaylight.controller + sal-rest-connector-config + ${mdsal.version} + xml + config + + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.datatype + jackson-datatype-json-org + + + com.fasterxml.jackson.module + jackson-module-jaxb-annotations + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-base + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + + + org.json + json + + + + org.opendaylight.yangtools + yang-data-codec-gson + + + + org.opendaylight.controller.samples + clustering-it-model + ${mdsal.version} + + + org.opendaylight.controller.samples + clustering-it-provider + ${mdsal.version} + + + org.opendaylight.controller.samples + clustering-it-config + ${mdsal.version} + xml + config + + + org.opendaylight.controller.samples + clustering-it-config + ${mdsal.version} + xml + testmoduleshardconf + + + org.opendaylight.controller.samples + clustering-it-config + ${mdsal.version} + xml + testmoduleconf + + + org.opendaylight.controller + sal-rest-docgen + + + + + + org.opendaylight.yangtools + features-test + ${yangtools.version} + test + + + + org.opendaylight.controller + opendaylight-karaf-empty + ${commons.opendaylight.version} + zip + + + + + + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-resources-plugin + + + filter + generate-resources + + resources + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-artifacts + package + + attach-artifact + + + + + ${project.build.directory}/classes/${features.file} + xml + features + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${surefire.version} + + + org.opendaylight.controller + opendaylight-karaf-empty + ${commons.opendaylight.version} + + + org.opendaylight.yangtools:features-test + + + + + + + scm:git:ssh://git.opendaylight.org:29418/controller.git + scm:git:ssh://git.opendaylight.org:29418/controller.git + HEAD + https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=summary + + diff --git a/features/restconf/src/main/resources/features.xml b/features/restconf/src/main/resources/features.xml new file mode 100644 index 0000000000..ab42330eac --- /dev/null +++ b/features/restconf/src/main/resources/features.xml @@ -0,0 +1,151 @@ + + + + + + + mvn:org.opendaylight.controller/features-mdsal/${mdsal.version}/xml/features + mvn:org.opendaylight.yangtools/features-yangtools/${yangtools.version}/xml/features + mvn:org.opendaylight.aaa/features-aaa/${aaa.version}/xml/features + + + odl-restconf + odl-mdsal-apidocs + odl-clustering-test-app + + + + + odl-aaa-authn + odl-restconf-noauth + + + odl-mdsal-broker + war + + mvn:org.opendaylight.controller/sal-remote/${project.version} + mvn:org.opendaylight.controller/sal-rest-connector/${project.version} + mvn:com.google.code.gson/gson/${gson.version} + mvn:org.opendaylight.yangtools/yang-data-codec-gson/${yangtools.version} + mvn:com.sun.jersey/jersey-core/${jersey.version} + mvn:com.sun.jersey/jersey-server/${jersey.version} + mvn:com.sun.jersey/jersey-servlet/${jersey.version} + mvn:io.netty/netty-buffer/${netty.version} + mvn:io.netty/netty-codec/${netty.version} + mvn:io.netty/netty-codec-http/${netty.version} + mvn:io.netty/netty-common/${netty.version} + mvn:io.netty/netty-handler/${netty.version} + mvn:io.netty/netty-transport/${netty.version} + mvn:org.opendaylight.controller/sal-rest-connector-config/${mdsal.version}/xml/config + + + odl-restconf + mvn:org.opendaylight.controller/sal-rest-docgen/${project.version} + mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version} + mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version} + mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version} + mvn:com.fasterxml.jackson.datatype/jackson-datatype-json-org/${jackson.version} + mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/${jackson.version} + mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/${jackson.version} + mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/${jackson.version} + mvn:com.sun.jersey/jersey-core/${jersey.version} + mvn:com.sun.jersey/jersey-server/${jersey.version} + mvn:com.sun.jersey/jersey-servlet/${jersey.version} + wrap:mvn:org.json/json/${org.json.version} + + + + odl-mdsal-clustering + odl-restconf + odl-yangtools-models + mvn:org.opendaylight.controller.samples/clustering-it-model/${project.version} + mvn:org.opendaylight.controller.samples/clustering-it-provider/${project.version} + mvn:org.opendaylight.controller.samples/clustering-it-config/${project.version}/xml/config + mvn:org.opendaylight.controller.samples/clustering-it-config/${project.version}/xml/testmoduleshardconf + mvn:org.opendaylight.controller.samples/clustering-it-config/${project.version}/xml/testmoduleconf + + + + odl-restconf + odl-toaster + + + + odl-mdsal-apidocs + odl-mdsal-xsql + odl-toaster-rest + + + + diff --git a/itests/base-features-it/pom.xml b/itests/base-features-it/pom.xml index 8f73779009..d05e9a515b 100644 --- a/itests/base-features-it/pom.xml +++ b/itests/base-features-it/pom.xml @@ -3,7 +3,7 @@ org.opendaylight.controller itests-controller - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../pom.xml base-features-it diff --git a/itests/pom.xml b/itests/pom.xml index 19836a2ad6..c722149145 100644 --- a/itests/pom.xml +++ b/itests/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../opendaylight/commons/opendaylight itests-controller diff --git a/opendaylight/appauth/pom.xml b/opendaylight/appauth/pom.xml index e74e3cb915..8a035510bf 100644 --- a/opendaylight/appauth/pom.xml +++ b/opendaylight/appauth/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../commons/opendaylight appauth - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/archetypes/odl-model-project/pom.xml b/opendaylight/archetypes/odl-model-project/pom.xml index d2896027fb..4945eb2a66 100644 --- a/opendaylight/archetypes/odl-model-project/pom.xml +++ b/opendaylight/archetypes/odl-model-project/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller.archetypes odl-model-project - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT maven-archetype diff --git a/opendaylight/archetypes/odl-model-project/src/main/resources/archetype-resources/pom.xml b/opendaylight/archetypes/odl-model-project/src/main/resources/archetype-resources/pom.xml index 016c30d787..6b41485e7b 100644 --- a/opendaylight/archetypes/odl-model-project/src/main/resources/archetype-resources/pom.xml +++ b/opendaylight/archetypes/odl-model-project/src/main/resources/archetype-resources/pom.xml @@ -11,8 +11,8 @@ http://nexus.opendaylight.org/content opendaylight.release opendaylight.release - 0.6.2-SNAPSHOT - 0.6.2-SNAPSHOT + 0.7.0-SNAPSHOT + 0.7.0-SNAPSHOT 2.3.7 diff --git a/opendaylight/archetypes/opendaylight-configfile-archetype/pom.xml b/opendaylight/archetypes/opendaylight-configfile-archetype/pom.xml index 56342218a0..45ec9ac717 100644 --- a/opendaylight/archetypes/opendaylight-configfile-archetype/pom.xml +++ b/opendaylight/archetypes/opendaylight-configfile-archetype/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller opendaylight-configfile-archetype - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT maven-archetype diff --git a/opendaylight/archetypes/opendaylight-karaf-distro-archetype/pom.xml b/opendaylight/archetypes/opendaylight-karaf-distro-archetype/pom.xml index 9081ce797b..ff2384fb27 100644 --- a/opendaylight/archetypes/opendaylight-karaf-distro-archetype/pom.xml +++ b/opendaylight/archetypes/opendaylight-karaf-distro-archetype/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller.archetypes archetypes-parent - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT org.opendaylight.controller opendaylight-karaf-distro-archetype - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT maven-archetype distribution-karaf-archetype diff --git a/opendaylight/archetypes/opendaylight-karaf-distro-archetype/src/main/resources/archetype-resources/pom.xml b/opendaylight/archetypes/opendaylight-karaf-distro-archetype/src/main/resources/archetype-resources/pom.xml index fdc60625c8..c2e399b370 100644 --- a/opendaylight/archetypes/opendaylight-karaf-distro-archetype/src/main/resources/archetype-resources/pom.xml +++ b/opendaylight/archetypes/opendaylight-karaf-distro-archetype/src/main/resources/archetype-resources/pom.xml @@ -19,8 +19,8 @@ - 1.0.0-SNAPSHOT - 1.4.2-SNAPSHOT + 1.1.0-SNAPSHOT + 1.5.0-SNAPSHOT 3.0.1 @@ -81,7 +81,7 @@ org.opendaylight.openflowplugin features-openflowplugin - 0.0.3-SNAPSHOT + 0.1.0-SNAPSHOT features xml runtime diff --git a/opendaylight/archetypes/opendaylight-karaf-features/pom.xml b/opendaylight/archetypes/opendaylight-karaf-features/pom.xml index 264402a3b1..12861604e8 100644 --- a/opendaylight/archetypes/opendaylight-karaf-features/pom.xml +++ b/opendaylight/archetypes/opendaylight-karaf-features/pom.xml @@ -5,11 +5,11 @@ org.opendaylight.controller.archetypes archetypes-parent - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT org.opendaylight.controller opendaylight-karaf-features-archetype - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT maven-archetype opendaylight-karaf-features-archetype diff --git a/opendaylight/archetypes/opendaylight-karaf-features/src/main/resources/archetype-resources/pom.xml b/opendaylight/archetypes/opendaylight-karaf-features/src/main/resources/archetype-resources/pom.xml index e135e6b656..df35831a90 100644 --- a/opendaylight/archetypes/opendaylight-karaf-features/src/main/resources/archetype-resources/pom.xml +++ b/opendaylight/archetypes/opendaylight-karaf-features/src/main/resources/archetype-resources/pom.xml @@ -24,11 +24,11 @@ features.xml - 1.0.0-SNAPSHOT - 1.4.2-SNAPSHOT + 1.1.0-SNAPSHOT + 1.5.0-SNAPSHOT 3.0.1 - 0.6.2-SNAPSHOT - 1.4.2-SNAPSHOT + 0.7.0-SNAPSHOT + 1.5.0-SNAPSHOT 2.16 @@ -46,21 +46,21 @@ org.opendaylight.yangtools features-yangtools - 0.6.2-SNAPSHOT + 0.7.0-SNAPSHOT features xml org.opendaylight.controller features-mdsal - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT features xml org.opendaylight.openflowplugin features-openflowplugin - 0.0.3-SNAPSHOT + 0.1.0-SNAPSHOT features xml diff --git a/opendaylight/archetypes/opendaylight-karaf-features/src/main/resources/archetype-resources/src/main/resources/features.xml b/opendaylight/archetypes/opendaylight-karaf-features/src/main/resources/archetype-resources/src/main/resources/features.xml index 4a59657431..54bbfe45fc 100644 --- a/opendaylight/archetypes/opendaylight-karaf-features/src/main/resources/archetype-resources/src/main/resources/features.xml +++ b/opendaylight/archetypes/opendaylight-karaf-features/src/main/resources/archetype-resources/src/main/resources/features.xml @@ -21,9 +21,9 @@ Necessary TODO: Add repo entries for the repositories of features you refer to in this feature file but do not define here. Examples: - mvn:org.opendaylight.yangtools/features-yangtools/0.6.2-SNAPSHOT/xml/features - mvn:org.opendaylight.controller/features-mdsal/1.1-SNAPSHOT/xml/features - mvn:org.opendaylight.openflowplugin/features-openflowplugin/0.0.3-SNAPSHOT/xml/features + mvn:org.opendaylight.yangtools/features-yangtools/0.7.0-SNAPSHOT/xml/features + mvn:org.opendaylight.controller/features-mdsal/1.2.0-SNAPSHOT/xml/features + mvn:org.opendaylight.openflowplugin/features-openflowplugin/0.1.0-SNAPSHOT/xml/features --> diff --git a/opendaylight/arphandler/pom.xml b/opendaylight/arphandler/pom.xml index 064d04c25c..ffd528beb0 100644 --- a/opendaylight/arphandler/pom.xml +++ b/opendaylight/arphandler/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../commons/opendaylight arphandler - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT bundle diff --git a/opendaylight/clustering/integrationtest/pom.xml b/opendaylight/clustering/integrationtest/pom.xml index 62c182c3b9..fecf4f8034 100644 --- a/opendaylight/clustering/integrationtest/pom.xml +++ b/opendaylight/clustering/integrationtest/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.integrationtest - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ../../commons/integrationtest clustering.services.integrationtest - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT ../implementation/target/jacoco-it.exec diff --git a/opendaylight/clustering/services/pom.xml b/opendaylight/clustering/services/pom.xml index 3ff6bac21f..8c66e70cbe 100644 --- a/opendaylight/clustering/services/pom.xml +++ b/opendaylight/clustering/services/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight clustering.services - 0.5.1-SNAPSHOT + 0.6.0-SNAPSHOT bundle diff --git a/opendaylight/clustering/services_implementation/pom.xml b/opendaylight/clustering/services_implementation/pom.xml index 8d3f53b6c4..f11f7a14c0 100644 --- a/opendaylight/clustering/services_implementation/pom.xml +++ b/opendaylight/clustering/services_implementation/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight clustering.services-implementation - 0.4.3-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/clustering/stub/pom.xml b/opendaylight/clustering/stub/pom.xml index 6a0b3082fb..211dcc29d0 100644 --- a/opendaylight/clustering/stub/pom.xml +++ b/opendaylight/clustering/stub/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight clustering.stub - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/clustering/test/pom.xml b/opendaylight/clustering/test/pom.xml index 9021c9419e..93294f2290 100644 --- a/opendaylight/clustering/test/pom.xml +++ b/opendaylight/clustering/test/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight clustering.test - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/commons/checkstyle/pom.xml b/opendaylight/commons/checkstyle/pom.xml index 55567af437..fee517f08b 100644 --- a/opendaylight/commons/checkstyle/pom.xml +++ b/opendaylight/commons/checkstyle/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.opendaylight.controller checkstyle - 0.0.3-SNAPSHOT + 0.1.0-SNAPSHOT scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git diff --git a/opendaylight/commons/concepts/pom.xml b/opendaylight/commons/concepts/pom.xml index 01dd61a1cb..fa97e5fcac 100644 --- a/opendaylight/commons/concepts/pom.xml +++ b/opendaylight/commons/concepts/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight concepts - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT bundle @@ -43,7 +43,7 @@ org.opendaylight.controller checkstyle - 0.0.3-SNAPSHOT + 0.1.0-SNAPSHOT diff --git a/opendaylight/commons/filter-valve/pom.xml b/opendaylight/commons/filter-valve/pom.xml index 7b5be02514..012b4a2529 100644 --- a/opendaylight/commons/filter-valve/pom.xml +++ b/opendaylight/commons/filter-valve/pom.xml @@ -11,7 +11,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../opendaylight filter-valve diff --git a/opendaylight/commons/httpclient/pom.xml b/opendaylight/commons/httpclient/pom.xml index 07d3cdda96..39364cbcba 100644 --- a/opendaylight/commons/httpclient/pom.xml +++ b/opendaylight/commons/httpclient/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight commons.httpclient - 0.1.2-SNAPSHOT + 0.2.0-SNAPSHOT bundle @@ -71,7 +71,7 @@ org.opendaylight.controller checkstyle - 0.0.3-SNAPSHOT + 0.1.0-SNAPSHOT diff --git a/opendaylight/commons/integrationtest/pom.xml b/opendaylight/commons/integrationtest/pom.xml index 315611f647..ad4e166cbd 100644 --- a/opendaylight/commons/integrationtest/pom.xml +++ b/opendaylight/commons/integrationtest/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight commons.integrationtest - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom @@ -89,7 +89,7 @@ org.opendaylight.controller checkstyle - 0.0.3-SNAPSHOT + 0.1.0-SNAPSHOT diff --git a/opendaylight/commons/liblldp/pom.xml b/opendaylight/commons/liblldp/pom.xml index 1551041edb..148a4f3792 100644 --- a/opendaylight/commons/liblldp/pom.xml +++ b/opendaylight/commons/liblldp/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../opendaylight liblldp - 0.8.1-SNAPSHOT + 0.9.0-SNAPSHOT bundle diff --git a/opendaylight/commons/logback_settings/pom.xml b/opendaylight/commons/logback_settings/pom.xml index 11a7ffbd0e..f98b7a3a7a 100644 --- a/opendaylight/commons/logback_settings/pom.xml +++ b/opendaylight/commons/logback_settings/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.parent - 1.0.2-SNAPSHOT + 1.1.0-SNAPSHOT ../parent commons.logback_settings - 0.0.2-SNAPSHOT + 0.1.0-SNAPSHOT scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git diff --git a/opendaylight/commons/opendaylight/pom.xml b/opendaylight/commons/opendaylight/pom.xml index a98afc8d19..77fad0a9f7 100644 --- a/opendaylight/commons/opendaylight/pom.xml +++ b/opendaylight/commons/opendaylight/pom.xml @@ -4,13 +4,13 @@ org.opendaylight.odlparent odlparent - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT pom 3.0 @@ -20,24 +20,24 @@ 2.3.4 1.0.0 - 0.4.2-SNAPSHOT - 0.0.1-SNAPSHOT + 0.5.0-SNAPSHOT + 0.1.0-SNAPSHOT 1.1.0 - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT 4.1 1.50 2.4.0 - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT 2.12 - 0.5.1-SNAPSHOT - 0.4.3-SNAPSHOT - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT + 0.6.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT 3.0.1 @@ -51,23 +51,23 @@ 7.0.53.v201406060720 7.0.53.v201406070630 - 0.0.3-SNAPSHOT + 0.1.0-SNAPSHOT 1.2.2 - 0.1.2-SNAPSHOT + 0.2.0-SNAPSHOT 2.4 3.1 - 0.0.2-SNAPSHOT + 0.1.0-SNAPSHOT 3.0.1 - 0.1.2-SNAPSHOT - 0.5.2-SNAPSHOT - 1.4.2-SNAPSHOT - 1.0.2-SNAPSHOT + 0.2.0-SNAPSHOT + 0.6.0-SNAPSHOT + 1.5.0-SNAPSHOT + 1.1.0-SNAPSHOT 2.3.2 - 0.1.2-SNAPSHOT - 0.5.2-SNAPSHOT + 0.2.0-SNAPSHOT + 0.6.0-SNAPSHOT 1.4 - 0.2.5-SNAPSHOT - 0.1.0-SNAPSHOT + 0.3.0-SNAPSHOT + 0.2.0-SNAPSHOT etc/opendaylight/karaf 05-clustering.xml 00-netty.xml @@ -77,16 +77,16 @@ 03-toaster-sample.xml 10-rest-connector.xml 99-netconf-connector.xml - 0.4.3-SNAPSHOT - 0.4.3-SNAPSHOT - 0.1.2-SNAPSHOT - 0.5.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.5.2-SNAPSHOT - 0.5.2-SNAPSHOT - 0.0.2-SNAPSHOT - 0.4.2-SNAPSHOT - 1.1.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.2.0-SNAPSHOT + 0.6.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.6.0-SNAPSHOT + 0.6.0-SNAPSHOT + 0.1.0-SNAPSHOT + 0.5.0-SNAPSHOT + 1.2.0-SNAPSHOT 2.5.0 3.8.0.I20120518-2145 @@ -98,78 +98,78 @@ 0000.0002.0038.0 1.6.0 - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT 2.4.0 - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.5.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.6.0-SNAPSHOT - 1.1-SNAPSHOT - 0.5.2-SNAPSHOT - 0.5.2-SNAPSHOT - 0.4.2-SNAPSHOT - 1.0.0-SNAPSHOT - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.0.2-SNAPSHOT - 2010.09.24.4-SNAPSHOT - 2013.10.19.1-SNAPSHOT - 2013.10.21.2-SNAPSHOT - 2010.09.24.4-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.6.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.7.0-SNAPSHOT + 1.2.0-SNAPSHOT + 0.6.0-SNAPSHOT + 0.6.0-SNAPSHOT + 0.5.0-SNAPSHOT + 1.1.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.1.0-SNAPSHOT + 2010.09.24.7-SNAPSHOT + 2013.10.19.7-SNAPSHOT + 2013.10.21.7-SNAPSHOT + 2010.09.24.7-SNAPSHOT 2.0-beta-2 src/main/yang-gen-config - 0.0.2-SNAPSHOT + 0.1.0-SNAPSHOT 1.1.4 2.0.1 1.1.1 2.0 - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT 3.0.0 3.0.1 0.7 1.8 1.0.0 1.0.9 - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT 3.0.5 1.9.4 - 1.1-SNAPSHOT - 0.2.5-SNAPSHOT - 0.0.3-SNAPSHOT - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT + 1.2.0-SNAPSHOT + 0.3.0-SNAPSHOT + 0.1.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT http://nexus.opendaylight.org/content - 0.4.2-SNAPSHOT - 1.4.2-SNAPSHOT - 1.4.2-SNAPSHOT - 2013.08.27.4-SNAPSHOT - 0.0.2-SNAPSHOT + 0.5.0-SNAPSHOT + 1.5.0-SNAPSHOT + 1.5.0-SNAPSHOT + 2013.08.27.7-SNAPSHOT + 0.1.0-SNAPSHOT 4.0.0 1.1.6 1.1.6 1.0-alpha-2 2.5.0 - 0.5.0-SNAPSHOT - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.1.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.0.3-SNAPSHOT - 0.8.1-SNAPSHOT + 0.6.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.2.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.1.0-SNAPSHOT + 0.9.0-SNAPSHOT src/main/yang-gen-sal - 0.5.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT + 0.6.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT 2.10 4 - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT 1.2.4 dav:http://nexus.opendaylight.org/content/sites/site ${user.name}-private-view @@ -187,31 +187,31 @@ 3.1.4.RELEASE 3.1.3.RELEASE 3.1.3.RELEASE - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.5.1-SNAPSHOT - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.6.0-SNAPSHOT + 0.5.0-SNAPSHOT 2.15 - 0.7.1-SNAPSHOT - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT + 0.8.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT -Xmx1024m -XX:MaxPermSize=256m - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT - 1.0.0-SNAPSHOT - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT + 1.1.0-SNAPSHOT + 0.5.0-SNAPSHOT 1.2.0 1.2.2a - 0.4.2-SNAPSHOT - 0.0.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT + 0.1.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT + 0.5.0-SNAPSHOT src/main/xtend-gen - 2013.09.07.4-SNAPSHOT - 1.0.0-SNAPSHOT - 0.6.2-SNAPSHOT + 2013.09.07.7-SNAPSHOT + 1.1.0-SNAPSHOT + 0.7.0-SNAPSHOT 0.12.0 0.9.7 @@ -1035,12 +1035,12 @@ org.opendaylight.controller httpservice-bridge - 0.0.2-SNAPSHOT + 0.1.0-SNAPSHOT org.opendaylight.controller jolokia-bridge - 0.0.2-SNAPSHOT + 0.1.0-SNAPSHOT @@ -1858,7 +1858,7 @@ org.opendaylight.yangtools.model ietf-yang-types-20130715 - 2013.07.15.1-SNAPSHOT + 2013.07.15.7-SNAPSHOT org.opendaylight.yangtools.model @@ -1934,7 +1934,7 @@ org.opendaylight.controller commons.logback_settings - 0.0.2-SNAPSHOT + 0.1.0-SNAPSHOT test @@ -2157,7 +2157,7 @@ org.opendaylight.controller commons.logback_settings - 0.0.2-SNAPSHOT + 0.1.0-SNAPSHOT @@ -2408,7 +2408,7 @@ org.opendaylight.controller checkstyle - 0.0.3-SNAPSHOT + 0.1.0-SNAPSHOT diff --git a/opendaylight/commons/parent/pom.xml b/opendaylight/commons/parent/pom.xml index 67d1cb419b..cbd6efaef8 100644 --- a/opendaylight/commons/parent/pom.xml +++ b/opendaylight/commons/parent/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.opendaylight.controller commons.parent - 1.0.2-SNAPSHOT + 1.1.0-SNAPSHOT pom 3.0 diff --git a/opendaylight/commons/protocol-framework/pom.xml b/opendaylight/commons/protocol-framework/pom.xml index 774bc7c23f..00f7b3179b 100644 --- a/opendaylight/commons/protocol-framework/pom.xml +++ b/opendaylight/commons/protocol-framework/pom.xml @@ -6,12 +6,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight protocol-framework - 0.5.0-SNAPSHOT + 0.6.0-SNAPSHOT bundle ${project.artifactId} Common protocol framework diff --git a/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractSessionNegotiator.java b/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractSessionNegotiator.java index cbe9235245..2ecd267b9f 100644 --- a/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractSessionNegotiator.java +++ b/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractSessionNegotiator.java @@ -46,7 +46,7 @@ public abstract class AbstractSessionNegotiator org.opendaylight.controller config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT config-api diff --git a/opendaylight/config/config-manager/pom.xml b/opendaylight/config/config-manager/pom.xml index c98a47660e..3ebffc65a2 100644 --- a/opendaylight/config/config-manager/pom.xml +++ b/opendaylight/config/config-manager/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT .. config-manager diff --git a/opendaylight/config/config-module-archetype/pom.xml b/opendaylight/config/config-module-archetype/pom.xml index 57d18e2f62..3e9162eb36 100644 --- a/opendaylight/config/config-module-archetype/pom.xml +++ b/opendaylight/config/config-module-archetype/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT config-module-archetype diff --git a/opendaylight/config/config-netty-config/pom.xml b/opendaylight/config/config-netty-config/pom.xml index 8dc31dcc4e..257c36779c 100644 --- a/opendaylight/config/config-netty-config/pom.xml +++ b/opendaylight/config/config-netty-config/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.controller config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT config-netty-config Configuration files for sal-rest-connector diff --git a/opendaylight/config/config-persister-api/pom.xml b/opendaylight/config/config-persister-api/pom.xml index 2899acf5df..f83beb0c8b 100644 --- a/opendaylight/config/config-persister-api/pom.xml +++ b/opendaylight/config/config-persister-api/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT .. config-persister-api diff --git a/opendaylight/config/config-persister-directory-xml-adapter/pom.xml b/opendaylight/config/config-persister-directory-xml-adapter/pom.xml index 0cbc0a1db9..302b13fdf9 100644 --- a/opendaylight/config/config-persister-directory-xml-adapter/pom.xml +++ b/opendaylight/config/config-persister-directory-xml-adapter/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT .. config-persister-directory-xml-adapter diff --git a/opendaylight/config/config-persister-feature-adapter/pom.xml b/opendaylight/config/config-persister-feature-adapter/pom.xml index 7412a51425..d7d7889bf9 100644 --- a/opendaylight/config/config-persister-feature-adapter/pom.xml +++ b/opendaylight/config/config-persister-feature-adapter/pom.xml @@ -6,7 +6,7 @@ org.opendaylight.controller config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT .. diff --git a/opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/ConfigFeaturesListener.java b/opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/ConfigFeaturesListener.java index f5f1b856ac..b8f18960d1 100644 --- a/opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/ConfigFeaturesListener.java +++ b/opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/ConfigFeaturesListener.java @@ -20,7 +20,7 @@ import org.slf4j.LoggerFactory; public class ConfigFeaturesListener implements FeaturesListener, AutoCloseable { private static final Logger logger = LoggerFactory.getLogger(ConfigFeaturesListener.class); - private static final int QUEUE_SIZE = 100; + private static final int QUEUE_SIZE = 1000; private BlockingQueue queue = new LinkedBlockingQueue(QUEUE_SIZE); Thread pushingThread = null; diff --git a/opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/FeatureConfigPusher.java b/opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/FeatureConfigPusher.java index 57052f9d60..17099f9d33 100644 --- a/opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/FeatureConfigPusher.java +++ b/opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/FeatureConfigPusher.java @@ -27,6 +27,7 @@ import com.google.common.collect.LinkedHashMultimap; public class FeatureConfigPusher { private static final Logger logger = LoggerFactory.getLogger(FeatureConfigPusher.class); private static final int MAX_RETRIES=100; + private static final int RETRY_PAUSE_MILLIS=1; private FeaturesService featuresService = null; private ConfigPusher pusher = null; /* @@ -83,30 +84,30 @@ public class FeatureConfigPusher { } private boolean isInstalled(Feature feature) { - List installedFeatures= null; - boolean cont = true; - int retries = 0; - while(cont) { + for(int retries=0;retries installedFeatures = Arrays.asList(featuresService.listInstalledFeatures()); + if(installedFeatures.contains(feature)) { + return true; + } else { + logger.warn("Karaf featuresService.listInstalledFeatures() has not yet finished installing feature (retry {}) {} {}",retries,feature.getName(),feature.getVersion()); + } } catch (Exception e) { if(retries < MAX_RETRIES) { logger.warn("Karaf featuresService.listInstalledFeatures() has thrown an exception, retry {}, Exception {}", retries,e); - try { - Thread.sleep(1); - } catch (InterruptedException e1) { - throw new IllegalStateException(e1); - } - retries++; - continue; } else { logger.error("Giving up on Karaf featuresService.listInstalledFeatures() which has thrown an exception, retry {}, Exception {}", retries,e); throw e; } } + try { + Thread.sleep(RETRY_PAUSE_MILLIS); + } catch (InterruptedException e1) { + throw new IllegalStateException(e1); + } } - return installedFeatures.contains(feature); + logger.error("Giving up (after {} retries) on Karaf featuresService.listInstalledFeatures() which has not yet finished installing feature {} {}",MAX_RETRIES,feature.getName(),feature.getVersion()); + return false; } private LinkedHashSet pushConfig(LinkedHashSet configs) throws InterruptedException { diff --git a/opendaylight/config/config-persister-file-xml-adapter/pom.xml b/opendaylight/config/config-persister-file-xml-adapter/pom.xml index d8c81ea971..35df9e1999 100644 --- a/opendaylight/config/config-persister-file-xml-adapter/pom.xml +++ b/opendaylight/config/config-persister-file-xml-adapter/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT .. config-persister-file-xml-adapter diff --git a/opendaylight/config/config-plugin-parent/pom.xml b/opendaylight/config/config-plugin-parent/pom.xml index e66a4cfd3f..67370e1e2f 100644 --- a/opendaylight/config/config-plugin-parent/pom.xml +++ b/opendaylight/config/config-plugin-parent/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../ config-plugin-parent diff --git a/opendaylight/config/config-util/pom.xml b/opendaylight/config/config-util/pom.xml index 29a5526451..6a5950dc7e 100644 --- a/opendaylight/config/config-util/pom.xml +++ b/opendaylight/config/config-util/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT .. config-util diff --git a/opendaylight/config/logback-config-loader/pom.xml b/opendaylight/config/logback-config-loader/pom.xml index 03ff65f662..0f379fbe21 100644 --- a/opendaylight/config/logback-config-loader/pom.xml +++ b/opendaylight/config/logback-config-loader/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller config-plugin-parent - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../config-plugin-parent logback-config-loader diff --git a/opendaylight/config/logback-config/pom.xml b/opendaylight/config/logback-config/pom.xml index 0fd62aa427..d918fd7ab7 100644 --- a/opendaylight/config/logback-config/pom.xml +++ b/opendaylight/config/logback-config/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller config-plugin-parent - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../config-plugin-parent logback-config diff --git a/opendaylight/config/netconf-config-dispatcher/pom.xml b/opendaylight/config/netconf-config-dispatcher/pom.xml index 1e5fcce609..0e0ec9372c 100644 --- a/opendaylight/config/netconf-config-dispatcher/pom.xml +++ b/opendaylight/config/netconf-config-dispatcher/pom.xml @@ -11,7 +11,7 @@ org.opendaylight.controller config-plugin-parent - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../config-plugin-parent diff --git a/opendaylight/config/netty-config-api/pom.xml b/opendaylight/config/netty-config-api/pom.xml index ca1e28e14c..a5c0831fb8 100644 --- a/opendaylight/config/netty-config-api/pom.xml +++ b/opendaylight/config/netty-config-api/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller config-plugin-parent - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../config-plugin-parent netty-config-api diff --git a/opendaylight/config/netty-event-executor-config/pom.xml b/opendaylight/config/netty-event-executor-config/pom.xml index b001dc76f7..6188aed898 100644 --- a/opendaylight/config/netty-event-executor-config/pom.xml +++ b/opendaylight/config/netty-event-executor-config/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller config-plugin-parent - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../config-plugin-parent netty-event-executor-config diff --git a/opendaylight/config/netty-threadgroup-config/pom.xml b/opendaylight/config/netty-threadgroup-config/pom.xml index 8c86ca8354..2f3d26dd2f 100644 --- a/opendaylight/config/netty-threadgroup-config/pom.xml +++ b/opendaylight/config/netty-threadgroup-config/pom.xml @@ -7,7 +7,7 @@ org.opendaylight.controller config-plugin-parent - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../config-plugin-parent netty-threadgroup-config diff --git a/opendaylight/config/netty-timer-config/pom.xml b/opendaylight/config/netty-timer-config/pom.xml index 6b3ecdbceb..75b4709da2 100644 --- a/opendaylight/config/netty-timer-config/pom.xml +++ b/opendaylight/config/netty-timer-config/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller config-plugin-parent - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../config-plugin-parent netty-timer-config diff --git a/opendaylight/config/pom.xml b/opendaylight/config/pom.xml index b8ad26116a..ea7b243179 100644 --- a/opendaylight/config/pom.xml +++ b/opendaylight/config/pom.xml @@ -5,12 +5,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../commons/opendaylight config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT pom ${project.artifactId} @@ -193,9 +193,21 @@ ${project.build.directory}/jacoco false - - 80 - + + + CLASS + + *Test + + + + LINE + COVEREDRATIO + 0.50 + + + + diff --git a/opendaylight/config/shutdown-api/pom.xml b/opendaylight/config/shutdown-api/pom.xml index 76c1cfdc54..659052e570 100644 --- a/opendaylight/config/shutdown-api/pom.xml +++ b/opendaylight/config/shutdown-api/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-plugin-parent - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../config-plugin-parent shutdown-api diff --git a/opendaylight/config/shutdown-impl/pom.xml b/opendaylight/config/shutdown-impl/pom.xml index 9895022df6..f14c285323 100644 --- a/opendaylight/config/shutdown-impl/pom.xml +++ b/opendaylight/config/shutdown-impl/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-plugin-parent - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../config-plugin-parent shutdown-impl diff --git a/opendaylight/config/threadpool-config-api/pom.xml b/opendaylight/config/threadpool-config-api/pom.xml index c9a19515ef..5f0c941a19 100644 --- a/opendaylight/config/threadpool-config-api/pom.xml +++ b/opendaylight/config/threadpool-config-api/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller config-plugin-parent - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../config-plugin-parent threadpool-config-api diff --git a/opendaylight/config/threadpool-config-impl/pom.xml b/opendaylight/config/threadpool-config-impl/pom.xml index 4fd0d681a1..2787b30df4 100644 --- a/opendaylight/config/threadpool-config-impl/pom.xml +++ b/opendaylight/config/threadpool-config-impl/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller config-plugin-parent - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../config-plugin-parent threadpool-config-impl diff --git a/opendaylight/config/yang-jmx-generator-it/pom.xml b/opendaylight/config/yang-jmx-generator-it/pom.xml index f9e0c7036a..6d2663ced5 100644 --- a/opendaylight/config/yang-jmx-generator-it/pom.xml +++ b/opendaylight/config/yang-jmx-generator-it/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT yang-jmx-generator-it diff --git a/opendaylight/config/yang-jmx-generator-plugin/pom.xml b/opendaylight/config/yang-jmx-generator-plugin/pom.xml index 5f51980b94..6c8a591bb8 100644 --- a/opendaylight/config/yang-jmx-generator-plugin/pom.xml +++ b/opendaylight/config/yang-jmx-generator-plugin/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT .. yang-jmx-generator-plugin diff --git a/opendaylight/config/yang-jmx-generator/pom.xml b/opendaylight/config/yang-jmx-generator/pom.xml index 133b07ff86..979b39688b 100644 --- a/opendaylight/config/yang-jmx-generator/pom.xml +++ b/opendaylight/config/yang-jmx-generator/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../ diff --git a/opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/ModuleMXBeanEntryNameConflictTest.java b/opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/ModuleMXBeanEntryNameConflictTest.java index 9032a2c930..cac0ac705f 100644 --- a/opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/ModuleMXBeanEntryNameConflictTest.java +++ b/opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/ModuleMXBeanEntryNameConflictTest.java @@ -19,6 +19,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.junit.Ignore; import org.junit.Test; import org.opendaylight.controller.config.yangjmxgenerator.plugin.util.NameConflictException; import org.opendaylight.controller.config.yangjmxgenerator.plugin.util.YangModelSearchUtils; @@ -40,6 +41,7 @@ public class ModuleMXBeanEntryNameConflictTest extends AbstractYangTest { Map testedFilesToYangModules = new HashMap<>(); Map testedYangModulesToExpectedConflictingName = new HashMap<>(); + @Ignore @Test public void testNameConflicts() throws Exception { prepareSamples(); diff --git a/opendaylight/config/yang-jmx-generator/src/test/resources/config-jmx-it-impl.yang b/opendaylight/config/yang-jmx-generator/src/test/resources/config-jmx-it-impl.yang index 16085efbba..0cd0d15ad2 100644 --- a/opendaylight/config/yang-jmx-generator/src/test/resources/config-jmx-it-impl.yang +++ b/opendaylight/config/yang-jmx-generator/src/test/resources/config-jmx-it-impl.yang @@ -49,7 +49,7 @@ module config-jmx-it-impl { } - leaf simpleInt { + leaf simpleInt1 { type uint32; default 99L; } @@ -87,7 +87,7 @@ module config-jmx-it-impl { } } - leaf simpleInt { + leaf simpleInt2 { type uint32; } @@ -202,7 +202,7 @@ module config-jmx-it-impl { case impl-netconf { when "/config:modules/config:module/config:type = 'impl-netconf'"; // root runtime bean - leaf created-sessions { + leaf created-sessions-1 { type uint32; } diff --git a/opendaylight/config/yang-jmx-generator/src/test/resources/duplicates/config-test-duplicate-attribute-in-list.yang b/opendaylight/config/yang-jmx-generator/src/test/resources/duplicates/config-test-duplicate-attribute-in-list.yang index 4901b41157..97fca03877 100644 --- a/opendaylight/config/yang-jmx-generator/src/test/resources/duplicates/config-test-duplicate-attribute-in-list.yang +++ b/opendaylight/config/yang-jmx-generator/src/test/resources/duplicates/config-test-duplicate-attribute-in-list.yang @@ -75,7 +75,7 @@ module config-test-duplicate-attribute-in-list { case netconf { when "/config:modules/config:module/config:type = 'netconf'"; // root runtime bean - leaf created-sessions { + leaf created-sessions2 { type uint32; } diff --git a/opendaylight/config/yang-jmx-generator/src/test/resources/duplicates/config-test-duplicate-attribute.yang b/opendaylight/config/yang-jmx-generator/src/test/resources/duplicates/config-test-duplicate-attribute.yang index bf081028cc..d2d4dc534d 100644 --- a/opendaylight/config/yang-jmx-generator/src/test/resources/duplicates/config-test-duplicate-attribute.yang +++ b/opendaylight/config/yang-jmx-generator/src/test/resources/duplicates/config-test-duplicate-attribute.yang @@ -56,7 +56,7 @@ module config-test-duplicate-attribute { case netconf { when "/config:modules/config:module/config:type = 'netconf'"; - container dto-a { + container dto-a2 { leaf simple-arg { type uint32; } @@ -72,7 +72,7 @@ module config-test-duplicate-attribute { case netconf { when "/config:modules/config:module/config:type = 'netconf'"; // root runtime bean - leaf created-sessions { + leaf created-sessions2 { type uint32; } diff --git a/opendaylight/config/yang-jmx-generator/src/test/resources/test-config-files.yang b/opendaylight/config/yang-jmx-generator/src/test/resources/test-config-files.yang index 1db0279506..f6a0b888bd 100644 --- a/opendaylight/config/yang-jmx-generator/src/test/resources/test-config-files.yang +++ b/opendaylight/config/yang-jmx-generator/src/test/resources/test-config-files.yang @@ -62,7 +62,7 @@ module test-config-files { case netconf { when "/config:modules/config:module/config:type = 'netconf'"; // root runtime bean - leaf created-sessions { + leaf created-sessions2 { type uint32; } diff --git a/opendaylight/config/yang-jmx-generator/src/test/resources/test-config-files1.yang b/opendaylight/config/yang-jmx-generator/src/test/resources/test-config-files1.yang index 0a152e7baa..fc0e0730df 100644 --- a/opendaylight/config/yang-jmx-generator/src/test/resources/test-config-files1.yang +++ b/opendaylight/config/yang-jmx-generator/src/test/resources/test-config-files1.yang @@ -62,7 +62,7 @@ module test-config-files1 { case netconf1 { when "/config:modules/config:module/config:type = 'netconf1'"; // root runtime bean - leaf created-sessions { + leaf created-sessions2 { type uint32; } diff --git a/opendaylight/config/yang-test-plugin/pom.xml b/opendaylight/config/yang-test-plugin/pom.xml index c7fb73f385..d03cff305b 100644 --- a/opendaylight/config/yang-test-plugin/pom.xml +++ b/opendaylight/config/yang-test-plugin/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller config-plugin-parent - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../config-plugin-parent yang-test-plugin diff --git a/opendaylight/config/yang-test/pom.xml b/opendaylight/config/yang-test/pom.xml index 247b3c0745..5977325574 100644 --- a/opendaylight/config/yang-test/pom.xml +++ b/opendaylight/config/yang-test/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller config-plugin-parent - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../config-plugin-parent diff --git a/opendaylight/configuration/api/pom.xml b/opendaylight/configuration/api/pom.xml index ef27bfd5e4..50f19278c6 100644 --- a/opendaylight/configuration/api/pom.xml +++ b/opendaylight/configuration/api/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight configuration - 0.4.3-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/configuration/implementation/pom.xml b/opendaylight/configuration/implementation/pom.xml index a4a7ba6746..4387de70ea 100644 --- a/opendaylight/configuration/implementation/pom.xml +++ b/opendaylight/configuration/implementation/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight configuration.implementation - 0.4.3-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/configuration/integrationtest/pom.xml b/opendaylight/configuration/integrationtest/pom.xml index 31b9c07674..238ff12249 100644 --- a/opendaylight/configuration/integrationtest/pom.xml +++ b/opendaylight/configuration/integrationtest/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.integrationtest - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ../../commons/integrationtest configuration.integrationtest - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT ch.qos.logback diff --git a/opendaylight/connectionmanager/api/pom.xml b/opendaylight/connectionmanager/api/pom.xml index c4ced042d0..2718ed1afe 100644 --- a/opendaylight/connectionmanager/api/pom.xml +++ b/opendaylight/connectionmanager/api/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight connectionmanager - 0.1.2-SNAPSHOT + 0.2.0-SNAPSHOT bundle diff --git a/opendaylight/connectionmanager/implementation/pom.xml b/opendaylight/connectionmanager/implementation/pom.xml index 8be119d507..fe2514e58a 100644 --- a/opendaylight/connectionmanager/implementation/pom.xml +++ b/opendaylight/connectionmanager/implementation/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight connectionmanager.implementation - 0.1.2-SNAPSHOT + 0.2.0-SNAPSHOT bundle diff --git a/opendaylight/containermanager/api/pom.xml b/opendaylight/containermanager/api/pom.xml index a19e27189a..c9b54a1b6c 100644 --- a/opendaylight/containermanager/api/pom.xml +++ b/opendaylight/containermanager/api/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight containermanager - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT bundle diff --git a/opendaylight/containermanager/implementation/pom.xml b/opendaylight/containermanager/implementation/pom.xml index 3ead8be65a..013cd62576 100644 --- a/opendaylight/containermanager/implementation/pom.xml +++ b/opendaylight/containermanager/implementation/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight containermanager.implementation - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT bundle diff --git a/opendaylight/containermanager/it.implementation/pom.xml b/opendaylight/containermanager/it.implementation/pom.xml index a3f140d7e1..8e0475d4a3 100644 --- a/opendaylight/containermanager/it.implementation/pom.xml +++ b/opendaylight/containermanager/it.implementation/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight containermanager.it.implementation - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT bundle diff --git a/opendaylight/containermanager/shell/pom.xml b/opendaylight/containermanager/shell/pom.xml index 1eedd4bc87..c1c2d2055b 100644 --- a/opendaylight/containermanager/shell/pom.xml +++ b/opendaylight/containermanager/shell/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight containermanager.shell diff --git a/opendaylight/distribution/opendaylight-karaf-empty/pom.xml b/opendaylight/distribution/opendaylight-karaf-empty/pom.xml index d3dfe19c2b..72eaf005ad 100644 --- a/opendaylight/distribution/opendaylight-karaf-empty/pom.xml +++ b/opendaylight/distribution/opendaylight-karaf-empty/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight opendaylight-karaf-empty diff --git a/opendaylight/distribution/opendaylight-karaf-resources/pom.xml b/opendaylight/distribution/opendaylight-karaf-resources/pom.xml index e34a5d3c2c..35aac09339 100644 --- a/opendaylight/distribution/opendaylight-karaf-resources/pom.xml +++ b/opendaylight/distribution/opendaylight-karaf-resources/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight opendaylight-karaf-resources diff --git a/opendaylight/distribution/opendaylight-karaf/pom.xml b/opendaylight/distribution/opendaylight-karaf/pom.xml index 795f68c397..1612f34343 100644 --- a/opendaylight/distribution/opendaylight-karaf/pom.xml +++ b/opendaylight/distribution/opendaylight-karaf/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight distribution.opendaylight-karaf @@ -58,18 +58,21 @@ features-base features xml + runtime org.opendaylight.controller features-adsal features xml + runtime org.opendaylight.controller features-nsf features xml + runtime @@ -77,12 +80,22 @@ features-mdsal features xml + runtime org.opendaylight.controller features-flow features xml + runtime + + + org.opendaylight.controller + features-restconf + 1.2.0-SNAPSHOT + features + xml + runtime diff --git a/opendaylight/distribution/opendaylight/pom.xml b/opendaylight/distribution/opendaylight/pom.xml index fcb452f422..e30ff05bf0 100644 --- a/opendaylight/distribution/opendaylight/pom.xml +++ b/opendaylight/distribution/opendaylight/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight distribution.opendaylight - 0.1.2-SNAPSHOT + 0.2.0-SNAPSHOT pom 3.0 @@ -1020,7 +1020,7 @@ org.opendaylight.controller sal-inmemory-datastore - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT org.opendaylight.controller @@ -1133,7 +1133,7 @@ org.opendaylight.controller.model model-topology - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT @@ -1316,6 +1316,41 @@ org.opendaylight.controller sal-clustering-config + + org.eclipse.jetty + jetty-servlets + 8.1.14.v20131031 + + + org.eclipse.jetty + jetty-client + 8.1.14.v20131031 + + + org.eclipse.jetty + jetty-continuation + 8.1.14.v20131031 + + + org.eclipse.jetty + jetty-util + 8.1.14.v20131031 + + + org.eclipse.jetty + jetty-server + 8.1.14.v20131031 + + + org.eclipse.jetty + jetty-io + 8.1.14.v20131031 + + + org.eclipse.jetty + jetty-http + 8.1.14.v20131031 + @@ -1412,7 +1447,7 @@ org.opendaylight.controller swagger-ui - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT diff --git a/opendaylight/distribution/p2site/pom.xml b/opendaylight/distribution/p2site/pom.xml index 78661d8df2..5a66a6191b 100644 --- a/opendaylight/distribution/p2site/pom.xml +++ b/opendaylight/distribution/p2site/pom.xml @@ -14,7 +14,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.0-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight @@ -32,7 +32,7 @@ org.opendaylight.controller distribution.p2site - 0.1.0-SNAPSHOT + 0.2.0-SNAPSHOT pom diff --git a/opendaylight/distribution/sanitytest/pom.xml b/opendaylight/distribution/sanitytest/pom.xml index 793e835647..9955afa274 100644 --- a/opendaylight/distribution/sanitytest/pom.xml +++ b/opendaylight/distribution/sanitytest/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight sanitytest - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/dummy-console/pom.xml b/opendaylight/dummy-console/pom.xml index 8901c2e0b5..4195e53310 100644 --- a/opendaylight/dummy-console/pom.xml +++ b/opendaylight/dummy-console/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../commons/opendaylight dummy-console - 1.1.0-SNAPSHOT + 1.2.0-SNAPSHOT bundle Dummy Console Interfaces for Equinox-specific CLI diff --git a/opendaylight/forwarding/staticrouting/pom.xml b/opendaylight/forwarding/staticrouting/pom.xml index 37c0a3a09d..b006cece40 100644 --- a/opendaylight/forwarding/staticrouting/pom.xml +++ b/opendaylight/forwarding/staticrouting/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight forwarding.staticrouting - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT bundle diff --git a/opendaylight/forwardingrulesmanager/api/pom.xml b/opendaylight/forwardingrulesmanager/api/pom.xml index b6e1dd68d1..3f667e16f0 100644 --- a/opendaylight/forwardingrulesmanager/api/pom.xml +++ b/opendaylight/forwardingrulesmanager/api/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight forwardingrulesmanager - 0.6.0-SNAPSHOT + 0.7.0-SNAPSHOT bundle diff --git a/opendaylight/forwardingrulesmanager/implementation/pom.xml b/opendaylight/forwardingrulesmanager/implementation/pom.xml index f87bed8780..959b71f855 100644 --- a/opendaylight/forwardingrulesmanager/implementation/pom.xml +++ b/opendaylight/forwardingrulesmanager/implementation/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight forwardingrulesmanager.implementation - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/forwardingrulesmanager/integrationtest/pom.xml b/opendaylight/forwardingrulesmanager/integrationtest/pom.xml index ff0bfcc1ef..60b934a492 100644 --- a/opendaylight/forwardingrulesmanager/integrationtest/pom.xml +++ b/opendaylight/forwardingrulesmanager/integrationtest/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.integrationtest - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ../../commons/integrationtest forwardingrulesmanager.integrationtest - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT ../implementation/target/jacoco-it.exec diff --git a/opendaylight/hosttracker/api/pom.xml b/opendaylight/hosttracker/api/pom.xml index b48d7abd72..10532baa6e 100644 --- a/opendaylight/hosttracker/api/pom.xml +++ b/opendaylight/hosttracker/api/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight hosttracker - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT bundle diff --git a/opendaylight/hosttracker/implementation/pom.xml b/opendaylight/hosttracker/implementation/pom.xml index cb09322b64..370f88defa 100644 --- a/opendaylight/hosttracker/implementation/pom.xml +++ b/opendaylight/hosttracker/implementation/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight hosttracker.implementation - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT bundle diff --git a/opendaylight/hosttracker/integrationtest/pom.xml b/opendaylight/hosttracker/integrationtest/pom.xml index 65fc23265a..dabccf3f71 100644 --- a/opendaylight/hosttracker/integrationtest/pom.xml +++ b/opendaylight/hosttracker/integrationtest/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.integrationtest - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ../../commons/integrationtest hosttracker.integrationtest - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ../implementaiton/target/jacoco-it.exec diff --git a/opendaylight/hosttracker/shell/pom.xml b/opendaylight/hosttracker/shell/pom.xml index 3f73303180..9088ae359b 100644 --- a/opendaylight/hosttracker/shell/pom.xml +++ b/opendaylight/hosttracker/shell/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight hosttracker.shell diff --git a/opendaylight/hosttracker_new/api/pom.xml b/opendaylight/hosttracker_new/api/pom.xml index 240976b9c8..db27345d18 100644 --- a/opendaylight/hosttracker_new/api/pom.xml +++ b/opendaylight/hosttracker_new/api/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight hosttracker_new - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/hosttracker_new/implementation/pom.xml b/opendaylight/hosttracker_new/implementation/pom.xml index 036dd5dd31..d3661a12c8 100644 --- a/opendaylight/hosttracker_new/implementation/pom.xml +++ b/opendaylight/hosttracker_new/implementation/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight hosttracker_new.implementation - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/karaf-branding/.gitignore b/opendaylight/karaf-branding/.gitignore new file mode 100644 index 0000000000..b83d22266a --- /dev/null +++ b/opendaylight/karaf-branding/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/opendaylight/karaf-branding/pom.xml b/opendaylight/karaf-branding/pom.xml index 722bdeaa8d..dfdc3b76cb 100644 --- a/opendaylight/karaf-branding/pom.xml +++ b/opendaylight/karaf-branding/pom.xml @@ -5,12 +5,12 @@ org.opendaylight.controller releasepom - 0.1.2-SNAPSHOT + 0.2.0-SNAPSHOT ../.. org.opendaylight.controller karaf.branding - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT bundle OpenDaylight :: Karaf :: Branding diff --git a/opendaylight/karaf-tomcat-security/pom.xml b/opendaylight/karaf-tomcat-security/pom.xml index 817e0faeec..30d57d048a 100644 --- a/opendaylight/karaf-tomcat-security/pom.xml +++ b/opendaylight/karaf-tomcat-security/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../commons/opendaylight karaf-tomcat-security - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/logging/bridge/pom.xml b/opendaylight/logging/bridge/pom.xml index 82bc6cd9c1..dc37e30179 100644 --- a/opendaylight/logging/bridge/pom.xml +++ b/opendaylight/logging/bridge/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight logging.bridge - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/md-sal/benchmark-data-store/pom.xml b/opendaylight/md-sal/benchmark-data-store/pom.xml index 1af2287a10..ac384319b8 100644 --- a/opendaylight/md-sal/benchmark-data-store/pom.xml +++ b/opendaylight/md-sal/benchmark-data-store/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html sal-parent org.opendaylight.controller - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT 4.0.0 diff --git a/opendaylight/md-sal/compatibility/pom.xml b/opendaylight/md-sal/compatibility/pom.xml index b9e9d19b48..a7da4a1e9c 100644 --- a/opendaylight/md-sal/compatibility/pom.xml +++ b/opendaylight/md-sal/compatibility/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT compatibility-parent pom diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/pom.xml b/opendaylight/md-sal/compatibility/sal-compatibility/pom.xml index 168dd14d10..32014decd5 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/pom.xml +++ b/opendaylight/md-sal/compatibility/sal-compatibility/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller compatibility-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-compatibility bundle diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/AbstractDataChangeListener.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/AbstractDataChangeListener.java new file mode 100644 index 0000000000..2306508759 --- /dev/null +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/AbstractDataChangeListener.java @@ -0,0 +1,146 @@ +/** + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.sal.compatibility; + +import java.util.Collections; +import java.util.Map; +import java.util.Set; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.Optional; +import com.google.common.base.Preconditions; + +public abstract class AbstractDataChangeListener implements AutoCloseable,DataChangeListener{ + + private static final Logger LOG = LoggerFactory.getLogger(AbstractDataChangeListener.class); + protected InventoryAndReadAdapter adapter; + protected final Class clazz; + protected ListenerRegistration listenerRegistration; + + public AbstractDataChangeListener(final InventoryAndReadAdapter adapter, DataBroker db, final Class clazz) { + this.adapter = Preconditions.checkNotNull(adapter, "InventoryAndReadAdapter can not be null!"); + this.clazz = Preconditions.checkNotNull(clazz, "Class can not be null!"); + Preconditions.checkNotNull(db, "DataBroker can not be null!"); + registrationListener(db, 5); + } + + @Override + public void onDataChanged(AsyncDataChangeEvent, DataObject> changeEvent) { + Preconditions.checkNotNull(changeEvent,"Async ChangeEvent can not be null!"); + /* All DataObjects for create */ + final Map, DataObject> createdData = changeEvent.getCreatedData() != null + ? changeEvent.getCreatedData() : Collections., DataObject> emptyMap(); + /* All DataObjects for remove */ + final Set> removeData = changeEvent.getRemovedPaths() != null + ? changeEvent.getRemovedPaths() : Collections.> emptySet(); + /* All DataObjects for updates */ + final Map, DataObject> updateData = changeEvent.getUpdatedData() != null + ? changeEvent.getUpdatedData() : Collections., DataObject> emptyMap(); + /* All Original DataObjects */ + final Map, DataObject> originalData = changeEvent.getOriginalData() != null + ? changeEvent.getOriginalData() : Collections., DataObject> emptyMap(); + this.createData(createdData); + this.updateData(updateData, originalData); + this.removeData(removeData, originalData); + } + + @SuppressWarnings("unchecked") + private void createData(final Map, DataObject> createdData) { + final Set> keys = createdData.keySet() != null + ? createdData.keySet() : Collections.> emptySet(); + for (InstanceIdentifier key : keys) { + if (clazz.equals(key.getTargetType())) { + InstanceIdentifier createKeyIdent = key.firstIdentifierOf(clazz); + final Optional value = Optional.of(createdData.get(key)); + if (value.isPresent()) { + this.add(createKeyIdent, (T)value.get()); + } + } + } + } + + abstract protected void add(InstanceIdentifier createKeyIdent, T node); + + @SuppressWarnings("unchecked") + private void updateData(final Map, DataObject> updateData, final Map, DataObject> originalData) { + + final Set> keys = updateData.keySet() != null + ? updateData.keySet() : Collections.> emptySet(); + for (InstanceIdentifier key : keys) { + if (clazz.equals(key.getTargetType())) { + InstanceIdentifier updateKeyIdent = key.firstIdentifierOf(clazz); + final Optional value = Optional.of(updateData.get(key)); + final Optional original = Optional.of(originalData.get(key)); + if (value.isPresent() && original.isPresent()) { + this.update(updateKeyIdent, (T)original.get(), (T)value.get()); + } + } + } + } + + abstract protected void update(InstanceIdentifier updateKeyIdent, T node, + T node2); + + @SuppressWarnings("unchecked") + private void removeData(final Set> removeData, final Map, DataObject> originalData) { + + for (InstanceIdentifier key : removeData) { + if (clazz.equals(key.getTargetType())) { + final InstanceIdentifier ident = key.firstIdentifierOf(clazz); + final DataObject removeValue = originalData.get(key); + this.remove(ident, (T)removeValue); + } + } + } + + abstract protected void remove(InstanceIdentifier ident, T removeValue); + + protected void registrationListener(final DataBroker db, int i) { + try { + listenerRegistration = db.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, + getWildCardPath(), this, DataChangeScope.BASE); + } catch (final Exception e) { + if (i >= 1) { + try { + Thread.sleep(100); + } catch (InterruptedException e1) { + LOG.error("Thread interrupted '{}'", e1); + Thread.currentThread().interrupt(); + } + registrationListener(db, --i); + } else { + LOG.error("AbstractDataChangeListener registration fail!", e); + throw new IllegalStateException("AbstractDataChangeListener registration Listener fail! System needs restart.", e); + } + } + } + + protected abstract InstanceIdentifier getWildCardPath(); + + @Override + public void close() { + if (listenerRegistration != null) { + try { + listenerRegistration.close(); + } catch (final Exception e) { + LOG.error("Error by stop AbstractDataChangeListener.", e); + } + listenerRegistration = null; + } + } +} \ No newline at end of file diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.java index 1530e909ad..bbb6673a8e 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.java +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.java @@ -7,8 +7,6 @@ */ package org.opendaylight.controller.sal.compatibility; -import com.google.common.collect.Iterables; - import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; @@ -70,7 +68,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemoved; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.OpendaylightInventoryListener; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.GenericStatistics; @@ -89,7 +86,9 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class InventoryAndReadAdapter implements IPluginInReadService, IPluginInInventoryService, OpendaylightInventoryListener, OpendaylightFlowStatisticsListener, OpendaylightFlowTableStatisticsListener, OpendaylightPortStatisticsListener { +import com.google.common.collect.Iterables; + +public class InventoryAndReadAdapter implements IPluginInReadService, IPluginInInventoryService, OpendaylightFlowStatisticsListener, OpendaylightFlowTableStatisticsListener, OpendaylightPortStatisticsListener { private static final Logger LOG = LoggerFactory.getLogger(InventoryAndReadAdapter.class); private static final short OPENFLOWV10_TABLE_ID = 0; @@ -398,13 +397,11 @@ public class InventoryAndReadAdapter implements IPluginInReadService, IPluginInI return nodeStats; } - @Override - public void onNodeConnectorRemoved(final NodeConnectorRemoved update) { + public void onNodeConnectorRemovedInternal(final NodeConnectorRemoved update) { // Never received } - @Override - public void onNodeRemoved(final NodeRemoved notification) { + public void onNodeRemovedInternal(final NodeRemoved notification) { this.removeNodeConnectors(notification.getNodeRef().getValue()); try { final Node aDNode = NodeMapping.toADNode(notification.getNodeRef()); @@ -414,8 +411,7 @@ public class InventoryAndReadAdapter implements IPluginInReadService, IPluginInI } } - @Override - public void onNodeConnectorUpdated(final NodeConnectorUpdated update) { + public void onNodeConnectorUpdatedInternal(final NodeConnectorUpdated update) { final NodeConnectorRef ref = update.getNodeConnectorRef(); final UpdateType updateType; if (!this.isKnownNodeConnector(ref.getValue())) { @@ -434,8 +430,7 @@ public class InventoryAndReadAdapter implements IPluginInReadService, IPluginInI } } - @Override - public void onNodeUpdated(final NodeUpdated notification) { + public void onNodeUpdatedInternal(final NodeUpdated notification) { final NodeRef ref = notification.getNodeRef(); final UpdateType updateType; diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/NCDataChangeListener.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/NCDataChangeListener.java new file mode 100644 index 0000000000..d93d40d2a6 --- /dev/null +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/NCDataChangeListener.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.sal.compatibility; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorUpdated; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorUpdatedBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemovedBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdatedBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class NCDataChangeListener extends AbstractDataChangeListener { + private static final Logger LOG = LoggerFactory.getLogger(NodeDataChangeListener.class); + private ListenerRegistration listenerRegistration; + public NCDataChangeListener (final InventoryAndReadAdapter adapter, final DataBroker db) { + super(adapter,db,NodeConnector.class); + } + + @Override + protected void add(InstanceIdentifier createKeyIdent, NodeConnector node) { + FlowCapableNodeConnector fcnc = node.getAugmentation(FlowCapableNodeConnector.class); + if(fcnc != null) { + FlowCapableNodeConnectorUpdatedBuilder fcncub = new FlowCapableNodeConnectorUpdatedBuilder(fcnc); + NodeConnectorUpdatedBuilder builder = new NodeConnectorUpdatedBuilder(); + builder.setId(node.getId()); + builder.setNodeConnectorRef(new NodeConnectorRef(createKeyIdent)); + builder.addAugmentation(FlowCapableNodeConnectorUpdated.class, fcncub.build()); + adapter.onNodeConnectorUpdatedInternal(builder.build()); + } + } + + @Override + protected void update(InstanceIdentifier updateKeyIdent, NodeConnector original, + NodeConnector update) { + add(updateKeyIdent,update); + } + + @Override + protected void remove(InstanceIdentifier ident, NodeConnector removeValue) { + NodeConnectorRemovedBuilder builder = new NodeConnectorRemovedBuilder(); + builder.setNodeConnectorRef(new NodeConnectorRef(ident)); + adapter.onNodeConnectorRemovedInternal(builder.build()); + } + + protected InstanceIdentifier getWildCardPath() { + return InstanceIdentifier.create(Nodes.class).child(Node.class).child(NodeConnector.class); + } +} diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/NodeDataChangeListener.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/NodeDataChangeListener.java new file mode 100644 index 0000000000..cdb26162c0 --- /dev/null +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/NodeDataChangeListener.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.sal.compatibility; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeUpdated; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeUpdatedBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemovedBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdatedBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class NodeDataChangeListener extends AbstractDataChangeListener { + private static final Logger LOG = LoggerFactory.getLogger(NodeDataChangeListener.class); + + + public NodeDataChangeListener (final InventoryAndReadAdapter adapter, final DataBroker db) { + super(adapter,db,Node.class); + } + + protected void add(InstanceIdentifier createKeyIdent, Node node) { + FlowCapableNode fcn = node.getAugmentation(FlowCapableNode.class); + if(fcn != null) { + FlowCapableNodeUpdatedBuilder fcbnu = new FlowCapableNodeUpdatedBuilder(fcn); + NodeUpdatedBuilder builder = new NodeUpdatedBuilder(); + builder.setId(node.getId()); + builder.setNodeRef(new NodeRef(createKeyIdent)); + builder.setNodeConnector(node.getNodeConnector()); + builder.addAugmentation(FlowCapableNodeUpdated.class, fcbnu.build()); + adapter.onNodeUpdatedInternal(builder.build()); + } + } + + protected void update(InstanceIdentifier updateKeyIdent, Node original, + Node update) { + this.add(updateKeyIdent, update); + } + + protected void remove(InstanceIdentifier ident, Node removeValue) { + NodeRemovedBuilder builder = new NodeRemovedBuilder(); + builder.setNodeRef(new NodeRef(ident)); + adapter.onNodeRemovedInternal(builder.build()); + } + + protected InstanceIdentifier getWildCardPath() { + return InstanceIdentifier.create(Nodes.class).child(Node.class); + } + +} diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/SalCompatibilityProvider.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/SalCompatibilityProvider.java index 0ddbcaa2e0..f8f2b37819 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/SalCompatibilityProvider.java +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/SalCompatibilityProvider.java @@ -10,6 +10,7 @@ package org.opendaylight.controller.sal.compatibility; import java.util.Collection; import java.util.Collections; +import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; import org.opendaylight.controller.sal.binding.api.BindingAwareProvider; @@ -68,6 +69,10 @@ class SalCompatibilityProvider implements BindingAwareProvider { inv.setNodeConnectorStatisticsService(session.getRpcService(OpendaylightPortStatisticsService.class)); inv.setTopologyDiscovery(session.getRpcService(FlowTopologyDiscoveryService.class)); inv.setDataProviderService(session.getSALService(DataProviderService.class)); + + final NodeDataChangeListener ndcl = new NodeDataChangeListener(inv,session.getSALService(DataBroker.class)); + final NCDataChangeListener ncdcl = new NCDataChangeListener(inv,session.getSALService(DataBroker.class)); + // FIXME: remember registration for clean shutdown subscribe.registerNotificationListener(inv); diff --git a/opendaylight/md-sal/forwardingrules-manager/pom.xml b/opendaylight/md-sal/forwardingrules-manager/pom.xml index 5a9b190219..12458f5ab9 100644 --- a/opendaylight/md-sal/forwardingrules-manager/pom.xml +++ b/opendaylight/md-sal/forwardingrules-manager/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT org.opendaylight.controller.md forwardingrules-manager diff --git a/opendaylight/md-sal/inventory-manager/pom.xml b/opendaylight/md-sal/inventory-manager/pom.xml index 1706996ce4..77e4203269 100644 --- a/opendaylight/md-sal/inventory-manager/pom.xml +++ b/opendaylight/md-sal/inventory-manager/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT org.opendaylight.controller.md inventory-manager diff --git a/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/FlowCapableInventoryProvider.java b/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/FlowCapableInventoryProvider.java index 3db929b99d..618fcfc133 100644 --- a/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/FlowCapableInventoryProvider.java +++ b/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/FlowCapableInventoryProvider.java @@ -7,24 +7,23 @@ */ package org.opendaylight.controller.md.inventory.manager; -import com.google.common.base.Preconditions; -import com.google.common.util.concurrent.CheckedFuture; -import com.google.common.util.concurrent.FutureCallback; -import com.google.common.util.concurrent.Futures; +import java.util.ArrayList; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingDeque; + import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; import org.opendaylight.controller.md.sal.common.api.data.TransactionChain; import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener; -import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; import org.opendaylight.controller.sal.binding.api.NotificationProviderService; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.base.Preconditions; + class FlowCapableInventoryProvider implements AutoCloseable, Runnable, TransactionChainListener { private static final Logger LOG = LoggerFactory.getLogger(FlowCapableInventoryProvider.class); private static final int QUEUE_DEPTH = 500; @@ -47,7 +46,7 @@ class FlowCapableInventoryProvider implements AutoCloseable, Runnable, Transacti final NodeChangeCommiter changeCommiter = new NodeChangeCommiter(FlowCapableInventoryProvider.this); this.listenerRegistration = this.notificationService.registerNotificationListener(changeCommiter); - this.txChain = dataBroker.createTransactionChain(this); + this.txChain = (dataBroker.createTransactionChain(this)); thread = new Thread(this); thread.setDaemon(true); thread.setName("FlowCapableInventoryProvider"); @@ -59,49 +58,20 @@ class FlowCapableInventoryProvider implements AutoCloseable, Runnable, Transacti void enqueue(final InventoryOperation op) { try { queue.put(op); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { LOG.warn("Failed to enqueue operation {}", op, e); } } - @Override - public void close() throws InterruptedException { - LOG.info("Flow Capable Inventory Provider stopped."); - if (this.listenerRegistration != null) { - try { - this.listenerRegistration.close(); - } catch (Exception e) { - LOG.error("Failed to stop inventory provider", e); - } - listenerRegistration = null; - } - - if (thread != null) { - thread.interrupt(); - thread.join(); - thread = null; - } - if (txChain != null) { - txChain.close(); - txChain = null; - } - - - } - @Override public void run() { try { for (; ; ) { InventoryOperation op = queue.take(); - - final ReadWriteTransaction tx = txChain.newReadWriteTransaction(); - LOG.debug("New operations available, starting transaction {}", tx.getIdentifier()); - int ops = 0; + final ArrayList opsToApply = new ArrayList<>(MAX_BATCH); do { - op.applyOperation(tx); - + opsToApply.add(op); ops++; if (ops < MAX_BATCH) { op = queue.poll(); @@ -109,23 +79,9 @@ class FlowCapableInventoryProvider implements AutoCloseable, Runnable, Transacti op = null; } } while (op != null); - - LOG.debug("Processed {} operations, submitting transaction {}", ops, tx.getIdentifier()); - - final CheckedFuture result = tx.submit(); - Futures.addCallback(result, new FutureCallback() { - @Override - public void onSuccess(final Void aVoid) { - //NOOP - } - - @Override - public void onFailure(final Throwable throwable) { - LOG.error("Transaction {} failed.", tx.getIdentifier(), throwable); - } - }); + submitOperations(opsToApply); } - } catch (InterruptedException e) { + } catch (final InterruptedException e) { LOG.info("Processing interrupted, terminating", e); } @@ -135,15 +91,131 @@ class FlowCapableInventoryProvider implements AutoCloseable, Runnable, Transacti } } + /** + * Starts new empty transaction, custimizes it with submitted operations + * and submit it to data broker. + * + * If transaction chain failed during customization of transaction + * it allocates new chain and empty transaction and customizes it + * with submitted operations. + * + * This does not retry failed transaction. It only retries it when + * chain failed during customization of transaction chain. + * + * @param opsToApply + */ + private void submitOperations(final ArrayList opsToApply) { + final ReadWriteTransaction tx = createCustomizedTransaction(opsToApply); + LOG.debug("Processed {} operations, submitting transaction {}", opsToApply.size(), tx.getIdentifier()); + try { + tx.submit(); + } catch (final IllegalStateException e) { + /* + * Transaction chain failed during doing batch, so we need to null + * tx chain and continue processing queue. + * + * We fail current txChain which was allocated with createTransaction. + */ + failCurrentChain(txChain); + /* + * We will retry transaction once in order to not loose any data. + * + */ + final ReadWriteTransaction retryTx = createCustomizedTransaction(opsToApply); + retryTx.submit(); + } + } + + /** + * Creates new empty ReadWriteTransaction. If transaction chain + * was failed, it will allocate new transaction chain + * and assign it with this Operation Executor. + * + * This call is synchronized to prevent reace with {@link #failCurrentChain(TransactionChain)}. + * + * @return New Empty ReadWrite transaction, which continues this chain or starts new transaction + * chain. + */ + private synchronized ReadWriteTransaction newEmptyTransaction() { + try { + if(txChain == null) { + // Chain was broken so we need to replace it. + txChain = dataBroker.createTransactionChain(this); + } + return txChain.newReadWriteTransaction(); + } catch (final IllegalStateException e) { + LOG.debug("Chain is broken, need to allocate new transaction chain.",e); + /* + * Chain was broken by previous transaction, + * but there was race between this. + * Chain will be closed by #onTransactionChainFailed method. + */ + txChain = dataBroker.createTransactionChain(this); + return txChain.newReadWriteTransaction(); + } + } + + /** + * Creates customized not-submitted transaction, which is ready to be submitted. + * + * @param opsToApply Operations which are used to customize transaction. + * @return Non-empty transaction. + */ + private ReadWriteTransaction createCustomizedTransaction(final ArrayList opsToApply) { + final ReadWriteTransaction tx = newEmptyTransaction(); + for(final InventoryOperation op : opsToApply) { + op.applyOperation(tx); + } + return tx; + } + + private synchronized void failCurrentChain(final TransactionChain chain) { + if(txChain == chain) { + txChain = null; + } + } + @Override public void onTransactionChainFailed(final TransactionChain chain, final AsyncTransaction transaction, final Throwable cause) { LOG.error("Failed to export Flow Capable Inventory, Transaction {} failed.", transaction.getIdentifier(), cause); - + chain.close(); + if(txChain == chain) { + // Current chain is broken, so we will null it, in order to not use it. + failCurrentChain(chain); + } } @Override public void onTransactionChainSuccessful(final TransactionChain chain) { // NOOP } + + @Override + public void close() throws InterruptedException { + LOG.info("Flow Capable Inventory Provider stopped."); + if (this.listenerRegistration != null) { + try { + this.listenerRegistration.close(); + } catch (final Exception e) { + LOG.error("Failed to stop inventory provider", e); + } + listenerRegistration = null; + } + + if (thread != null) { + thread.interrupt(); + thread.join(); + thread = null; + } + if (txChain != null) { + try { + txChain.close(); + } catch (final IllegalStateException e) { + // It is possible chain failed and was closed by #onTransactionChainFailed + LOG.debug("Chain was already closed."); + } + txChain = null; + } + } } diff --git a/opendaylight/md-sal/md-sal-config/pom.xml b/opendaylight/md-sal/md-sal-config/pom.xml index 2e19b5a60c..bd1586054d 100644 --- a/opendaylight/md-sal/md-sal-config/pom.xml +++ b/opendaylight/md-sal/md-sal-config/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT md-sal-config Configuration files for md-sal diff --git a/opendaylight/md-sal/model/model-flow-base/pom.xml b/opendaylight/md-sal/model/model-flow-base/pom.xml index eb8d6a8ddb..cad0e9ea93 100644 --- a/opendaylight/md-sal/model/model-flow-base/pom.xml +++ b/opendaylight/md-sal/model/model-flow-base/pom.xml @@ -6,7 +6,7 @@ org.opendaylight.controller.model model-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT model-flow-base bundle diff --git a/opendaylight/md-sal/model/model-flow-service/pom.xml b/opendaylight/md-sal/model/model-flow-service/pom.xml index 0842bb4505..0f735d7f43 100644 --- a/opendaylight/md-sal/model/model-flow-service/pom.xml +++ b/opendaylight/md-sal/model/model-flow-service/pom.xml @@ -6,7 +6,7 @@ org.opendaylight.controller.model model-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT model-flow-service bundle diff --git a/opendaylight/md-sal/model/model-flow-statistics/pom.xml b/opendaylight/md-sal/model/model-flow-statistics/pom.xml index cd26e32781..7a53f062d7 100644 --- a/opendaylight/md-sal/model/model-flow-statistics/pom.xml +++ b/opendaylight/md-sal/model/model-flow-statistics/pom.xml @@ -6,7 +6,7 @@ org.opendaylight.controller.model model-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT model-flow-statistics bundle diff --git a/opendaylight/md-sal/model/model-inventory/pom.xml b/opendaylight/md-sal/model/model-inventory/pom.xml index c2f4f70c40..00aa7761b9 100644 --- a/opendaylight/md-sal/model/model-inventory/pom.xml +++ b/opendaylight/md-sal/model/model-inventory/pom.xml @@ -6,7 +6,7 @@ org.opendaylight.controller.model model-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT model-inventory bundle diff --git a/opendaylight/md-sal/model/model-topology/pom.xml b/opendaylight/md-sal/model/model-topology/pom.xml index e87e4f180d..09a063e887 100644 --- a/opendaylight/md-sal/model/model-topology/pom.xml +++ b/opendaylight/md-sal/model/model-topology/pom.xml @@ -6,7 +6,7 @@ org.opendaylight.controller.model model-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT model-topology bundle diff --git a/opendaylight/md-sal/model/pom.xml b/opendaylight/md-sal/model/pom.xml index 5e6a86745c..3f389f3298 100644 --- a/opendaylight/md-sal/model/pom.xml +++ b/opendaylight/md-sal/model/pom.xml @@ -6,7 +6,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT org.opendaylight.controller.model model-parent diff --git a/opendaylight/md-sal/pom.xml b/opendaylight/md-sal/pom.xml index a9c81b9353..1f646f2bba 100644 --- a/opendaylight/md-sal/pom.xml +++ b/opendaylight/md-sal/pom.xml @@ -5,12 +5,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../commons/opendaylight sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT pom diff --git a/opendaylight/md-sal/sal-akka-raft/pom.xml b/opendaylight/md-sal/sal-akka-raft/pom.xml index e68e781525..53353cded1 100644 --- a/opendaylight/md-sal/sal-akka-raft/pom.xml +++ b/opendaylight/md-sal/sal-akka-raft/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-akka-raft bundle @@ -13,7 +13,7 @@ org.opendaylight.controller sal-clustering-commons - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT com.google.guava diff --git a/opendaylight/md-sal/sal-binding-api/pom.xml b/opendaylight/md-sal/sal-binding-api/pom.xml index 7f45fb458b..690957ed0b 100644 --- a/opendaylight/md-sal/sal-binding-api/pom.xml +++ b/opendaylight/md-sal/sal-binding-api/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-binding-api bundle diff --git a/opendaylight/md-sal/sal-binding-broker/pom.xml b/opendaylight/md-sal/sal-binding-broker/pom.xml index 539f9d45c8..7482c52fdd 100644 --- a/opendaylight/md-sal/sal-binding-broker/pom.xml +++ b/opendaylight/md-sal/sal-binding-broker/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-binding-broker-impl bundle @@ -70,7 +70,7 @@ org.opendaylight.yangtools binding-data-codec - 0.6.2-SNAPSHOT + 0.7.0-SNAPSHOT org.opendaylight.yangtools diff --git a/opendaylight/md-sal/sal-binding-config/pom.xml b/opendaylight/md-sal/sal-binding-config/pom.xml index 2342745f92..68af914f57 100644 --- a/opendaylight/md-sal/sal-binding-config/pom.xml +++ b/opendaylight/md-sal/sal-binding-config/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-binding-config bundle diff --git a/opendaylight/md-sal/sal-binding-dom-it/pom.xml b/opendaylight/md-sal/sal-binding-dom-it/pom.xml index 7a66c41196..fefd85b44b 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/pom.xml +++ b/opendaylight/md-sal/sal-binding-dom-it/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-binding-dom-it jar @@ -52,7 +52,7 @@ org.opendaylight.controller sal-test-model - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT diff --git a/opendaylight/md-sal/sal-binding-it/pom.xml b/opendaylight/md-sal/sal-binding-it/pom.xml index 1912462cf0..009adb6d4a 100644 --- a/opendaylight/md-sal/sal-binding-it/pom.xml +++ b/opendaylight/md-sal/sal-binding-it/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-binding-it diff --git a/opendaylight/md-sal/sal-binding-util/pom.xml b/opendaylight/md-sal/sal-binding-util/pom.xml index 229c54f557..efe2e84507 100644 --- a/opendaylight/md-sal/sal-binding-util/pom.xml +++ b/opendaylight/md-sal/sal-binding-util/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-binding-util bundle diff --git a/opendaylight/md-sal/sal-clustering-commons/pom.xml b/opendaylight/md-sal/sal-clustering-commons/pom.xml index d12f867ac5..54a1fe7a95 100644 --- a/opendaylight/md-sal/sal-clustering-commons/pom.xml +++ b/opendaylight/md-sal/sal-clustering-commons/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-clustering-commons diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/AbstractUntypedPersistentActorWithMetering.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/AbstractUntypedPersistentActorWithMetering.java new file mode 100644 index 0000000000..365a5bd015 --- /dev/null +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/AbstractUntypedPersistentActorWithMetering.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.cluster.common.actor; + +/** + * Actor with its behaviour metered. Metering is enabled by configuration. + */ +public abstract class AbstractUntypedPersistentActorWithMetering extends AbstractUntypedPersistentActor { + + public AbstractUntypedPersistentActorWithMetering() { + if (isMetricsCaptureEnabled()) + getContext().become(new MeteringBehavior(this)); + } + + private boolean isMetricsCaptureEnabled(){ + CommonConfig config = new CommonConfig(getContext().system().settings().config()); + return config.isMetricCaptureEnabled(); + } +} diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java index 4e76e37fa2..6669e48627 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java @@ -10,47 +10,116 @@ package org.opendaylight.controller.cluster.datastore.node; -import org.opendaylight.controller.cluster.datastore.node.utils.PathUtils; import org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeSerializer; +import org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeSerializer.DeSerializer; +import org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeSerializer.Serializer; import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; +import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container; +import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class NormalizedNodeToNodeCodec { + public interface Encoded { + NormalizedNodeMessages.Container getEncodedNode(); + + NormalizedNodeMessages.InstanceIdentifier getEncodedPath(); + } + + public interface Decoded { + NormalizedNode getDecodedNode(); + + YangInstanceIdentifier getDecodedPath(); + } + private final SchemaContext ctx; - private static final Logger logger = LoggerFactory.getLogger(NormalizedNodeToNodeCodec.class); public NormalizedNodeToNodeCodec(final SchemaContext ctx){ this.ctx = ctx; + } + public NormalizedNodeMessages.Container encode(NormalizedNode node){ + return encode(null, node).getEncodedNode(); } - public NormalizedNodeMessages.Container encode(YangInstanceIdentifier id, NormalizedNode node){ + public Encoded encode(YangInstanceIdentifier path, NormalizedNode node) { + + NormalizedNodeMessages.InstanceIdentifier serializedPath = null; NormalizedNodeMessages.Container.Builder builder = NormalizedNodeMessages.Container.newBuilder(); - String parentPath = ""; - if(id != null){ - parentPath = PathUtils.getParentPath(PathUtils.toString(id)); - } + // Note: parent path is no longer used + builder.setParentPath(""); - builder.setParentPath(parentPath); if(node != null) { - builder.setNormalizedNode(NormalizedNodeSerializer.serialize(node)); + if(path == null) { + builder.setNormalizedNode(NormalizedNodeSerializer.serialize(node)); + } else { + Serializer serializer = NormalizedNodeSerializer.newSerializer(node); + builder.setNormalizedNode(serializer.serialize(path)); + serializedPath = serializer.getSerializedPath(); + } } - return builder.build(); + return new EncodedImpl(builder.build(), serializedPath); + } + + + public NormalizedNode decode(NormalizedNodeMessages.Node node){ + return decode(null, node).getDecodedNode(); } - public NormalizedNode decode(YangInstanceIdentifier id, NormalizedNodeMessages.Node node){ + public Decoded decode(NormalizedNodeMessages.InstanceIdentifier path, + NormalizedNodeMessages.Node node) { if(node.getIntType() < 0 || node.getSerializedSize() == 0){ - return null; + return new DecodedImpl(null, null); } - return NormalizedNodeSerializer.deSerialize(node); + + DeSerializer deSerializer = NormalizedNodeSerializer.newDeSerializer(path, node); + NormalizedNode decodedNode = deSerializer.deSerialize(); + return new DecodedImpl(decodedNode, deSerializer.getDeserializedPath()); } + private static class DecodedImpl implements Decoded { + + private final NormalizedNode decodedNode; + private final YangInstanceIdentifier decodedPath; + public DecodedImpl(NormalizedNode decodedNode, YangInstanceIdentifier decodedPath) { + this.decodedNode = decodedNode; + this.decodedPath = decodedPath; + } + + @Override + public NormalizedNode getDecodedNode() { + return decodedNode; + } + + @Override + public YangInstanceIdentifier getDecodedPath() { + return decodedPath; + } + } + + private static class EncodedImpl implements Encoded { + + private final Container encodedNode; + private final InstanceIdentifier encodedPath; + + EncodedImpl(Container encodedNode, InstanceIdentifier encodedPath) { + this.encodedNode = encodedNode; + this.encodedPath = encodedPath; + } + + @Override + public Container getEncodedNode() { + return encodedNode; + } + + @Override + public InstanceIdentifier getEncodedPath() { + return encodedPath; + } + } } diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtils.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtils.java index 25b65f0168..6cdddfd271 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtils.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtils.java @@ -20,23 +20,6 @@ import java.util.Set; public class PathUtils { - public static String getParentPath(String currentElementPath){ - StringBuilder parentPath = new StringBuilder(); - - if(currentElementPath != null){ - String[] parentPaths = currentElementPath.split("/"); - if(parentPaths.length > 2){ - for(int i=0;i 0){ - parentPath.append("/"); - parentPath.append(parentPaths[i]); - } - } - } - } - return parentPath.toString(); - } - /** * Given a YangInstanceIdentifier return a serialized version of the same * as a String diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializationContext.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializationContext.java index 660bc28e62..1920702527 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializationContext.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializationContext.java @@ -8,15 +8,9 @@ package org.opendaylight.controller.cluster.datastore.node.utils.serialization; -import java.net.URI; -import java.util.Date; - /** * NormalizedNodeSerializationContext provides methods which help in encoding * certain components of a NormalizedNode properly */ public interface NormalizedNodeSerializationContext { - int addNamespace(URI namespace); - int addRevision(Date revision); - int addLocalName(String localName); } diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializer.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializer.java index 44da4a5668..15d51e1d80 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializer.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializer.java @@ -9,9 +9,9 @@ package org.opendaylight.controller.cluster.datastore.node.utils.serialization; import com.google.common.base.Preconditions; - +import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils; import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; -import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil; +import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder; import org.opendaylight.yangtools.yang.data.api.Node; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode; @@ -33,15 +33,8 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContaine import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder; import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.ListNodeBuilder; import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeAttrBuilder; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Date; import java.util.EnumMap; -import java.util.HashMap; -import java.util.List; import java.util.Map; - import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.ANY_XML_NODE_TYPE; import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.AUGMENTATION_NODE_TYPE; import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.CHOICE_NODE_TYPE; @@ -93,6 +86,10 @@ public class NormalizedNodeSerializer { return new Serializer(node).serialize(); } + public static Serializer newSerializer(NormalizedNode node) { + Preconditions.checkNotNull(node, "node should not be null"); + return new Serializer(node); + } /** * DeSerialize a protocol buffer message back into a NormalizedNode @@ -100,8 +97,15 @@ public class NormalizedNodeSerializer { * @param node * @return */ - public static NormalizedNode deSerialize(NormalizedNodeMessages.Node node){ - return new DeSerializer(node).deSerialize(); + public static NormalizedNode deSerialize(NormalizedNodeMessages.Node node) { + Preconditions.checkNotNull(node, "node should not be null"); + return new DeSerializer(null, node).deSerialize(); + } + + public static DeSerializer newDeSerializer(NormalizedNodeMessages.InstanceIdentifier path, + NormalizedNodeMessages.Node node) { + Preconditions.checkNotNull(node, "node should not be null"); + return new DeSerializer(path, node); } /** @@ -117,25 +121,36 @@ public class NormalizedNodeSerializer { * @param pathArgument * @return */ - public static YangInstanceIdentifier.PathArgument deSerialize(NormalizedNodeMessages.Node node, NormalizedNodeMessages.PathArgument pathArgument){ + public static YangInstanceIdentifier.PathArgument deSerialize(NormalizedNodeMessages.Node node, + NormalizedNodeMessages.PathArgument pathArgument){ Preconditions.checkNotNull(node, "node should not be null"); Preconditions.checkNotNull(pathArgument, "pathArgument should not be null"); - return new DeSerializer(node).deSerialize(pathArgument); + return new DeSerializer(null, node).deSerialize(pathArgument); } - private static class Serializer implements NormalizedNodeSerializationContext { + public static class Serializer extends QNameSerializationContextImpl + implements NormalizedNodeSerializationContext { private final NormalizedNode node; - private final Map codeMap = new HashMap<>(); - private final List codes = new ArrayList<>(); + private NormalizedNodeMessages.InstanceIdentifier serializedPath; private Serializer(NormalizedNode node) { this.node = node; } - private NormalizedNodeMessages.Node serialize() { - return this.serialize(node).addAllCode(codes).build(); + public NormalizedNodeMessages.InstanceIdentifier getSerializedPath() { + return serializedPath; + } + + public NormalizedNodeMessages.Node serialize() { + return this.serialize(node).addAllCode(getCodes()).build(); + } + + public NormalizedNodeMessages.Node serialize(YangInstanceIdentifier path) { + Builder builder = serialize(node); + serializedPath = InstanceIdentifierUtils.toSerializable(path, this); + return builder.addAllCode(getCodes()).build(); } private NormalizedNodeMessages.Node.Builder serialize( @@ -183,56 +198,10 @@ public class NormalizedNodeSerializer { return builder; } - - - @Override public int addNamespace(URI namespace) { - int namespaceInt = getCode(namespace); - - if(namespaceInt == -1) { - namespaceInt = addCode(namespace, namespace.toString()); - } - return namespaceInt; - } - - @Override public int addRevision(Date revision) { - if(revision == null){ - return -1; - } - - int revisionInt = getCode(revision); - if(revisionInt == -1) { - String formattedRevision = - SimpleDateFormatUtil.getRevisionFormat().format(revision); - revisionInt = addCode(revision, formattedRevision); - } - return revisionInt; - } - - @Override public int addLocalName(String localName) { - int localNameInt = getCode(localName); - if(localNameInt == -1) { - localNameInt = addCode(localName, localName.toString()); - } - return localNameInt; - - } - - public int addCode(Object code, String codeStr){ - int count = codes.size(); - codes.add(codeStr); - codeMap.put(code, Integer.valueOf(count)); - return count; - } - - public int getCode(Object code){ - if(codeMap.containsKey(code)){ - return codeMap.get(code); - } - return -1; - } } - private static class DeSerializer implements NormalizedNodeDeSerializationContext { + public static class DeSerializer extends QNameDeSerializationContextImpl + implements NormalizedNodeDeSerializationContext { private static Map deSerializationFunctions = new EnumMap<>(NormalizedNodeType.class); @@ -438,13 +407,27 @@ public class NormalizedNodeSerializer { } private final NormalizedNodeMessages.Node node; + private final NormalizedNodeMessages.InstanceIdentifier path; + private YangInstanceIdentifier deserializedPath; - public DeSerializer(NormalizedNodeMessages.Node node){ + public DeSerializer(NormalizedNodeMessages.InstanceIdentifier path, + NormalizedNodeMessages.Node node) { + super(node.getCodeList()); + this.path = path; this.node = node; } - public NormalizedNode deSerialize(){ - return deSerialize(node); + public YangInstanceIdentifier getDeserializedPath() { + return deserializedPath; + } + + public NormalizedNode deSerialize() { + NormalizedNode deserializedNode = deSerialize(node); + if(path != null) { + deserializedPath = InstanceIdentifierUtils.fromSerializable(path, this); + } + + return deserializedNode; } private NormalizedNode deSerialize(NormalizedNodeMessages.Node node){ @@ -526,18 +509,6 @@ public class NormalizedNodeSerializer { this, path); } - @Override public String getNamespace(int namespace) { - return node.getCode(namespace); - } - - @Override public String getRevision(int revision) { - return node.getCode(revision); - } - - @Override public String getLocalName(int localName) { - return node.getCode(localName); - } - public YangInstanceIdentifier.PathArgument deSerialize( NormalizedNodeMessages.PathArgument pathArgument) { return PathArgumentSerializer.deSerialize(this, pathArgument); diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeType.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeType.java index eebd58013a..2d6d738b76 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeType.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeType.java @@ -42,20 +42,20 @@ public enum NormalizedNodeType { public static NormalizedNodeType getSerializableNodeType(NormalizedNode node){ Preconditions.checkNotNull(node, "node should not be null"); - if(node instanceof ContainerNode){ - return CONTAINER_NODE_TYPE; - } else if(node instanceof LeafNode){ + if(node instanceof LeafNode){ return LEAF_NODE_TYPE; - } else if(node instanceof MapNode){ - return MAP_NODE_TYPE; + } else if(node instanceof LeafSetEntryNode){ + return LEAF_SET_ENTRY_NODE_TYPE; } else if(node instanceof MapEntryNode){ return MAP_ENTRY_NODE_TYPE; + } else if(node instanceof ContainerNode){ + return CONTAINER_NODE_TYPE; + } else if(node instanceof MapNode){ + return MAP_NODE_TYPE; } else if(node instanceof AugmentationNode){ return AUGMENTATION_NODE_TYPE; } else if(node instanceof LeafSetNode){ return LEAF_SET_NODE_TYPE; - } else if(node instanceof LeafSetEntryNode){ - return LEAF_SET_ENTRY_NODE_TYPE; } else if(node instanceof ChoiceNode){ return CHOICE_NODE_TYPE; } else if(node instanceof OrderedLeafSetNode){ @@ -69,6 +69,7 @@ public enum NormalizedNodeType { } else if(node instanceof AnyXmlNode){ return ANY_XML_NODE_TYPE; } + throw new IllegalArgumentException("Node type unknown : " + node.getClass().getSimpleName()); } diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentSerializer.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentSerializer.java index 4fb676e518..bf10316fd5 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentSerializer.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentSerializer.java @@ -9,28 +9,28 @@ package org.opendaylight.controller.cluster.datastore.node.utils.serialization; import com.google.common.base.Preconditions; - import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory; import org.opendaylight.controller.cluster.datastore.node.utils.QNameFactory; import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; - import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; - import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.PathArgumentType.getSerializablePathArgumentType; public class PathArgumentSerializer { private static final String REVISION_ARG = "?revision="; - private static final Map pathArgumentAttributesGetters = new HashMap<>(); + private static final Map, PathArgumentAttributesGetter> pathArgumentAttributesGetters = new HashMap<>(); - public static NormalizedNodeMessages.PathArgument serialize(NormalizedNodeSerializationContext context, YangInstanceIdentifier.PathArgument pathArgument){ + public static NormalizedNodeMessages.PathArgument serialize(QNameSerializationContext context, + YangInstanceIdentifier.PathArgument pathArgument){ Preconditions.checkNotNull(context, "context should not be null"); Preconditions.checkNotNull(pathArgument, "pathArgument should not be null"); @@ -53,7 +53,8 @@ public class PathArgumentSerializer { } - public static YangInstanceIdentifier.PathArgument deSerialize(NormalizedNodeDeSerializationContext context, NormalizedNodeMessages.PathArgument pathArgument){ + public static YangInstanceIdentifier.PathArgument deSerialize(QNameDeSerializationContext context, + NormalizedNodeMessages.PathArgument pathArgument){ Preconditions.checkNotNull(context, "context should not be null"); Preconditions.checkNotNull(pathArgument, "pathArgument should not be null"); @@ -62,18 +63,15 @@ public class PathArgumentSerializer { private static interface PathArgumentAttributesGetter { - Iterable get(NormalizedNodeSerializationContext context, - YangInstanceIdentifier.PathArgument pathArgument); + Iterable get( + QNameSerializationContext context, YangInstanceIdentifier.PathArgument pathArgument); } static { pathArgumentAttributesGetters.put(YangInstanceIdentifier.NodeWithValue.class, new PathArgumentAttributesGetter() { @Override public Iterable get( - NormalizedNodeSerializationContext context, - YangInstanceIdentifier.PathArgument pathArgument) { - List attributes = - new ArrayList<>(); + QNameSerializationContext context, YangInstanceIdentifier.PathArgument pathArgument) { YangInstanceIdentifier.NodeWithValue identifier = (YangInstanceIdentifier.NodeWithValue) pathArgument; @@ -81,62 +79,52 @@ public class PathArgumentSerializer { NormalizedNodeMessages.PathArgumentAttribute attribute = buildAttribute(context, null, identifier.getValue()); - attributes.add(attribute); - - return attributes; - + return Arrays.asList(attribute); } }); pathArgumentAttributesGetters.put(YangInstanceIdentifier.NodeIdentifierWithPredicates.class, new PathArgumentAttributesGetter() { @Override public Iterable get( - NormalizedNodeSerializationContext context, - YangInstanceIdentifier.PathArgument pathArgument) { - - List attributes = - new ArrayList<>(); + QNameSerializationContext context, YangInstanceIdentifier.PathArgument pathArgument) { YangInstanceIdentifier.NodeIdentifierWithPredicates identifier = (YangInstanceIdentifier.NodeIdentifierWithPredicates) pathArgument; - for (QName key : identifier.getKeyValues().keySet()) { - Object value = identifier.getKeyValues().get(key); + Map keyValues = identifier.getKeyValues(); + List attributes = + new ArrayList<>(keyValues.size()); + for (Entry e : keyValues.entrySet()) { NormalizedNodeMessages.PathArgumentAttribute attribute = - buildAttribute(context, key, value); + buildAttribute(context, e.getKey(), e.getValue()); attributes.add(attribute); - } return attributes; - } }); pathArgumentAttributesGetters.put(YangInstanceIdentifier.AugmentationIdentifier.class, new PathArgumentAttributesGetter() { @Override public Iterable get( - NormalizedNodeSerializationContext context, - YangInstanceIdentifier.PathArgument pathArgument) { - - List attributes = - new ArrayList<>(); + QNameSerializationContext context, YangInstanceIdentifier.PathArgument pathArgument) { YangInstanceIdentifier.AugmentationIdentifier identifier = (YangInstanceIdentifier.AugmentationIdentifier) pathArgument; - for (QName key : identifier.getPossibleChildNames()) { + Set possibleChildNames = identifier.getPossibleChildNames(); + List attributes = + new ArrayList<>(possibleChildNames.size()); + for (QName key : possibleChildNames) { Object value = key; NormalizedNodeMessages.PathArgumentAttribute attribute = buildAttribute(context, key, value); attributes.add(attribute); - } return attributes; - } }); @@ -144,14 +132,14 @@ public class PathArgumentSerializer { pathArgumentAttributesGetters.put(YangInstanceIdentifier.NodeIdentifier.class, new PathArgumentAttributesGetter() { @Override public Iterable get( - NormalizedNodeSerializationContext context, - YangInstanceIdentifier.PathArgument pathArgument) { + QNameSerializationContext context, YangInstanceIdentifier.PathArgument pathArgument) { return Collections.emptyList(); } }); } - private static NormalizedNodeMessages.PathArgumentAttribute buildAttribute(NormalizedNodeSerializationContext context,QName name, Object value){ + private static NormalizedNodeMessages.PathArgumentAttribute buildAttribute( + QNameSerializationContext context, QName name, Object value) { NormalizedNodeMessages.PathArgumentAttribute.Builder builder = NormalizedNodeMessages.PathArgumentAttribute.newBuilder(); @@ -162,8 +150,9 @@ public class PathArgumentSerializer { } - private static NormalizedNodeMessages.QName.Builder encodeQName(NormalizedNodeSerializationContext context, QName qName){ - if(qName == null){ + private static NormalizedNodeMessages.QName.Builder encodeQName(QNameSerializationContext context, + QName qName) { + if(qName == null) { return NormalizedNodeMessages.QName.getDefaultInstance().toBuilder(); } NormalizedNodeMessages.QName.Builder qNameBuilder = @@ -179,15 +168,13 @@ public class PathArgumentSerializer { } private static Iterable getPathArgumentAttributes( - NormalizedNodeSerializationContext context, - YangInstanceIdentifier.PathArgument pathArgument) { + QNameSerializationContext context, YangInstanceIdentifier.PathArgument pathArgument) { return pathArgumentAttributesGetters.get(pathArgument.getClass()).get(context, pathArgument); - } - private static String qNameToString(NormalizedNodeDeSerializationContext context, + private static String qNameToString(QNameDeSerializationContext context, NormalizedNodeMessages.QName qName){ // If this serializer is used qName cannot be null (see encodeQName) // adding null check only in case someone tried to deSerialize a protocol buffer node @@ -219,8 +206,7 @@ public class PathArgumentSerializer { * @return MD-SAL PathArgument */ private static YangInstanceIdentifier.PathArgument parsePathArgument( - NormalizedNodeDeSerializationContext context, - NormalizedNodeMessages.PathArgument pathArgument) { + QNameDeSerializationContext context, NormalizedNodeMessages.PathArgument pathArgument) { switch(PathArgumentType.values()[pathArgument.getIntType()]){ case NODE_IDENTIFIER_WITH_VALUE : { @@ -264,8 +250,8 @@ public class PathArgumentSerializer { } private static Map toAttributesMap( - NormalizedNodeDeSerializationContext context, - List attributesList) { + QNameDeSerializationContext context, + List attributesList) { Map map; if(attributesList.size() == 1) { @@ -287,7 +273,8 @@ public class PathArgumentSerializer { return map; } - private static Object parseAttribute(NormalizedNodeDeSerializationContext context, NormalizedNodeMessages.PathArgumentAttribute attribute){ + private static Object parseAttribute(QNameDeSerializationContext context, + NormalizedNodeMessages.PathArgumentAttribute attribute){ return ValueSerializer.deSerialize(context, attribute); } diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentType.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentType.java index 20009d8347..58a09ae885 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentType.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentType.java @@ -8,8 +8,9 @@ package org.opendaylight.controller.cluster.datastore.node.utils.serialization; -import com.google.common.base.Preconditions; +import java.util.Map; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import com.google.common.collect.ImmutableMap; public enum PathArgumentType { AUGMENTATION_IDENTIFIER, @@ -17,19 +18,21 @@ public enum PathArgumentType { NODE_IDENTIFIER_WITH_VALUE, NODE_IDENTIFIER_WITH_PREDICATES; + private static Map, PathArgumentType> CLASS_TO_ENUM_MAP = + ImmutableMap., PathArgumentType>builder(). + put(YangInstanceIdentifier.AugmentationIdentifier.class, AUGMENTATION_IDENTIFIER). + put(YangInstanceIdentifier.NodeIdentifier.class, NODE_IDENTIFIER). + put(YangInstanceIdentifier.NodeIdentifierWithPredicates.class, NODE_IDENTIFIER_WITH_PREDICATES). + put(YangInstanceIdentifier.NodeWithValue.class, NODE_IDENTIFIER_WITH_VALUE).build(); + public static int getSerializablePathArgumentType(YangInstanceIdentifier.PathArgument pathArgument){ - Preconditions.checkNotNull(pathArgument, "pathArgument should not be null"); - - if(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier){ - return AUGMENTATION_IDENTIFIER.ordinal(); - } else if(pathArgument instanceof YangInstanceIdentifier.NodeIdentifier){ - return NODE_IDENTIFIER.ordinal(); - } else if(pathArgument instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates){ - return NODE_IDENTIFIER_WITH_PREDICATES.ordinal(); - } else if(pathArgument instanceof YangInstanceIdentifier.NodeWithValue){ - return NODE_IDENTIFIER_WITH_VALUE.ordinal(); + + PathArgumentType type = CLASS_TO_ENUM_MAP.get(pathArgument.getClass()); + if(type == null) { + throw new IllegalArgumentException("Unknown type of PathArgument = " + pathArgument); } - throw new IllegalArgumentException("Unknown type of PathArgument = " + pathArgument.toString()); + + return type.ordinal(); } } diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/QNameDeSerializationContext.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/QNameDeSerializationContext.java new file mode 100644 index 0000000000..ca9ead7483 --- /dev/null +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/QNameDeSerializationContext.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2014 Brocade Communications Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.cluster.datastore.node.utils.serialization; + +/** + * Interface that provides methods which help in decoding components of a QName. + * + * @author Thomas Pantelis + */ +public interface QNameDeSerializationContext { + String getNamespace(int namespace); + + String getRevision(int revision); + + String getLocalName(int localName); +} diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/QNameDeSerializationContextImpl.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/QNameDeSerializationContextImpl.java new file mode 100644 index 0000000000..ac3d362ec4 --- /dev/null +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/QNameDeSerializationContextImpl.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2014 Brocade Communications Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.cluster.datastore.node.utils.serialization; + +import java.util.List; + +/** + * Implementation of the QNameDeSerializationContext interface. + * + * @author Thomas Pantelis + */ +public class QNameDeSerializationContextImpl implements QNameDeSerializationContext { + + private final List codeList; + + public QNameDeSerializationContextImpl(List codeList) { + this.codeList = codeList; + } + + @Override + public String getNamespace(int namespace) { + return codeList.get(namespace); + } + + @Override + public String getRevision(int revision) { + return codeList.get(revision); + } + + @Override + public String getLocalName(int localName) { + return codeList.get(localName); + } +} diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/QNameSerializationContext.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/QNameSerializationContext.java new file mode 100644 index 0000000000..9096add404 --- /dev/null +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/QNameSerializationContext.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2014 Brocade Communications Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.cluster.datastore.node.utils.serialization; + +import java.net.URI; +import java.util.Date; + +/** + * Interface that provides methods which help in encoding components of a QName. + * + * @author Thomas Pantelis + */ +public interface QNameSerializationContext { + int addNamespace(URI namespace); + + int addRevision(Date revision); + + int addLocalName(String localName); + +} diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/QNameSerializationContextImpl.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/QNameSerializationContextImpl.java new file mode 100644 index 0000000000..09fe2efc3e --- /dev/null +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/QNameSerializationContextImpl.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2014 Brocade Communications Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.cluster.datastore.node.utils.serialization; + +import java.net.URI; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil; + +/** + * Implementation of the QNameSerializationContext interface. + * + * @author Thomas Pantelis + */ +public class QNameSerializationContextImpl implements QNameSerializationContext { + + private final Map codeMap = new HashMap<>(); + private final List codes = new ArrayList<>(); + + public List getCodes() { + return codes; + } + + @Override public int addNamespace(URI namespace) { + int namespaceInt = getCode(namespace); + + if(namespaceInt == -1) { + namespaceInt = addCode(namespace, namespace.toString()); + } + return namespaceInt; + } + + @Override public int addRevision(Date revision) { + if(revision == null){ + return -1; + } + + int revisionInt = getCode(revision); + if(revisionInt == -1) { + String formattedRevision = + SimpleDateFormatUtil.getRevisionFormat().format(revision); + revisionInt = addCode(revision, formattedRevision); + } + return revisionInt; + } + + @Override public int addLocalName(String localName) { + int localNameInt = getCode(localName); + if(localNameInt == -1) { + localNameInt = addCode(localName, localName); + } + return localNameInt; + + } + + private int addCode(Object code, String codeStr){ + int count = codes.size(); + codes.add(codeStr); + codeMap.put(code, Integer.valueOf(count)); + return count; + } + + private int getCode(Object code){ + Integer value = codeMap.get(code); + return value == null ? -1 : value.intValue(); + } +} diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializer.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializer.java index 8def754f11..6a843f57c7 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializer.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializer.java @@ -20,12 +20,12 @@ import java.util.Set; public class ValueSerializer { public static void serialize(NormalizedNodeMessages.Node.Builder builder, - NormalizedNodeSerializationContext context, Object value){ + QNameSerializationContext context, Object value) { builder.setIntValueType(ValueType.getSerializableType(value).ordinal()); if(value instanceof YangInstanceIdentifier) { builder.setInstanceIdentifierValue( - InstanceIdentifierUtils.toSerializable((YangInstanceIdentifier) value)); + InstanceIdentifierUtils.toSerializable((YangInstanceIdentifier) value, context)); } else if(value instanceof Set) { Set set = (Set) value; if(!set.isEmpty()){ @@ -44,26 +44,25 @@ public class ValueSerializer { } public static void serialize(NormalizedNodeMessages.PathArgumentAttribute.Builder builder, - NormalizedNodeSerializationContext context, Object value){ + QNameSerializationContext context, Object value){ builder.setType(ValueType.getSerializableType(value).ordinal()); builder.setValue(value.toString()); } - public static Object deSerialize( - NormalizedNodeDeSerializationContext context, NormalizedNodeMessages.Node node) { + public static Object deSerialize(QNameDeSerializationContext context, + NormalizedNodeMessages.Node node) { if(node.getIntValueType() == ValueType.YANG_IDENTIFIER_TYPE.ordinal()){ return InstanceIdentifierUtils.fromSerializable( - node.getInstanceIdentifierValue()); + node.getInstanceIdentifierValue(), context); } else if(node.getIntValueType() == ValueType.BITS_TYPE.ordinal()){ return new HashSet(node.getBitsValueList()); } return deSerializeBasicTypes(node.getIntValueType(), node.getValue()); } - public static Object deSerialize( - NormalizedNodeDeSerializationContext context, - NormalizedNodeMessages.PathArgumentAttribute attribute) { + public static Object deSerialize(QNameDeSerializationContext context, + NormalizedNodeMessages.PathArgumentAttribute attribute) { return deSerializeBasicTypes(attribute.getType(), attribute.getValue()); } diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtils.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtils.java index 0bb0d4fe87..64a1e3a18a 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtils.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtils.java @@ -12,12 +12,17 @@ package org.opendaylight.controller.cluster.datastore.util; import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory; import org.opendaylight.controller.cluster.datastore.node.utils.QNameFactory; +import org.opendaylight.controller.cluster.datastore.node.utils.serialization.PathArgumentSerializer; +import org.opendaylight.controller.cluster.datastore.node.utils.serialization.QNameDeSerializationContext; +import org.opendaylight.controller.cluster.datastore.node.utils.serialization.QNameDeSerializationContextImpl; +import org.opendaylight.controller.cluster.datastore.node.utils.serialization.QNameSerializationContext; +import org.opendaylight.controller.cluster.datastore.node.utils.serialization.QNameSerializationContextImpl; import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; +import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -41,61 +46,54 @@ public class InstanceIdentifierUtils { protected static final Logger logger = LoggerFactory .getLogger(InstanceIdentifierUtils.class); - @Deprecated - public static YangInstanceIdentifier from(String path) { - String[] ids = path.split("/"); - - List pathArguments = - new ArrayList<>(); - for (String nodeId : ids) { - if (!"".equals(nodeId)) { - pathArguments - .add(NodeIdentifierFactory.getArgument(nodeId)); - } - } - final YangInstanceIdentifier instanceIdentifier = - YangInstanceIdentifier.create(pathArguments); - return instanceIdentifier; - } - - /** * Convert an MD-SAL YangInstanceIdentifier into a protocol buffer version of it * * @param path an MD-SAL YangInstanceIdentifier * @return a protocol buffer version of the MD-SAL YangInstanceIdentifier */ - public static NormalizedNodeMessages.InstanceIdentifier toSerializable(YangInstanceIdentifier path){ + public static NormalizedNodeMessages.InstanceIdentifier toSerializable(YangInstanceIdentifier path) { + QNameSerializationContextImpl context = new QNameSerializationContextImpl(); + Builder builder = toSerializableBuilder(path, context); + return builder.addAllCode(context.getCodes()).build(); + } + + public static NormalizedNodeMessages.InstanceIdentifier toSerializable( + YangInstanceIdentifier path, QNameSerializationContext context) { + return toSerializableBuilder(path, context).build(); + } + + private static NormalizedNodeMessages.InstanceIdentifier.Builder toSerializableBuilder( + YangInstanceIdentifier path, QNameSerializationContext context) { NormalizedNodeMessages.InstanceIdentifier.Builder builder = NormalizedNodeMessages.InstanceIdentifier.newBuilder(); try { - - for (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument pathArgument : path - .getPathArguments()) { - - String nodeType = ""; - if(!(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier)){ - nodeType = pathArgument.getNodeType().toString(); + for (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier. + PathArgument pathArgument : path.getPathArguments()) { + NormalizedNodeMessages.PathArgument serializablePathArgument; + if(context == null) { + String nodeType = ""; + if(!(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier)){ + nodeType = pathArgument.getNodeType().toString(); + } + + serializablePathArgument = NormalizedNodeMessages.PathArgument.newBuilder() + .setValue(pathArgument.toString()) + .setType(pathArgument.getClass().getSimpleName()) + .setNodeType(NormalizedNodeMessages.QName.newBuilder().setValue(nodeType)) + .addAllAttributes(getPathArgumentAttributes(pathArgument)).build(); + } else { + serializablePathArgument = PathArgumentSerializer.serialize(context, pathArgument); } - NormalizedNodeMessages.PathArgument serializablePathArgument = - NormalizedNodeMessages.PathArgument.newBuilder() - .setValue(pathArgument.toString()) - .setType(pathArgument.getClass().getSimpleName()) - .setNodeType(NormalizedNodeMessages.QName.newBuilder() - .setValue(nodeType)) - .addAllAttributes(getPathArgumentAttributes( - pathArgument)) - .build(); - builder.addArguments(serializablePathArgument); } - } catch(Exception e){ logger.error("An exception occurred", e); } - return builder.build(); + + return builder; } @@ -106,21 +104,24 @@ public class InstanceIdentifierUtils { * @param path a protocol buffer version of the MD-SAL YangInstanceIdentifier * @return an MD-SAL YangInstanceIdentifier */ - public static YangInstanceIdentifier fromSerializable(NormalizedNodeMessages.InstanceIdentifier path){ - - List pathArguments = - new ArrayList<>(); + public static YangInstanceIdentifier fromSerializable(NormalizedNodeMessages.InstanceIdentifier path) { + return fromSerializable(path, new QNameDeSerializationContextImpl(path.getCodeList())); + } - for(NormalizedNodeMessages.PathArgument pathArgument : path.getArgumentsList()){ + public static YangInstanceIdentifier fromSerializable(NormalizedNodeMessages.InstanceIdentifier path, + QNameDeSerializationContext context) { - pathArguments - .add(parsePathArgument(pathArgument)); + List pathArguments = new ArrayList<>(); + for(NormalizedNodeMessages.PathArgument pathArgument : path.getArgumentsList()) { + if(context == null || pathArgument.hasType()) { + pathArguments.add(parsePathArgument(pathArgument)); + } else { + pathArguments.add(PathArgumentSerializer.deSerialize(context, pathArgument)); + } } - final YangInstanceIdentifier instanceIdentifier = YangInstanceIdentifier.create(pathArguments); - - return instanceIdentifier; + return YangInstanceIdentifier.create(pathArguments); } /** @@ -218,7 +219,8 @@ public class InstanceIdentifierUtils { * @param pathArgument protocol buffer PathArgument * @return MD-SAL PathArgument */ - private static YangInstanceIdentifier.PathArgument parsePathArgument(NormalizedNodeMessages.PathArgument pathArgument) { + private static YangInstanceIdentifier.PathArgument parsePathArgument( + NormalizedNodeMessages.PathArgument pathArgument) { if (YangInstanceIdentifier.NodeWithValue.class.getSimpleName().equals(pathArgument.getType())) { YangInstanceIdentifier.NodeWithValue nodeWithValue = diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/common/NormalizedNodeMessages.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/common/NormalizedNodeMessages.java index 3926bc7dc3..e7f2c361ae 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/common/NormalizedNodeMessages.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/common/NormalizedNodeMessages.java @@ -4176,6 +4176,50 @@ public final class NormalizedNodeMessages { */ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder getArgumentsOrBuilder( int index); + + // repeated string code = 2; + /** + * repeated string code = 2; + * + *
+     * A list of string codes which can be used for any repeated strings in the path args. This is
+     * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+     * that contains the codes.
+     * 
+ */ + java.util.List + getCodeList(); + /** + * repeated string code = 2; + * + *
+     * A list of string codes which can be used for any repeated strings in the path args. This is
+     * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+     * that contains the codes.
+     * 
+ */ + int getCodeCount(); + /** + * repeated string code = 2; + * + *
+     * A list of string codes which can be used for any repeated strings in the path args. This is
+     * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+     * that contains the codes.
+     * 
+ */ + java.lang.String getCode(int index); + /** + * repeated string code = 2; + * + *
+     * A list of string codes which can be used for any repeated strings in the path args. This is
+     * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+     * that contains the codes.
+     * 
+ */ + com.google.protobuf.ByteString + getCodeBytes(int index); } /** * Protobuf type {@code org.opendaylight.controller.mdsal.InstanceIdentifier} @@ -4236,6 +4280,14 @@ public final class NormalizedNodeMessages { arguments_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.PARSER, extensionRegistry)); break; } + case 18: { + if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + code_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000002; + } + code_.add(input.readBytes()); + break; + } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -4247,6 +4299,9 @@ public final class NormalizedNodeMessages { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { arguments_ = java.util.Collections.unmodifiableList(arguments_); } + if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + code_ = new com.google.protobuf.UnmodifiableLazyStringList(code_); + } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } @@ -4314,8 +4369,63 @@ public final class NormalizedNodeMessages { return arguments_.get(index); } + // repeated string code = 2; + public static final int CODE_FIELD_NUMBER = 2; + private com.google.protobuf.LazyStringList code_; + /** + * repeated string code = 2; + * + *
+     * A list of string codes which can be used for any repeated strings in the path args. This is
+     * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+     * that contains the codes.
+     * 
+ */ + public java.util.List + getCodeList() { + return code_; + } + /** + * repeated string code = 2; + * + *
+     * A list of string codes which can be used for any repeated strings in the path args. This is
+     * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+     * that contains the codes.
+     * 
+ */ + public int getCodeCount() { + return code_.size(); + } + /** + * repeated string code = 2; + * + *
+     * A list of string codes which can be used for any repeated strings in the path args. This is
+     * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+     * that contains the codes.
+     * 
+ */ + public java.lang.String getCode(int index) { + return code_.get(index); + } + /** + * repeated string code = 2; + * + *
+     * A list of string codes which can be used for any repeated strings in the path args. This is
+     * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+     * that contains the codes.
+     * 
+ */ + public com.google.protobuf.ByteString + getCodeBytes(int index) { + return code_.getByteString(index); + } + private void initFields() { arguments_ = java.util.Collections.emptyList(); + code_ = com.google.protobuf.LazyStringArrayList.EMPTY; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -4338,6 +4448,9 @@ public final class NormalizedNodeMessages { for (int i = 0; i < arguments_.size(); i++) { output.writeMessage(1, arguments_.get(i)); } + for (int i = 0; i < code_.size(); i++) { + output.writeBytes(2, code_.getByteString(i)); + } getUnknownFields().writeTo(output); } @@ -4351,6 +4464,15 @@ public final class NormalizedNodeMessages { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, arguments_.get(i)); } + { + int dataSize = 0; + for (int i = 0; i < code_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(code_.getByteString(i)); + } + size += dataSize; + size += 1 * getCodeList().size(); + } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; @@ -4474,6 +4596,8 @@ public final class NormalizedNodeMessages { } else { argumentsBuilder_.clear(); } + code_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); return this; } @@ -4510,6 +4634,12 @@ public final class NormalizedNodeMessages { } else { result.arguments_ = argumentsBuilder_.build(); } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + code_ = new com.google.protobuf.UnmodifiableLazyStringList( + code_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.code_ = code_; onBuilt(); return result; } @@ -4551,6 +4681,16 @@ public final class NormalizedNodeMessages { } } } + if (!other.code_.isEmpty()) { + if (code_.isEmpty()) { + code_ = other.code_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureCodeIsMutable(); + code_.addAll(other.code_); + } + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } @@ -4824,6 +4964,153 @@ public final class NormalizedNodeMessages { return argumentsBuilder_; } + // repeated string code = 2; + private com.google.protobuf.LazyStringList code_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureCodeIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + code_ = new com.google.protobuf.LazyStringArrayList(code_); + bitField0_ |= 0x00000002; + } + } + /** + * repeated string code = 2; + * + *
+       * A list of string codes which can be used for any repeated strings in the path args. This is
+       * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+       * that contains the codes.
+       * 
+ */ + public java.util.List + getCodeList() { + return java.util.Collections.unmodifiableList(code_); + } + /** + * repeated string code = 2; + * + *
+       * A list of string codes which can be used for any repeated strings in the path args. This is
+       * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+       * that contains the codes.
+       * 
+ */ + public int getCodeCount() { + return code_.size(); + } + /** + * repeated string code = 2; + * + *
+       * A list of string codes which can be used for any repeated strings in the path args. This is
+       * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+       * that contains the codes.
+       * 
+ */ + public java.lang.String getCode(int index) { + return code_.get(index); + } + /** + * repeated string code = 2; + * + *
+       * A list of string codes which can be used for any repeated strings in the path args. This is
+       * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+       * that contains the codes.
+       * 
+ */ + public com.google.protobuf.ByteString + getCodeBytes(int index) { + return code_.getByteString(index); + } + /** + * repeated string code = 2; + * + *
+       * A list of string codes which can be used for any repeated strings in the path args. This is
+       * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+       * that contains the codes.
+       * 
+ */ + public Builder setCode( + int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureCodeIsMutable(); + code_.set(index, value); + onChanged(); + return this; + } + /** + * repeated string code = 2; + * + *
+       * A list of string codes which can be used for any repeated strings in the path args. This is
+       * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+       * that contains the codes.
+       * 
+ */ + public Builder addCode( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureCodeIsMutable(); + code_.add(value); + onChanged(); + return this; + } + /** + * repeated string code = 2; + * + *
+       * A list of string codes which can be used for any repeated strings in the path args. This is
+       * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+       * that contains the codes.
+       * 
+ */ + public Builder addAllCode( + java.lang.Iterable values) { + ensureCodeIsMutable(); + super.addAll(values, code_); + onChanged(); + return this; + } + /** + * repeated string code = 2; + * + *
+       * A list of string codes which can be used for any repeated strings in the path args. This is
+       * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+       * that contains the codes.
+       * 
+ */ + public Builder clearCode() { + code_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * repeated string code = 2; + * + *
+       * A list of string codes which can be used for any repeated strings in the path args. This is
+       * optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode,
+       * that contains the codes.
+       * 
+ */ + public Builder addCodeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureCodeIsMutable(); + code_.add(value); + onChanged(); + return this; + } + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.InstanceIdentifier) } @@ -9998,30 +10285,30 @@ public final class NormalizedNodeMessages { "controller.mdsal.PathArgumentAttribute\022@" + "\n\nattributes\030\005 \003(\0132,.org.opendaylight.co" + "ntroller.mdsal.Attribute\022\017\n\007intType\030\006 \001(" + - "\005\"X\n\022InstanceIdentifier\022B\n\targuments\030\001 \003" + + "\005\"f\n\022InstanceIdentifier\022B\n\targuments\030\001 \003" + "(\0132/.org.opendaylight.controller.mdsal.P" + - "athArgument\"\245\003\n\004Node\022\014\n\004path\030\001 \001(\t\022\014\n\004ty" + - "pe\030\002 \001(\t\022E\n\014pathArgument\030\003 \001(\0132/.org.ope" + - "ndaylight.controller.mdsal.PathArgument\022" + - "\017\n\007intType\030\004 \001(\005\022@\n\nattributes\030\005 \003(\0132,.o", - "rg.opendaylight.controller.mdsal.Attribu" + - "te\0226\n\005child\030\006 \003(\0132\'.org.opendaylight.con" + - "troller.mdsal.Node\022\r\n\005value\030\007 \001(\t\022\021\n\tval" + - "ueType\030\010 \001(\t\022\024\n\014intValueType\030\t \001(\005\022V\n\027in" + - "stanceIdentifierValue\030\n \001(\01325.org.openda" + - "ylight.controller.mdsal.InstanceIdentifi" + - "er\022\021\n\tbitsValue\030\013 \003(\t\022\014\n\004code\030\014 \003(\t\"`\n\tC" + - "ontainer\022\022\n\nparentPath\030\001 \002(\t\022?\n\016normaliz" + - "edNode\030\002 \001(\0132\'.org.opendaylight.controll" + - "er.mdsal.Node\"\246\001\n\014NodeMapEntry\022U\n\026instan", - "ceIdentifierPath\030\001 \002(\01325.org.opendayligh" + - "t.controller.mdsal.InstanceIdentifier\022?\n" + - "\016normalizedNode\030\002 \001(\0132\'.org.opendaylight" + - ".controller.mdsal.Node\"N\n\007NodeMap\022C\n\nmap" + - "Entries\030\001 \003(\0132/.org.opendaylight.control" + - "ler.mdsal.NodeMapEntryBO\n5org.opendaylig" + - "ht.controller.protobuff.messages.commonB" + - "\026NormalizedNodeMessages" + "athArgument\022\014\n\004code\030\002 \003(\t\"\245\003\n\004Node\022\014\n\004pa" + + "th\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022E\n\014pathArgument\030\003" + + " \001(\0132/.org.opendaylight.controller.mdsal" + + ".PathArgument\022\017\n\007intType\030\004 \001(\005\022@\n\nattrib", + "utes\030\005 \003(\0132,.org.opendaylight.controller" + + ".mdsal.Attribute\0226\n\005child\030\006 \003(\0132\'.org.op" + + "endaylight.controller.mdsal.Node\022\r\n\005valu" + + "e\030\007 \001(\t\022\021\n\tvalueType\030\010 \001(\t\022\024\n\014intValueTy" + + "pe\030\t \001(\005\022V\n\027instanceIdentifierValue\030\n \001(" + + "\01325.org.opendaylight.controller.mdsal.In" + + "stanceIdentifier\022\021\n\tbitsValue\030\013 \003(\t\022\014\n\004c" + + "ode\030\014 \003(\t\"`\n\tContainer\022\022\n\nparentPath\030\001 \002" + + "(\t\022?\n\016normalizedNode\030\002 \001(\0132\'.org.openday" + + "light.controller.mdsal.Node\"\246\001\n\014NodeMapE", + "ntry\022U\n\026instanceIdentifierPath\030\001 \002(\01325.o" + + "rg.opendaylight.controller.mdsal.Instanc" + + "eIdentifier\022?\n\016normalizedNode\030\002 \001(\0132\'.or" + + "g.opendaylight.controller.mdsal.Node\"N\n\007" + + "NodeMap\022C\n\nmapEntries\030\001 \003(\0132/.org.openda" + + "ylight.controller.mdsal.NodeMapEntryBO\n5" + + "org.opendaylight.controller.protobuff.me" + + "ssages.commonB\026NormalizedNodeMessages" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -10057,7 +10344,7 @@ public final class NormalizedNodeMessages { internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor, - new java.lang.String[] { "Arguments", }); + new java.lang.String[] { "Arguments", "Code", }); internal_static_org_opendaylight_controller_mdsal_Node_descriptor = getDescriptor().getMessageTypes().get(5); internal_static_org_opendaylight_controller_mdsal_Node_fieldAccessorTable = new diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/resources/Common.proto b/opendaylight/md-sal/sal-clustering-commons/src/main/resources/Common.proto index 0b3ff21eb7..356bfbf684 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/resources/Common.proto +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/resources/Common.proto @@ -37,6 +37,11 @@ message PathArgument { message InstanceIdentifier { repeated PathArgument arguments=1; + + // A list of string codes which can be used for any repeated strings in the path args. This is + // optional - an InstanceIdentifier may be encoded as part of another message, eg NormalizedNode, + // that contains the codes. + repeated string code = 2; } message Node{ diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java index a9f9c722de..6de1083cbe 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java @@ -68,15 +68,12 @@ public class NormalizedNodeToNodeCodecTest { new NormalizedNodeToNodeCodec(schemaContext); long start = System.currentTimeMillis(); Container container = - codec.encode(instanceIdentifierFromString(id), output); + codec.encode(output); long end = System.currentTimeMillis(); System.out.println("Timetaken to encode :"+(end-start)); assertNotNull(container); - assertEquals(id, container.getParentPath() + "/" - + NormalizedNodeSerializer.deSerialize(container.getNormalizedNode(), - container.getNormalizedNode().getPathArgument())); // Decode the normalized node from the ProtocolBuffer form // first get the node representation of normalized node @@ -84,7 +81,7 @@ public class NormalizedNodeToNodeCodecTest { start = System.currentTimeMillis(); NormalizedNode normalizedNode = - codec.decode(instanceIdentifierFromString(id), node); + codec.decode(node); end = System.currentTimeMillis(); System.out.println("Timetaken to decode :"+(end-start)); @@ -102,26 +99,18 @@ public class NormalizedNodeToNodeCodecTest { new NormalizedNodeToNodeCodec(schemaContext); Container container = - normalizedNodeToNodeCodec.encode(YangInstanceIdentifier.builder() - .build(), documentOne); + normalizedNodeToNodeCodec.encode(documentOne); final NormalizedNode decode = normalizedNodeToNodeCodec .decode( - instanceIdentifierFromString("/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test"), container.getNormalizedNode()); assertNotNull(decode); // let us ensure that the return decode normalized node encode returns same container Container containerResult = - normalizedNodeToNodeCodec.encode(YangInstanceIdentifier.builder() - .build(), decode); - - assertEquals(container.getParentPath(), containerResult.getParentPath()); - - assertEquals(containerResult.getNormalizedNode().getChildCount(), - container.getNormalizedNode().getChildCount()); + normalizedNodeToNodeCodec.encode(decode); // check first level children are proper List childrenResult = @@ -174,11 +163,11 @@ public class NormalizedNodeToNodeCodecTest { NormalizedNodeToNodeCodec codec = new NormalizedNodeToNodeCodec(schemaContext); - Container encode = codec.encode(identifier, uno); + Container encode = codec.encode(uno); System.out.println(encode.getNormalizedNode()); - codec.decode(identifier, encode.getNormalizedNode()); + codec.decode(encode.getNormalizedNode()); } } diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtilsTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtilsTest.java index ffa8a1059e..d1e3eb202f 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtilsTest.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtilsTest.java @@ -14,15 +14,6 @@ import static junit.framework.TestCase.assertEquals; public class PathUtilsTest { - @Test - public void getParentPath(){ - assertEquals("", PathUtils.getParentPath("foobar")); - assertEquals("", PathUtils.getParentPath("/a")); - assertEquals("/a", PathUtils.getParentPath("/a/b")); - assertEquals("/a/b", PathUtils.getParentPath("/a/b/c")); - assertEquals("/a/b", PathUtils.getParentPath("a/b/c")); - } - @Test public void toStringNodeIdentifier(){ YangInstanceIdentifier.PathArgument pathArgument = nodeIdentifier(); diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentSerializerTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentSerializerTest.java index d1f21ee6f4..0990cdd4aa 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentSerializerTest.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentSerializerTest.java @@ -40,8 +40,7 @@ public class PathArgumentSerializerTest{ expectedException.expect(NullPointerException.class); expectedException.expectMessage("pathArgument should not be null"); - PathArgumentSerializer.serialize(mock( - NormalizedNodeSerializationContext.class), null); + PathArgumentSerializer.serialize(mock(QNameSerializationContext.class), null); } @@ -59,14 +58,13 @@ public class PathArgumentSerializerTest{ expectedException.expect(NullPointerException.class); expectedException.expectMessage("pathArgument should not be null"); - PathArgumentSerializer.deSerialize(mock(NormalizedNodeDeSerializationContext.class), null); + PathArgumentSerializer.deSerialize(mock(QNameDeSerializationContext.class), null); } @Test public void testSerializeNodeIdentifier(){ - NormalizedNodeSerializationContext serializationContext = - mock(NormalizedNodeSerializationContext.class); + QNameSerializationContext serializationContext = mock(QNameSerializationContext.class); when(serializationContext.addLocalName(anyString())).thenReturn(5); when(serializationContext.addNamespace(any(URI.class))).thenReturn(10); @@ -87,8 +85,7 @@ public class PathArgumentSerializerTest{ @Test public void testSerializeNodeIdentifierWithValue(){ - NormalizedNodeSerializationContext serializationContext = - mock(NormalizedNodeSerializationContext.class); + QNameSerializationContext serializationContext = mock(QNameSerializationContext.class); when(serializationContext.addLocalName(anyString())).thenReturn(5); when(serializationContext.addNamespace(any(URI.class))).thenReturn(10); @@ -110,9 +107,7 @@ public class PathArgumentSerializerTest{ @Test public void testSerializeNodeIdentifierWithPredicates(){ - NormalizedNodeSerializationContext serializationContext = - mock(NormalizedNodeSerializationContext.class); - + QNameSerializationContext serializationContext = mock(QNameSerializationContext.class); when(serializationContext.addLocalName("test")).thenReturn(5); when(serializationContext.addLocalName("child-name")).thenReturn(55); @@ -150,8 +145,7 @@ public class PathArgumentSerializerTest{ @Test public void testSerializeAugmentationIdentifier(){ - NormalizedNodeSerializationContext serializationContext = - mock(NormalizedNodeSerializationContext.class); + QNameSerializationContext serializationContext = mock(QNameSerializationContext.class); when(serializationContext.addLocalName(anyString())).thenReturn(55); when(serializationContext.addNamespace(any(URI.class))).thenReturn(66); diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializerTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializerTest.java index af7a385cbb..88c2695075 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializerTest.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializerTest.java @@ -5,15 +5,14 @@ import com.google.common.collect.ImmutableSet; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.mockito.Mockito; import org.opendaylight.controller.cluster.datastore.util.TestModel; import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; - import java.math.BigDecimal; import java.math.BigInteger; import java.util.Set; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; @@ -27,14 +26,15 @@ public class ValueSerializerTest{ public void testSerializeShort(){ short v1 = 5; NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder(); - ValueSerializer.serialize(builder, mock(NormalizedNodeSerializationContext.class), v1); + ValueSerializer.serialize(builder, mock(QNameSerializationContext.class), v1); assertEquals(ValueType.SHORT_TYPE.ordinal(), builder.getIntValueType()); assertEquals("5", builder.getValue()); - NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder(); + NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = + NormalizedNodeMessages.PathArgumentAttribute.newBuilder(); - ValueSerializer.serialize(builder1, mock(NormalizedNodeSerializationContext.class), v1); + ValueSerializer.serialize(builder1, mock(QNameSerializationContext.class), v1); assertEquals(ValueType.SHORT_TYPE.ordinal(), builder1.getType()); assertEquals("5", builder.getValue()); @@ -49,16 +49,15 @@ public class ValueSerializerTest{ NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder(); - ValueSerializer.serialize(builder, mock( - NormalizedNodeSerializationContext.class), expected); + ValueSerializer.serialize(builder, mock(QNameSerializationContext.class), expected); assertEquals(ValueType.INT_TYPE.ordinal(), builder.getIntValueType()); assertEquals("243", builder.getValue()); - NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder(); + NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = + NormalizedNodeMessages.PathArgumentAttribute.newBuilder(); - ValueSerializer.serialize(builder1, mock( - NormalizedNodeSerializationContext.class), expected); + ValueSerializer.serialize(builder1, mock(QNameSerializationContext.class), expected); assertEquals(ValueType.INT_TYPE.ordinal(), builder1.getType()); assertEquals("243", builder1.getValue()); @@ -71,16 +70,14 @@ public class ValueSerializerTest{ public void testSerializeLong(){ long v1 = 5; NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder(); - ValueSerializer.serialize(builder, mock( - NormalizedNodeSerializationContext.class), v1); + ValueSerializer.serialize(builder, mock(QNameSerializationContext.class), v1); assertEquals(ValueType.LONG_TYPE.ordinal(), builder.getIntValueType()); assertEquals("5", builder.getValue()); NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder(); - ValueSerializer.serialize(builder1, mock( - NormalizedNodeSerializationContext.class), v1); + ValueSerializer.serialize(builder1, mock(QNameSerializationContext.class), v1); assertEquals(ValueType.LONG_TYPE.ordinal(), builder1.getType()); assertEquals("5", builder1.getValue()); @@ -91,16 +88,14 @@ public class ValueSerializerTest{ public void testSerializeByte(){ byte v1 = 5; NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder(); - ValueSerializer.serialize(builder, mock( - NormalizedNodeSerializationContext.class), v1); + ValueSerializer.serialize(builder, mock(QNameSerializationContext.class), v1); assertEquals(ValueType.BYTE_TYPE.ordinal(), builder.getIntValueType()); assertEquals("5", builder.getValue()); NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder(); - ValueSerializer.serialize(builder1, mock( - NormalizedNodeSerializationContext.class), v1); + ValueSerializer.serialize(builder1, mock(QNameSerializationContext.class), v1); assertEquals(ValueType.BYTE_TYPE.ordinal(), builder1.getType()); assertEquals("5", builder1.getValue()); @@ -110,8 +105,7 @@ public class ValueSerializerTest{ @Test public void testSerializeBits(){ NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder(); - ValueSerializer.serialize(builder, mock( - NormalizedNodeSerializationContext.class), + ValueSerializer.serialize(builder, mock(QNameSerializationContext.class), ImmutableSet.of("foo", "bar")); assertEquals(ValueType.BITS_TYPE.ordinal(), builder.getIntValueType()); @@ -120,8 +114,7 @@ public class ValueSerializerTest{ NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder(); - ValueSerializer.serialize(builder1, mock( - NormalizedNodeSerializationContext.class), + ValueSerializer.serialize(builder1, mock(QNameSerializationContext.class), ImmutableSet.of("foo", "bar")); assertEquals(ValueType.BITS_TYPE.ordinal(), builder1.getType()); @@ -134,8 +127,7 @@ public class ValueSerializerTest{ expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Expected value type to be Bits but was :"); NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder(); - ValueSerializer.serialize(builder, mock( - NormalizedNodeSerializationContext.class), + ValueSerializer.serialize(builder, mock(QNameSerializationContext.class), ImmutableSet.of(1, 2)); } @@ -143,16 +135,14 @@ public class ValueSerializerTest{ @Test public void testSerializeEmptyString(){ NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder(); - ValueSerializer.serialize(builder, mock( - NormalizedNodeSerializationContext.class),""); + ValueSerializer.serialize(builder, mock(QNameSerializationContext.class),""); assertEquals(ValueType.STRING_TYPE.ordinal(), builder.getIntValueType()); assertEquals("", builder.getValue()); NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder(); - ValueSerializer.serialize(builder1, mock( - NormalizedNodeSerializationContext.class),""); + ValueSerializer.serialize(builder1, mock(QNameSerializationContext.class),""); assertEquals(ValueType.STRING_TYPE.ordinal(), builder1.getType()); assertEquals("", builder1.getValue()); @@ -162,16 +152,15 @@ public class ValueSerializerTest{ @Test public void testSerializeString(){ NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder(); - ValueSerializer.serialize(builder, mock( - NormalizedNodeSerializationContext.class),"foo"); + ValueSerializer.serialize(builder, mock(QNameSerializationContext.class),"foo"); assertEquals(ValueType.STRING_TYPE.ordinal(), builder.getIntValueType()); assertEquals("foo", builder.getValue()); - NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder(); + NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = + NormalizedNodeMessages.PathArgumentAttribute.newBuilder(); - ValueSerializer.serialize(builder1, mock( - NormalizedNodeSerializationContext.class),"foo"); + ValueSerializer.serialize(builder1, mock(QNameSerializationContext.class),"foo"); assertEquals(ValueType.STRING_TYPE.ordinal(), builder1.getType()); assertEquals("foo", builder1.getValue()); @@ -183,15 +172,14 @@ public class ValueSerializerTest{ public void testSerializeBoolean(){ boolean v1 = true; NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder(); - ValueSerializer.serialize(builder, mock( - NormalizedNodeSerializationContext.class), v1); + ValueSerializer.serialize(builder, mock(QNameSerializationContext.class), v1); assertEquals(ValueType.BOOL_TYPE.ordinal(), builder.getIntValueType()); assertEquals("true", builder.getValue()); - NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder(); - ValueSerializer.serialize(builder1, mock( - NormalizedNodeSerializationContext.class), v1); + NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = + NormalizedNodeMessages.PathArgumentAttribute.newBuilder(); + ValueSerializer.serialize(builder1, mock(QNameSerializationContext.class), v1); assertEquals(ValueType.BOOL_TYPE.ordinal(), builder1.getType()); assertEquals("true", builder1.getValue()); @@ -201,16 +189,14 @@ public class ValueSerializerTest{ public void testSerializeQName(){ QName v1 = TestModel.TEST_QNAME; NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder(); - ValueSerializer.serialize(builder, mock( - NormalizedNodeSerializationContext.class), v1); + ValueSerializer.serialize(builder, mock(QNameSerializationContext.class), v1); assertEquals(ValueType.QNAME_TYPE.ordinal(), builder.getIntValueType()); assertEquals("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test", builder.getValue()); NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder(); - ValueSerializer.serialize(builder1, mock( - NormalizedNodeSerializationContext.class), v1); + ValueSerializer.serialize(builder1, mock(QNameSerializationContext.class), v1); assertEquals(ValueType.QNAME_TYPE.ordinal(), builder1.getType()); assertEquals("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test", builder1.getValue()); @@ -222,32 +208,30 @@ public class ValueSerializerTest{ YangInstanceIdentifier v1 = TestModel.TEST_PATH; NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder(); - ValueSerializer.serialize(builder, mock( - NormalizedNodeSerializationContext.class), v1); - + QNameSerializationContext mockContext = mock(QNameSerializationContext.class); + ValueSerializer.serialize(builder, mockContext, v1); assertEquals(ValueType.YANG_IDENTIFIER_TYPE.ordinal(), builder.getIntValueType()); NormalizedNodeMessages.InstanceIdentifier serializedYangInstanceIdentifier = builder.getInstanceIdentifierValue(); assertEquals(1, serializedYangInstanceIdentifier.getArgumentsCount()); - assertEquals(TestModel.TEST_QNAME.toString(), serializedYangInstanceIdentifier.getArguments(0).getNodeType().getValue()); + Mockito.verify(mockContext).addLocalName(TestModel.TEST_QNAME.getLocalName()); + Mockito.verify(mockContext).addNamespace(TestModel.TEST_QNAME.getNamespace()); } @Test public void testSerializeBigInteger(){ BigInteger v1 = new BigInteger("1000000000000000000000000"); NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder(); - ValueSerializer.serialize(builder, mock( - NormalizedNodeSerializationContext.class), v1); + ValueSerializer.serialize(builder, mock(QNameSerializationContext.class), v1); assertEquals(ValueType.BIG_INTEGER_TYPE.ordinal(), builder.getIntValueType()); assertEquals("1000000000000000000000000", builder.getValue()); NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder(); - ValueSerializer.serialize(builder1, mock( - NormalizedNodeSerializationContext.class), v1); + ValueSerializer.serialize(builder1, mock(QNameSerializationContext.class), v1); assertEquals(ValueType.BIG_INTEGER_TYPE.ordinal(), builder1.getType()); assertEquals("1000000000000000000000000", builder1.getValue()); @@ -258,15 +242,13 @@ public class ValueSerializerTest{ public void testSerializeBigDecimal(){ BigDecimal v1 = new BigDecimal("1000000000000000000000000.51616"); NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder(); - ValueSerializer.serialize(builder, mock( - NormalizedNodeSerializationContext.class), v1); + ValueSerializer.serialize(builder, mock(QNameSerializationContext.class), v1); assertEquals(ValueType.BIG_DECIMAL_TYPE.ordinal(), builder.getIntValueType()); assertEquals("1000000000000000000000000.51616", builder.getValue()); NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder(); - ValueSerializer.serialize(builder1, mock( - NormalizedNodeSerializationContext.class), v1); + ValueSerializer.serialize(builder1, mock(QNameSerializationContext.class), v1); assertEquals(ValueType.BIG_DECIMAL_TYPE.ordinal(), builder1.getType()); assertEquals("1000000000000000000000000.51616", builder1.getValue()); @@ -280,7 +262,7 @@ public class ValueSerializerTest{ nodeBuilder.setValue("25"); Object o = ValueSerializer - .deSerialize(mock(NormalizedNodeDeSerializationContext.class), + .deSerialize(mock(QNameDeSerializationContext.class), nodeBuilder.build()); assertTrue(o instanceof Short); @@ -294,7 +276,7 @@ public class ValueSerializerTest{ nodeBuilder.setValue("25"); Object o = ValueSerializer - .deSerialize(mock(NormalizedNodeDeSerializationContext.class), + .deSerialize(mock(QNameDeSerializationContext.class), nodeBuilder.build()); assertTrue(o instanceof Byte); @@ -309,7 +291,7 @@ public class ValueSerializerTest{ nodeBuilder.setValue("25"); Object o = ValueSerializer - .deSerialize(mock(NormalizedNodeDeSerializationContext.class), + .deSerialize(mock(QNameDeSerializationContext.class), nodeBuilder.build()); assertTrue(o instanceof Integer); @@ -324,7 +306,7 @@ public class ValueSerializerTest{ nodeBuilder.setValue("25"); Object o = ValueSerializer - .deSerialize(mock(NormalizedNodeDeSerializationContext.class), + .deSerialize(mock(QNameDeSerializationContext.class), nodeBuilder.build()); assertTrue(o instanceof Long); @@ -339,7 +321,7 @@ public class ValueSerializerTest{ nodeBuilder.setValue("false"); Object o = ValueSerializer - .deSerialize(mock(NormalizedNodeDeSerializationContext.class), + .deSerialize(mock(QNameDeSerializationContext.class), nodeBuilder.build()); assertTrue(o instanceof Boolean); @@ -354,7 +336,7 @@ public class ValueSerializerTest{ nodeBuilder.setValue(TestModel.TEST_QNAME.toString()); Object o = ValueSerializer - .deSerialize(mock(NormalizedNodeDeSerializationContext.class), + .deSerialize(mock(QNameDeSerializationContext.class), nodeBuilder.build()); assertTrue(o instanceof QName); @@ -369,7 +351,7 @@ public class ValueSerializerTest{ nodeBuilder.addAllBitsValue(ImmutableList.of("foo", "bar")); Object o = ValueSerializer - .deSerialize(mock(NormalizedNodeDeSerializationContext.class), + .deSerialize(mock(QNameDeSerializationContext.class), nodeBuilder.build()); assertTrue(o instanceof Set); @@ -384,7 +366,6 @@ public class ValueSerializerTest{ NormalizedNodeMessages.InstanceIdentifier.Builder idBuilder = NormalizedNodeMessages.InstanceIdentifier.newBuilder(); NormalizedNodeMessages.PathArgument.Builder pathBuilder = NormalizedNodeMessages.PathArgument.newBuilder(); - pathBuilder.setValue(TestModel.TEST_QNAME.toString()); pathBuilder.setIntType(PathArgumentType.NODE_IDENTIFIER.ordinal()); idBuilder.addArguments(pathBuilder); @@ -392,9 +373,15 @@ public class ValueSerializerTest{ nodeBuilder.setIntValueType(ValueType.YANG_IDENTIFIER_TYPE.ordinal()); nodeBuilder.setInstanceIdentifierValue(idBuilder); - Object o = ValueSerializer - .deSerialize(mock(NormalizedNodeDeSerializationContext.class), - nodeBuilder.build()); + QNameDeSerializationContext mockContext = mock(QNameDeSerializationContext.class); + Mockito.doReturn(TestModel.TEST_QNAME.getNamespace().toString()).when(mockContext). + getNamespace(Mockito.anyInt()); + Mockito.doReturn(TestModel.TEST_QNAME.getLocalName()).when(mockContext). + getLocalName(Mockito.anyInt()); + Mockito.doReturn(TestModel.TEST_QNAME.getFormattedRevision()).when(mockContext). + getRevision(Mockito.anyInt()); + + Object o = ValueSerializer.deSerialize(mockContext, nodeBuilder.build()); assertTrue(o instanceof YangInstanceIdentifier); assertEquals(TestModel.TEST_PATH, o); @@ -407,8 +394,7 @@ public class ValueSerializerTest{ nodeBuilder.setIntValueType(ValueType.STRING_TYPE.ordinal()); nodeBuilder.setValue("25"); - Object o = ValueSerializer - .deSerialize(mock(NormalizedNodeDeSerializationContext.class), + Object o = ValueSerializer.deSerialize(mock(QNameDeSerializationContext.class), nodeBuilder.build()); assertTrue(o instanceof String); @@ -423,7 +409,7 @@ public class ValueSerializerTest{ nodeBuilder.setValue("25"); Object o = ValueSerializer - .deSerialize(mock(NormalizedNodeDeSerializationContext.class), + .deSerialize(mock(QNameDeSerializationContext.class), nodeBuilder.build()); assertTrue(o instanceof BigInteger); @@ -438,7 +424,7 @@ public class ValueSerializerTest{ nodeBuilder.setValue("25"); Object o = ValueSerializer - .deSerialize(mock(NormalizedNodeDeSerializationContext.class), + .deSerialize(mock(QNameDeSerializationContext.class), nodeBuilder.build()); assertTrue(o instanceof BigDecimal); diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java index 136748e341..6cd06e9c1c 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java @@ -12,10 +12,12 @@ package org.opendaylight.controller.cluster.datastore.util; import org.junit.Assert; import org.junit.Test; +import org.opendaylight.controller.cluster.datastore.node.utils.serialization.QNameDeSerializationContext; +import org.opendaylight.controller.cluster.datastore.node.utils.serialization.QNameDeSerializationContextImpl; +import org.opendaylight.controller.cluster.datastore.node.utils.serialization.QNameSerializationContextImpl; import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; - import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -23,139 +25,137 @@ import java.util.List; public class InstanceIdentifierUtilsTest { - private static QName TEST_QNAME = - QName - .create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test"); - private static QName NODE_WITH_VALUE_QNAME = - QName - .create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)value"); - private static QName NODE_WITH_PREDICATES_QNAME = - QName - .create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)pred"); - private static QName NAME_QNAME = - QName - .create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)name"); - - @Test - public void testSerializationOfNodeIdentifier() { - YangInstanceIdentifier.PathArgument p1 = - new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME); - - List arguments = new ArrayList<>(); - - arguments.add(p1); + private static QName TEST_QNAME = QName + .create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test"); + private static QName NODE_WITH_VALUE_QNAME = QName + .create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)value"); + private static QName NODE_WITH_PREDICATES_QNAME = QName + .create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)pred"); + private static QName NAME_QNAME = QName + .create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)name"); - YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments); + @Test + public void testSerializationOfNodeIdentifier() { + YangInstanceIdentifier.PathArgument p1 = new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME); - NormalizedNodeMessages.InstanceIdentifier instanceIdentifier = - InstanceIdentifierUtils.toSerializable(expected); + List arguments = new ArrayList<>(); - YangInstanceIdentifier actual = - InstanceIdentifierUtils.fromSerializable(instanceIdentifier); + arguments.add(p1); + YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments); - Assert.assertEquals(expected.getLastPathArgument(), - actual.getLastPathArgument()); + NormalizedNodeMessages.InstanceIdentifier instanceIdentifier = + InstanceIdentifierUtils.toSerializable(expected); + YangInstanceIdentifier actual = InstanceIdentifierUtils.fromSerializable(instanceIdentifier); - } + Assert.assertEquals(expected.getLastPathArgument(), actual.getLastPathArgument()); + } - @Test - public void testSerializationOfNodeWithValue() { + @Test + public void testSerializationOfNodeWithValue() { - withValue((short) 1); - withValue((long) 2); - withValue(3); - withValue(true); + withValue((short) 1); + withValue((long) 2); + withValue(3); + withValue(true); - } + } - private void withValue(Object value) { - YangInstanceIdentifier.PathArgument p1 = - new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME); + private void withValue(Object value) { + YangInstanceIdentifier.PathArgument p1 = new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME); - YangInstanceIdentifier.PathArgument p2 = - new YangInstanceIdentifier.NodeWithValue(NODE_WITH_VALUE_QNAME, value); + YangInstanceIdentifier.PathArgument p2 = + new YangInstanceIdentifier.NodeWithValue(NODE_WITH_VALUE_QNAME, value); + List arguments = new ArrayList<>(); - List arguments = new ArrayList<>(); + arguments.add(p1); + arguments.add(p2); - arguments.add(p1); - arguments.add(p2); + YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments); - YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments); + NormalizedNodeMessages.InstanceIdentifier instanceIdentifier = + InstanceIdentifierUtils.toSerializable(expected); - NormalizedNodeMessages.InstanceIdentifier instanceIdentifier = - InstanceIdentifierUtils.toSerializable(expected); + YangInstanceIdentifier actual = InstanceIdentifierUtils.fromSerializable(instanceIdentifier); - YangInstanceIdentifier actual = - InstanceIdentifierUtils.fromSerializable(instanceIdentifier); + Assert.assertEquals(expected.getLastPathArgument(), actual.getLastPathArgument()); + } + @Test + public void testSerializationOfNodeIdentifierWithPredicates() { - Assert.assertEquals(expected.getLastPathArgument(), - actual.getLastPathArgument()); - } + withPredicates((short) 1); + withPredicates((long) 2); + withPredicates(3); + withPredicates(true); + } - @Test - public void testSerializationOfNodeIdentifierWithPredicates() { + private void withPredicates(Object value) { + YangInstanceIdentifier.PathArgument p1 = new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME); - withPredicates((short) 1); - withPredicates((long) 2); - withPredicates(3); - withPredicates(true); + YangInstanceIdentifier.PathArgument p2 = new YangInstanceIdentifier.NodeIdentifierWithPredicates( + NODE_WITH_PREDICATES_QNAME, NAME_QNAME, value); - } + List arguments = new ArrayList<>(); - private void withPredicates(Object value) { - YangInstanceIdentifier.PathArgument p1 = - new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME); + arguments.add(p1); + arguments.add(p2); - YangInstanceIdentifier.PathArgument p2 = - new YangInstanceIdentifier.NodeIdentifierWithPredicates( - NODE_WITH_PREDICATES_QNAME, NAME_QNAME, value); + YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments); + NormalizedNodeMessages.InstanceIdentifier instanceIdentifier = + InstanceIdentifierUtils.toSerializable(expected); - List arguments = new ArrayList<>(); + YangInstanceIdentifier actual = InstanceIdentifierUtils.fromSerializable(instanceIdentifier); - arguments.add(p1); - arguments.add(p2); + Assert.assertEquals(expected.getLastPathArgument(), actual.getLastPathArgument()); + } - YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments); + @Test + public void testAugmentationIdentifier() { + YangInstanceIdentifier.PathArgument p1 = new YangInstanceIdentifier.AugmentationIdentifier(new HashSet( + Arrays.asList(TEST_QNAME))); - NormalizedNodeMessages.InstanceIdentifier instanceIdentifier = - InstanceIdentifierUtils.toSerializable(expected); + List arguments = new ArrayList<>(); - YangInstanceIdentifier actual = - InstanceIdentifierUtils.fromSerializable(instanceIdentifier); + arguments.add(p1); + YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments); - Assert.assertEquals(expected.getLastPathArgument(), - actual.getLastPathArgument()); - } + NormalizedNodeMessages.InstanceIdentifier instanceIdentifier = + InstanceIdentifierUtils.toSerializable(expected); - @Test - public void testAugmentationIdentifier() { - YangInstanceIdentifier.PathArgument p1 = - new YangInstanceIdentifier.AugmentationIdentifier(new HashSet( - Arrays.asList(TEST_QNAME))); + YangInstanceIdentifier actual = InstanceIdentifierUtils.fromSerializable(instanceIdentifier); - List arguments = new ArrayList<>(); + Assert.assertEquals(expected.getLastPathArgument(), actual.getLastPathArgument()); - arguments.add(p1); + } - YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments); + @Test + public void testSerializationWithContext() { + List arguments = + Arrays.asList( + new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME), + new YangInstanceIdentifier.NodeWithValue(NODE_WITH_VALUE_QNAME, 1), + new YangInstanceIdentifier.NodeIdentifierWithPredicates( + NODE_WITH_PREDICATES_QNAME, NAME_QNAME, 2)); - NormalizedNodeMessages.InstanceIdentifier instanceIdentifier = - InstanceIdentifierUtils.toSerializable(expected); + YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments); - YangInstanceIdentifier actual = - InstanceIdentifierUtils.fromSerializable(instanceIdentifier); + QNameSerializationContextImpl serializationContext = new QNameSerializationContextImpl(); + NormalizedNodeMessages.InstanceIdentifier instanceIdentifier = + InstanceIdentifierUtils.toSerializable(expected, serializationContext); - Assert.assertEquals(expected.getLastPathArgument(), - actual.getLastPathArgument()); + QNameDeSerializationContext deserializationContext = new QNameDeSerializationContextImpl( + serializationContext.getCodes()); - } + YangInstanceIdentifier actual = InstanceIdentifierUtils.fromSerializable( + instanceIdentifier, deserializationContext); + Assert.assertEquals(expected.getLastPathArgument(), actual.getLastPathArgument()); + } } diff --git a/opendaylight/md-sal/sal-clustering-config/pom.xml b/opendaylight/md-sal/sal-clustering-config/pom.xml index 91c0b5caa1..1c018cade1 100644 --- a/opendaylight/md-sal/sal-clustering-config/pom.xml +++ b/opendaylight/md-sal/sal-clustering-config/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-clustering-config Configuration files for md-sal clustering diff --git a/opendaylight/md-sal/sal-common-api/pom.xml b/opendaylight/md-sal/sal-common-api/pom.xml index e46fe1fe78..6af20c0fb8 100644 --- a/opendaylight/md-sal/sal-common-api/pom.xml +++ b/opendaylight/md-sal/sal-common-api/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-common-api diff --git a/opendaylight/md-sal/sal-common-impl/pom.xml b/opendaylight/md-sal/sal-common-impl/pom.xml index 82bd716c59..542a1f3905 100644 --- a/opendaylight/md-sal/sal-common-impl/pom.xml +++ b/opendaylight/md-sal/sal-common-impl/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-common-impl bundle diff --git a/opendaylight/md-sal/sal-common-util/pom.xml b/opendaylight/md-sal/sal-common-util/pom.xml index e42c86a993..b285c991e5 100644 --- a/opendaylight/md-sal/sal-common-util/pom.xml +++ b/opendaylight/md-sal/sal-common-util/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-common-util diff --git a/opendaylight/md-sal/sal-common/pom.xml b/opendaylight/md-sal/sal-common/pom.xml index f200b5551f..e5450b2487 100644 --- a/opendaylight/md-sal/sal-common/pom.xml +++ b/opendaylight/md-sal/sal-common/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-common diff --git a/opendaylight/md-sal/sal-connector-api/pom.xml b/opendaylight/md-sal/sal-connector-api/pom.xml index 4e7d82dad3..e45e24dd56 100644 --- a/opendaylight/md-sal/sal-connector-api/pom.xml +++ b/opendaylight/md-sal/sal-connector-api/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-connector-api diff --git a/opendaylight/md-sal/sal-distributed-datastore/pom.xml b/opendaylight/md-sal/sal-distributed-datastore/pom.xml index 82998226b6..d7e7d56d49 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/pom.xml +++ b/opendaylight/md-sal/sal-distributed-datastore/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-distributed-datastore bundle @@ -80,7 +80,7 @@ org.opendaylight.controller sal-inmemory-datastore - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT @@ -131,13 +131,13 @@ org.opendaylight.controller sal-clustering-commons - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT org.opendaylight.controller sal-akka-raft - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java index c780881a2f..5195a2f918 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java @@ -12,6 +12,7 @@ import akka.actor.ActorRef; import akka.actor.ActorSystem; import akka.dispatch.OnComplete; import akka.util.Timeout; +import com.google.common.base.Optional; import com.google.common.base.Preconditions; import org.opendaylight.controller.cluster.datastore.identifiers.ShardManagerIdentifier; import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListener; @@ -76,44 +77,44 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, Au Preconditions.checkNotNull(path, "path should not be null"); Preconditions.checkNotNull(listener, "listener should not be null"); - if(LOG.isDebugEnabled()) { - LOG.debug("Registering listener: {} for path: {} scope: {}", listener, path, scope); - } - ActorRef dataChangeListenerActor = actorContext.getActorSystem().actorOf( - DataChangeListener.props(listener )); + + LOG.debug("Registering listener: {} for path: {} scope: {}", listener, path, scope); String shardName = ShardStrategyFactory.getStrategy(path).findShard(path); - Future future = actorContext.executeLocalShardOperationAsync(shardName, - new RegisterChangeListener(path, dataChangeListenerActor.path(), scope), - new Timeout(actorContext.getOperationDuration().$times( - REGISTER_DATA_CHANGE_LISTENER_TIMEOUT_FACTOR))); + Optional shard = actorContext.findLocalShard(shardName); - if (future != null) { - final DataChangeListenerRegistrationProxy listenerRegistrationProxy = + //if shard is NOT local + if (!shard.isPresent()) { + LOG.debug("No local shard for shardName {} was found so returning a noop registration", shardName); + return new NoOpDataChangeListenerRegistration(listener); + } + //if shard is local + ActorRef dataChangeListenerActor = actorContext.getActorSystem().actorOf(DataChangeListener.props(listener)); + Future future = actorContext.executeOperationAsync(shard.get(), + new RegisterChangeListener(path, dataChangeListenerActor.path(), scope), + new Timeout(actorContext.getOperationDuration().$times(REGISTER_DATA_CHANGE_LISTENER_TIMEOUT_FACTOR))); + + final DataChangeListenerRegistrationProxy listenerRegistrationProxy = new DataChangeListenerRegistrationProxy(listener, dataChangeListenerActor); - future.onComplete(new OnComplete(){ + future.onComplete(new OnComplete() { - @Override public void onComplete(Throwable failure, Object result) + @Override + public void onComplete(Throwable failure, Object result) throws Throwable { - if(failure != null){ - LOG.error("Failed to register listener at path " + path.toString(), failure); - return; - } - RegisterChangeListenerReply reply = (RegisterChangeListenerReply) result; - listenerRegistrationProxy.setListenerRegistrationActor(actorContext - .actorSelection(reply.getListenerRegistrationPath())); + if (failure != null) { + LOG.error("Failed to register listener at path " + path.toString(), failure); + return; } - }, actorContext.getActorSystem().dispatcher()); - return listenerRegistrationProxy; - } - if(LOG.isDebugEnabled()) { - LOG.debug( - "No local shard for shardName {} was found so returning a noop registration", - shardName); - } - return new NoOpDataChangeListenerRegistration(listener); + RegisterChangeListenerReply reply = (RegisterChangeListenerReply) result; + listenerRegistrationProxy.setListenerRegistrationActor(actorContext + .actorSelection(reply.getListenerRegistrationPath())); + } + }, actorContext.getActorSystem().dispatcher()); + + return listenerRegistrationProxy; + } @Override diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java index ddb5989f09..3934489646 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java @@ -33,6 +33,7 @@ import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier import org.opendaylight.controller.cluster.datastore.identifiers.ShardTransactionIdentifier; import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardMBeanFactory; import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats; +import org.opendaylight.controller.cluster.datastore.messages.ActorInitialized; import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChain; import org.opendaylight.controller.cluster.datastore.messages.CommitTransactionReply; import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction; @@ -222,7 +223,9 @@ public class Shard extends RaftActor { getLeader().forward(message, getContext()); } else { getSender().tell(new akka.actor.Status.Failure(new IllegalStateException( - "Could not find leader so transaction cannot be created")), getSelf()); + "Could not find shard leader so transaction cannot be created. This typically happens" + + " when system is coming up or recovering and a leader is being elected. Try again" + + " later.")), getSelf()); } } else if (message instanceof PeerAddressResolved) { PeerAddressResolved resolved = (PeerAddressResolved) message; @@ -522,6 +525,9 @@ public class Shard extends RaftActor { recoveryCoordinator = null; currentLogRecoveryBatch = null; updateJournalStats(); + + //notify shard manager + getContext().parent().tell(new ActorInitialized(), getSelf()); } @Override @@ -588,7 +594,7 @@ public class Shard extends RaftActor { DOMStoreWriteTransaction transaction = store.newWriteOnlyTransaction(); NormalizedNodeMessages.Node serializedNode = NormalizedNodeMessages.Node.parseFrom(snapshot); NormalizedNode node = new NormalizedNodeToNodeCodec(schemaContext) - .decode(YangInstanceIdentifier.builder().build(), serializedNode); + .decode(serializedNode); // delete everything first transaction.delete(YangInstanceIdentifier.builder().build()); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java index a8a1823809..e68628dbf5 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java @@ -24,11 +24,13 @@ import akka.persistence.RecoveryCompleted; import akka.persistence.RecoveryFailure; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; -import org.opendaylight.controller.cluster.common.actor.AbstractUntypedPersistentActor; +import org.opendaylight.controller.cluster.common.actor.AbstractUntypedPersistentActorWithMetering; import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier; import org.opendaylight.controller.cluster.datastore.identifiers.ShardManagerIdentifier; import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shardmanager.ShardManagerInfo; import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shardmanager.ShardManagerInfoMBean; +import org.opendaylight.controller.cluster.datastore.messages.ActorInitialized; +import org.opendaylight.controller.cluster.datastore.messages.ActorNotInitialized; import org.opendaylight.controller.cluster.datastore.messages.FindLocalShard; import org.opendaylight.controller.cluster.datastore.messages.FindPrimary; import org.opendaylight.controller.cluster.datastore.messages.LocalShardFound; @@ -59,7 +61,7 @@ import java.util.Set; *
  • Monitor the cluster members and store their addresses *
      */ -public class ShardManager extends AbstractUntypedPersistentActor { +public class ShardManager extends AbstractUntypedPersistentActorWithMetering { protected final LoggingAdapter LOG = Logging.getLogger(getContext().system(), this); @@ -127,6 +129,8 @@ public class ShardManager extends AbstractUntypedPersistentActor { findLocalShard((FindLocalShard) message); } else if (message instanceof UpdateSchemaContext) { updateSchemaContext(message); + } else if(message instanceof ActorInitialized) { + onActorInitialized(message); } else if (message instanceof ClusterEvent.MemberUp){ memberUp((ClusterEvent.MemberUp) message); } else if(message instanceof ClusterEvent.MemberRemoved) { @@ -139,6 +143,31 @@ public class ShardManager extends AbstractUntypedPersistentActor { } + private void onActorInitialized(Object message) { + final ActorRef sender = getSender(); + + if (sender == null) { + return; //why is a non-actor sending this message? Just ignore. + } + + String actorName = sender.path().name(); + //find shard name from actor name; actor name is stringified shardId + ShardIdentifier shardId = ShardIdentifier.builder().fromShardIdString(actorName).build(); + + if (shardId.getShardName() == null) { + return; + } + markShardAsInitialized(shardId.getShardName()); + } + + @VisibleForTesting protected void markShardAsInitialized(String shardName) { + LOG.debug("Initializing shard [{}]", shardName); + ShardInformation shardInformation = localShards.get(shardName); + if (shardInformation != null) { + shardInformation.setShardInitialized(true); + } + } + @Override protected void handleRecover(Object message) throws Exception { if(message instanceof SchemaContextModules){ @@ -157,16 +186,23 @@ public class ShardManager extends AbstractUntypedPersistentActor { } private void findLocalShard(FindLocalShard message) { - ShardInformation shardInformation = - localShards.get(message.getShardName()); + ShardInformation shardInformation = localShards.get(message.getShardName()); - if(shardInformation != null){ - getSender().tell(new LocalShardFound(shardInformation.getActor()), getSelf()); + if(shardInformation == null){ + getSender().tell(new LocalShardNotFound(message.getShardName()), getSelf()); return; } - getSender().tell(new LocalShardNotFound(message.getShardName()), - getSelf()); + sendResponse(shardInformation, new LocalShardFound(shardInformation.getActor())); + } + + private void sendResponse(ShardInformation shardInformation, Object message) { + if (!shardInformation.isShardInitialized()) { + getSender().tell(new ActorNotInitialized(), getSelf()); + return; + } + + getSender().tell(message, getSelf()); } private void memberRemoved(ClusterEvent.MemberRemoved message) { @@ -176,7 +212,7 @@ public class ShardManager extends AbstractUntypedPersistentActor { private void memberUp(ClusterEvent.MemberUp message) { String memberName = message.member().roles().head(); - memberNameToAddress.put(memberName , message.member().address()); + memberNameToAddress.put(memberName, message.member().address()); for(ShardInformation info : localShards.values()){ String shardName = info.getShardName(); @@ -229,28 +265,27 @@ public class ShardManager extends AbstractUntypedPersistentActor { } private void findPrimary(FindPrimary message) { + final ActorRef sender = getSender(); String shardName = message.getShardName(); // First see if the there is a local replica for the shard ShardInformation info = localShards.get(shardName); - if(info != null) { + if (info != null) { ActorPath shardPath = info.getActorPath(); - if (shardPath != null) { - getSender() - .tell( - new PrimaryFound(shardPath.toString()).toSerializable(), - getSelf()); - return; - } + sendResponse(info, new PrimaryFound(shardPath.toString()).toSerializable()); + return; } - List members = - configuration.getMembersFromShardName(shardName); + List members = configuration.getMembersFromShardName(shardName); if(cluster.getCurrentMemberName() != null) { members.remove(cluster.getCurrentMemberName()); } + /** + * FIXME: Instead of sending remote shard actor path back to sender, + * forward FindPrimary message to remote shard manager + */ // There is no way for us to figure out the primary (for now) so assume // that one of the remote nodes is a primary for(String memberName : members) { @@ -376,6 +411,7 @@ public class ShardManager extends AbstractUntypedPersistentActor { private final ActorRef actor; private final ActorPath actorPath; private final Map peerAddresses; + private boolean shardInitialized = false; //flag that determines if the actor is ready for business private ShardInformation(String shardName, ActorRef actor, Map peerAddresses) { @@ -413,6 +449,14 @@ public class ShardManager extends AbstractUntypedPersistentActor { } } + + public boolean isShardInitialized() { + return shardInitialized; + } + + public void setShardInitialized(boolean shardInitialized) { + this.shardInitialized = shardInitialized; + } } private static class ShardManagerCreator implements Creator { diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardRecoveryCoordinator.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardRecoveryCoordinator.java index 8afdb4c280..94fb584102 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardRecoveryCoordinator.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardRecoveryCoordinator.java @@ -142,7 +142,7 @@ class ShardRecoveryCoordinator { try { NormalizedNodeMessages.Node serializedNode = NormalizedNodeMessages.Node.parseFrom(snapshot); NormalizedNode node = new NormalizedNodeToNodeCodec(schemaContext).decode( - YangInstanceIdentifier.builder().build(), serializedNode); + serializedNode); // delete everything first resultingTx.delete(YangInstanceIdentifier.builder().build()); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java index a7a5b31b17..515be372e8 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java @@ -157,7 +157,7 @@ public class ThreePhaseCommitCohortProxy implements DOMStoreThreePhaseCommitCoho } ActorSelection cohort = actorContext.actorSelection(actorPath); - futureList.add(actorContext.executeRemoteOperationAsync(cohort, message)); + futureList.add(actorContext.executeOperationAsync(cohort, message)); } return Futures.sequence(futureList, actorContext.getActorSystem().dispatcher()); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java index 6cf16b4426..19d9a66a52 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java @@ -22,6 +22,7 @@ import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.SettableFuture; +import org.opendaylight.controller.cluster.datastore.exceptions.PrimaryNotFoundException; import org.opendaylight.controller.cluster.datastore.identifiers.TransactionIdentifier; import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction; import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction; @@ -156,7 +157,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { if(remoteTransactionActorsMB.get()) { for(ActorSelection actor : remoteTransactionActors) { LOG.trace("Sending CloseTransaction to {}", actor); - actorContext.sendRemoteOperationAsync(actor, + actorContext.sendOperationAsync(actor, new CloseTransaction().toSerializable()); } } @@ -379,9 +380,14 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { } try { - Object response = actorContext.executeShardOperation(shardName, - new CreateTransaction(identifier.toString(), this.transactionType.ordinal(), - getTransactionChainId()).toSerializable()); + Optional primaryShard = actorContext.findPrimaryShard(shardName); + if (!primaryShard.isPresent()) { + throw new PrimaryNotFoundException("Primary could not be found for shard " + shardName); + } + + Object response = actorContext.executeOperation(primaryShard.get(), + new CreateTransaction(identifier.toString(), this.transactionType.ordinal(), + getTransactionChainId()).toSerializable()); if (response.getClass().equals(CreateTransactionReply.SERIALIZABLE_CLASS)) { CreateTransactionReply reply = CreateTransactionReply.fromSerializable(response); @@ -502,7 +508,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { if(LOG.isDebugEnabled()) { LOG.debug("Tx {} closeTransaction called", identifier); } - actorContext.sendRemoteOperationAsync(getActor(), new CloseTransaction().toSerializable()); + actorContext.sendOperationAsync(getActor(), new CloseTransaction().toSerializable()); } @Override @@ -513,7 +519,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { } // Send the ReadyTransaction message to the Tx actor. - final Future replyFuture = actorContext.executeRemoteOperationAsync(getActor(), + final Future replyFuture = actorContext.executeOperationAsync(getActor(), new ReadyTransaction().toSerializable()); // Combine all the previously recorded put/merge/delete operation reply Futures and the @@ -576,8 +582,8 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { if(LOG.isDebugEnabled()) { LOG.debug("Tx {} deleteData called path = {}", identifier, path); } - recordedOperationFutures.add(actorContext.executeRemoteOperationAsync(getActor(), - new DeleteData(path).toSerializable() )); + recordedOperationFutures.add(actorContext.executeOperationAsync(getActor(), + new DeleteData(path).toSerializable())); } @Override @@ -585,7 +591,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { if(LOG.isDebugEnabled()) { LOG.debug("Tx {} mergeData called path = {}", identifier, path); } - recordedOperationFutures.add(actorContext.executeRemoteOperationAsync(getActor(), + recordedOperationFutures.add(actorContext.executeOperationAsync(getActor(), new MergeData(path, data, schemaContext).toSerializable())); } @@ -594,7 +600,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { if(LOG.isDebugEnabled()) { LOG.debug("Tx {} writeData called path = {}", identifier, path); } - recordedOperationFutures.add(actorContext.executeRemoteOperationAsync(getActor(), + recordedOperationFutures.add(actorContext.executeOperationAsync(getActor(), new WriteData(path, data, schemaContext).toSerializable())); } @@ -686,7 +692,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { } }; - Future readFuture = actorContext.executeRemoteOperationAsync(getActor(), + Future readFuture = actorContext.executeOperationAsync(getActor(), new ReadData(path).toSerializable()); readFuture.onComplete(onComplete, actorContext.getActorSystem().dispatcher()); } @@ -773,7 +779,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { } }; - Future future = actorContext.executeRemoteOperationAsync(getActor(), + Future future = actorContext.executeOperationAsync(getActor(), new DataExists(path).toSerializable()); future.onComplete(onComplete, actorContext.getActorSystem().dispatcher()); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/exceptions/NotInitializedException.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/exceptions/NotInitializedException.java new file mode 100644 index 0000000000..302d684322 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/exceptions/NotInitializedException.java @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.cluster.datastore.exceptions; + +public class NotInitializedException extends RuntimeException { + public NotInitializedException(String message) { + super(message); + } +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/identifiers/ShardIdentifier.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/identifiers/ShardIdentifier.java index c692881593..d65af61ba3 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/identifiers/ShardIdentifier.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/identifiers/ShardIdentifier.java @@ -10,11 +10,17 @@ package org.opendaylight.controller.cluster.datastore.identifiers; import com.google.common.base.Preconditions; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + public class ShardIdentifier { private final String shardName; private final String memberName; private final String type; + //format and pattern should be in sync + private final String format = "%s-shard-%s-%s"; + private static final Pattern pattern = Pattern.compile("(\\S+)-shard-(\\S+)-(\\S+)"); public ShardIdentifier(String shardName, String memberName, String type) { @@ -60,15 +66,31 @@ public class ShardIdentifier { } @Override public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append(memberName).append("-shard-").append(shardName).append("-").append(type); - return builder.toString(); + //ensure the output of toString matches the pattern above + return new StringBuilder(memberName) + .append("-shard-") + .append(shardName) + .append("-") + .append(type) + .toString(); } public static Builder builder(){ return new Builder(); } + public String getShardName() { + return shardName; + } + + public String getMemberName() { + return memberName; + } + + public String getType() { + return type; + } + public static class Builder { private String shardName; private String memberName; @@ -93,5 +115,15 @@ public class ShardIdentifier { return this; } + public Builder fromShardIdString(String shardId){ + Matcher matcher = pattern.matcher(shardId); + + if (matcher.matches()) { + memberName = matcher.group(1); + shardName = matcher.group(2); + type = matcher.group(3); + } + return this; + } } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ActorInitialized.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ActorInitialized.java new file mode 100644 index 0000000000..b034f87d1c --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ActorInitialized.java @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.cluster.datastore.messages; + +import java.io.Serializable; + +public class ActorInitialized implements Serializable { +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ActorNotInitialized.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ActorNotInitialized.java new file mode 100644 index 0000000000..de25ef9ecc --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ActorNotInitialized.java @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.cluster.datastore.messages; + +import java.io.Serializable; + +public class ActorNotInitialized implements Serializable { +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChanged.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChanged.java index a8827bebf4..5b5f076d43 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChanged.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChanged.java @@ -9,14 +9,13 @@ package org.opendaylight.controller.cluster.datastore.messages; import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec; -import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; +import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; import org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; - import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -26,8 +25,9 @@ import java.util.Map; import java.util.Set; public class DataChanged implements SerializableMessage { - public static final Class SERIALIZABLE_CLASS = + public static final Class SERIALIZABLE_CLASS = DataChangeListenerMessages.DataChanged.class; + final private SchemaContext schemaContext; private final AsyncDataChangeEvent> change; @@ -50,7 +50,7 @@ public class DataChanged implements SerializableMessage { NormalizedNode normalizedNode) { return new NormalizedNodeToNodeCodec(schemaContext) - .encode(YangInstanceIdentifier.builder().build(), normalizedNode) + .encode(normalizedNode) .getNormalizedNode(); } @@ -62,6 +62,7 @@ public class DataChanged implements SerializableMessage { removedPathInstanceIds.add(InstanceIdentifierUtils.toSerializable(id)); } return new Iterable() { + @Override public Iterator iterator() { return removedPathInstanceIds.iterator(); } @@ -86,7 +87,7 @@ public class DataChanged implements SerializableMessage { builder.setInstanceIdentifierPath(instanceIdentifier) .setNormalizedNode(normalizedNodeToNodeCodec - .encode(entry.getKey(), entry.getValue()) + .encode(entry.getValue()) .getNormalizedNode()); nodeMapBuilder.addMapEntries(builder.build()); } @@ -146,7 +147,6 @@ public class DataChanged implements SerializableMessage { static class DataChangedEvent implements AsyncDataChangeEvent> { - private final SchemaContext schemaContext; private Map> createdData; private final NormalizedNodeToNodeCodec nodeCodec; private Map> updatedData; @@ -156,7 +156,6 @@ public class DataChanged implements SerializableMessage { private Set removedPathIds; DataChangedEvent(SchemaContext schemaContext) { - this.schemaContext = schemaContext; nodeCodec = new NormalizedNodeToNodeCodec(schemaContext); } @@ -183,7 +182,7 @@ public class DataChanged implements SerializableMessage { YangInstanceIdentifier id = InstanceIdentifierUtils .fromSerializable(nodeMapEntry.getInstanceIdentifierPath()); mapEntries.put(id, - nodeCodec.decode(id, nodeMapEntry.getNormalizedNode())); + nodeCodec.decode(nodeMapEntry.getNormalizedNode())); } return mapEntries; } @@ -240,7 +239,7 @@ public class DataChanged implements SerializableMessage { DataChangedEvent setOriginalSubtree(NormalizedNodeMessages.Node node, YangInstanceIdentifier instanceIdentifierPath) { - originalSubTree = nodeCodec.decode(instanceIdentifierPath, node); + originalSubTree = nodeCodec.decode(node); return this; } @@ -251,7 +250,7 @@ public class DataChanged implements SerializableMessage { DataChangedEvent setUpdatedSubtree(NormalizedNodeMessages.Node node, YangInstanceIdentifier instanceIdentifierPath) { - updatedSubTree = nodeCodec.decode(instanceIdentifierPath, node); + updatedSubTree = nodeCodec.decode(node); return this; } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DeleteData.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DeleteData.java index 9ae851e76c..6d3051c8c7 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DeleteData.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DeleteData.java @@ -8,7 +8,7 @@ package org.opendaylight.controller.cluster.datastore.messages; -import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; +import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils; import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/MergeData.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/MergeData.java index ba790816c4..eb1f3495bd 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/MergeData.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/MergeData.java @@ -9,8 +9,8 @@ package org.opendaylight.controller.cluster.datastore.messages; import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec; -import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; -import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; +import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec.Decoded; +import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec.Encoded; import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; @@ -18,31 +18,26 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext; public class MergeData extends ModifyData{ - public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.MergeData.class; + public static final Class SERIALIZABLE_CLASS = + ShardTransactionMessages.MergeData.class; public MergeData(YangInstanceIdentifier path, NormalizedNode data, SchemaContext context) { super(path, data, context); } - @Override public Object toSerializable() { - - NormalizedNodeMessages.Node normalizedNode = - new NormalizedNodeToNodeCodec(schemaContext).encode(path, data) - .getNormalizedNode(); + @Override + public Object toSerializable() { + Encoded encoded = new NormalizedNodeToNodeCodec(schemaContext).encode(path, data); return ShardTransactionMessages.MergeData.newBuilder() - .setInstanceIdentifierPathArguments(InstanceIdentifierUtils.toSerializable(path)) - .setNormalizedNode(normalizedNode).build(); + .setInstanceIdentifierPathArguments(encoded.getEncodedPath()) + .setNormalizedNode(encoded.getEncodedNode().getNormalizedNode()).build(); } public static MergeData fromSerializable(Object serializable, SchemaContext schemaContext){ ShardTransactionMessages.MergeData o = (ShardTransactionMessages.MergeData) serializable; - YangInstanceIdentifier identifier = InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPathArguments()); - - NormalizedNode normalizedNode = - new NormalizedNodeToNodeCodec(schemaContext) - .decode(identifier, o.getNormalizedNode()); - - return new MergeData(identifier, normalizedNode, schemaContext); + Decoded decoded = new NormalizedNodeToNodeCodec(schemaContext).decode( + o.getInstanceIdentifierPathArguments(), o.getNormalizedNode()); + return new MergeData(decoded.getDecodedPath(), decoded.getDecodedNode(), schemaContext); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadData.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadData.java index a698f46347..d743d99fcc 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadData.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadData.java @@ -8,7 +8,7 @@ package org.opendaylight.controller.cluster.datastore.messages; -import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; +import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils; import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadDataReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadDataReply.java index fc6bcff64a..43dd81252c 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadDataReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadDataReply.java @@ -15,41 +15,44 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; -public class ReadDataReply implements SerializableMessage{ - - private final NormalizedNode normalizedNode; - private final SchemaContext schemaContext; - public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.ReadDataReply.class; - public ReadDataReply(SchemaContext context,NormalizedNode normalizedNode){ - - this.normalizedNode = normalizedNode; - this.schemaContext = context; - } - - public NormalizedNode getNormalizedNode() { - return normalizedNode; - } - - public Object toSerializable(){ - if(normalizedNode != null) { - return ShardTransactionMessages.ReadDataReply.newBuilder() - .setNormalizedNode(new NormalizedNodeToNodeCodec(schemaContext) - .encode(YangInstanceIdentifier.builder().build(), normalizedNode).getNormalizedNode() - ).build(); - }else{ - return ShardTransactionMessages.ReadDataReply.newBuilder().build(); +public class ReadDataReply implements SerializableMessage { + public static final Class SERIALIZABLE_CLASS = + ShardTransactionMessages.ReadDataReply.class; + private final NormalizedNode normalizedNode; + private final SchemaContext schemaContext; + + public ReadDataReply(SchemaContext context,NormalizedNode normalizedNode){ + + this.normalizedNode = normalizedNode; + this.schemaContext = context; + } + + public NormalizedNode getNormalizedNode() { + return normalizedNode; } - } + @Override + public Object toSerializable(){ + if(normalizedNode != null) { + return ShardTransactionMessages.ReadDataReply.newBuilder() + .setNormalizedNode(new NormalizedNodeToNodeCodec(schemaContext) + .encode(normalizedNode).getNormalizedNode()).build(); + } else { + return ShardTransactionMessages.ReadDataReply.newBuilder().build(); - public static ReadDataReply fromSerializable(SchemaContext schemaContext,YangInstanceIdentifier id,Object serializable){ - ShardTransactionMessages.ReadDataReply o = (ShardTransactionMessages.ReadDataReply) serializable; - return new ReadDataReply(schemaContext,new NormalizedNodeToNodeCodec(schemaContext).decode(id, o.getNormalizedNode())); - } + } + } + + public static ReadDataReply fromSerializable(SchemaContext schemaContext, + YangInstanceIdentifier id, Object serializable) { + ShardTransactionMessages.ReadDataReply o = (ShardTransactionMessages.ReadDataReply) serializable; + return new ReadDataReply(schemaContext, new NormalizedNodeToNodeCodec(schemaContext).decode( + o.getNormalizedNode())); + } - public static ByteString getNormalizedNodeByteString(Object serializable){ - ShardTransactionMessages.ReadDataReply o = (ShardTransactionMessages.ReadDataReply) serializable; - return ((ShardTransactionMessages.ReadDataReply) serializable).getNormalizedNode().toByteString(); - } + public static ByteString getNormalizedNodeByteString(Object serializable){ + ShardTransactionMessages.ReadDataReply o = (ShardTransactionMessages.ReadDataReply) serializable; + return ((ShardTransactionMessages.ReadDataReply) serializable).getNormalizedNode().toByteString(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListener.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListener.java index c1ec0a87cb..dea085153b 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListener.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListener.java @@ -10,13 +10,15 @@ package org.opendaylight.controller.cluster.datastore.messages; import akka.actor.ActorPath; import akka.actor.ActorSystem; -import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; +import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker; import org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; public class RegisterChangeListener implements SerializableMessage { - public static final Class SERIALIZABLE_CLASS = ListenerRegistrationMessages.RegisterChangeListener.class; + public static final Class SERIALIZABLE_CLASS = + ListenerRegistrationMessages.RegisterChangeListener.class; + private final YangInstanceIdentifier path; private final ActorPath dataChangeListenerPath; private final AsyncDataBroker.DataChangeScope scope; diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/WriteData.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/WriteData.java index 87fa010b37..8aa63ef262 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/WriteData.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/WriteData.java @@ -9,41 +9,34 @@ package org.opendaylight.controller.cluster.datastore.messages; import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec; -import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; -import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; +import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec.Decoded; +import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec.Encoded; import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; -public class WriteData extends ModifyData{ +public class WriteData extends ModifyData { - public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.WriteData.class; + public static final Class SERIALIZABLE_CLASS = + ShardTransactionMessages.WriteData.class; - public WriteData(YangInstanceIdentifier path, NormalizedNode data, SchemaContext schemaContext) { - super(path, data, schemaContext); - } - - @Override public Object toSerializable() { + public WriteData(YangInstanceIdentifier path, NormalizedNode data, SchemaContext schemaContext) { + super(path, data, schemaContext); + } - NormalizedNodeMessages.Node normalizedNode = - new NormalizedNodeToNodeCodec(schemaContext).encode(path, data) - .getNormalizedNode(); + @Override + public Object toSerializable() { + Encoded encoded = new NormalizedNodeToNodeCodec(schemaContext).encode(path, data); return ShardTransactionMessages.WriteData.newBuilder() - .setInstanceIdentifierPathArguments(InstanceIdentifierUtils.toSerializable(path)) - .setNormalizedNode(normalizedNode).build(); - + .setInstanceIdentifierPathArguments(encoded.getEncodedPath()) + .setNormalizedNode(encoded.getEncodedNode().getNormalizedNode()).build(); } public static WriteData fromSerializable(Object serializable, SchemaContext schemaContext){ ShardTransactionMessages.WriteData o = (ShardTransactionMessages.WriteData) serializable; - YangInstanceIdentifier identifier = InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPathArguments()); - - NormalizedNode normalizedNode = - new NormalizedNodeToNodeCodec(schemaContext) - .decode(identifier, o.getNormalizedNode()); - - return new WriteData(identifier, normalizedNode, schemaContext); + Decoded decoded = new NormalizedNodeToNodeCodec(schemaContext).decode( + o.getInstanceIdentifierPathArguments(), o.getNormalizedNode()); + return new WriteData(decoded.getDecodedPath(), decoded.getDecodedNode(), schemaContext); } - } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModification.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModification.java index 169397bf87..4f4f0fb8f1 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModification.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModification.java @@ -26,4 +26,8 @@ public abstract class AbstractModification implements Modification, protected AbstractModification(YangInstanceIdentifier path) { this.path = path; } + + public YangInstanceIdentifier getPath() { + return path; + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModification.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModification.java index 593f458afa..056fe75637 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModification.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModification.java @@ -8,7 +8,7 @@ package org.opendaylight.controller.cluster.datastore.modification; -import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; +import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils; import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages; import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -17,23 +17,24 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; * DeleteModification store all the parameters required to delete a path from the data tree */ public class DeleteModification extends AbstractModification { - public DeleteModification(YangInstanceIdentifier path) { - super(path); - } + private static final long serialVersionUID = 1L; - @Override - public void apply(DOMStoreWriteTransaction transaction) { - transaction.delete(path); - } + public DeleteModification(YangInstanceIdentifier path) { + super(path); + } + + @Override + public void apply(DOMStoreWriteTransaction transaction) { + transaction.delete(path); + } - @Override public Object toSerializable() { - return PersistentMessages.Modification.newBuilder() - .setType(this.getClass().toString()) - .setPath(InstanceIdentifierUtils.toSerializable(this.path)) - .build(); + @Override + public Object toSerializable() { + return PersistentMessages.Modification.newBuilder().setType(this.getClass().toString()) + .setPath(InstanceIdentifierUtils.toSerializable(this.path)).build(); } - public static DeleteModification fromSerializable(Object serializable){ + public static DeleteModification fromSerializable(Object serializable) { PersistentMessages.Modification o = (PersistentMessages.Modification) serializable; return new DeleteModification(InstanceIdentifierUtils.fromSerializable(o.getPath())); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MergeModification.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MergeModification.java index f06adcf96f..24c4c6c50a 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MergeModification.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MergeModification.java @@ -9,8 +9,7 @@ package org.opendaylight.controller.cluster.datastore.modification; import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec; -import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; -import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; +import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec.Decoded; import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages; import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -20,16 +19,11 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext; /** * MergeModification stores all the parameters required to merge data into the specified path */ -public class MergeModification extends AbstractModification { - private final NormalizedNode data; - private final SchemaContext schemaContext; - +public class MergeModification extends WriteModification { public MergeModification(YangInstanceIdentifier path, NormalizedNode data, SchemaContext schemaContext) { - super(path); - this.data = data; - this.schemaContext = schemaContext; + super(path, data, schemaContext); } @Override @@ -37,29 +31,9 @@ public class MergeModification extends AbstractModification { transaction.merge(path, data); } - @Override public Object toSerializable() { - NormalizedNodeMessages.Container encode = - new NormalizedNodeToNodeCodec(schemaContext).encode( - path, data); - - return PersistentMessages.Modification.newBuilder() - .setType(this.getClass().toString()) - .setPath(InstanceIdentifierUtils.toSerializable(this.path)) - .setData(encode.getNormalizedNode()) - .build(); - - } - - public static MergeModification fromSerializable( - Object serializable, - SchemaContext schemaContext) { + public static MergeModification fromSerializable(Object serializable, SchemaContext schemaContext) { PersistentMessages.Modification o = (PersistentMessages.Modification) serializable; - - YangInstanceIdentifier path = InstanceIdentifierUtils.fromSerializable(o.getPath()); - NormalizedNode data = new NormalizedNodeToNodeCodec(schemaContext).decode( - path, o.getData()); - - return new MergeModification(path, data, schemaContext); + Decoded decoded = new NormalizedNodeToNodeCodec(schemaContext).decode(o.getPath(), o.getData()); + return new MergeModification(decoded.getDecodedPath(), decoded.getDecodedNode(), schemaContext); } - } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/WriteModification.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/WriteModification.java index b4a7dd62d0..53cc35a88b 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/WriteModification.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/WriteModification.java @@ -9,8 +9,8 @@ package org.opendaylight.controller.cluster.datastore.modification; import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec; -import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; -import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; +import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec.Decoded; +import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec.Encoded; import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages; import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -22,43 +22,38 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext; */ public class WriteModification extends AbstractModification { - private final NormalizedNode data; + protected final NormalizedNode data; private final SchemaContext schemaContext; public WriteModification(YangInstanceIdentifier path, NormalizedNode data, SchemaContext schemaContext) { - super(path); - this.data = data; + super(path); + this.data = data; this.schemaContext = schemaContext; } - @Override - public void apply(DOMStoreWriteTransaction transaction) { - transaction.write(path, data); - } + @Override + public void apply(DOMStoreWriteTransaction transaction) { + transaction.write(path, data); + } - @Override public Object toSerializable() { - NormalizedNodeMessages.Container encode = - new NormalizedNodeToNodeCodec(schemaContext).encode( - path, data); + public NormalizedNode getData() { + return data; + } + @Override + public Object toSerializable() { + Encoded encoded = new NormalizedNodeToNodeCodec(schemaContext).encode(path, data); return PersistentMessages.Modification.newBuilder() - .setType(this.getClass().toString()) - .setPath(InstanceIdentifierUtils.toSerializable(this.path)) - .setData(encode.getNormalizedNode()) - .build(); - + .setType(this.getClass().toString()) + .setPath(encoded.getEncodedPath()) + .setData(encoded.getEncodedNode().getNormalizedNode()) + .build(); } - public static WriteModification fromSerializable( - Object serializable, - SchemaContext schemaContext) { + public static WriteModification fromSerializable(Object serializable, SchemaContext schemaContext) { PersistentMessages.Modification o = (PersistentMessages.Modification) serializable; - - YangInstanceIdentifier path = InstanceIdentifierUtils.fromSerializable(o.getPath()); - NormalizedNode data = new NormalizedNodeToNodeCodec(schemaContext).decode( - path, o.getData()); - - return new WriteModification(path, data, schemaContext); + Decoded decoded = new NormalizedNodeToNodeCodec(schemaContext).decode(o.getPath(), o.getData()); + return new WriteModification(decoded.getDecodedPath(), decoded.getDecodedNode(), schemaContext); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java index 8ba333d279..44f4ef77d7 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java @@ -13,12 +13,14 @@ import akka.actor.ActorRef; import akka.actor.ActorSelection; import akka.actor.ActorSystem; import akka.actor.PoisonPill; -import akka.pattern.Patterns; import akka.util.Timeout; +import com.google.common.base.Optional; +import com.google.common.base.Preconditions; import org.opendaylight.controller.cluster.datastore.ClusterWrapper; import org.opendaylight.controller.cluster.datastore.Configuration; -import org.opendaylight.controller.cluster.datastore.exceptions.PrimaryNotFoundException; +import org.opendaylight.controller.cluster.datastore.exceptions.NotInitializedException; import org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException; +import org.opendaylight.controller.cluster.datastore.messages.ActorNotInitialized; import org.opendaylight.controller.cluster.datastore.messages.FindLocalShard; import org.opendaylight.controller.cluster.datastore.messages.FindPrimary; import org.opendaylight.controller.cluster.datastore.messages.LocalShardFound; @@ -101,14 +103,17 @@ public class ActorContext { } /** - * Finds the primary for a given shard + * Finds the primary shard for the given shard name * * @param shardName * @return */ - public ActorSelection findPrimary(String shardName) { - String path = findPrimaryPath(shardName); - return actorSystem.actorSelection(path); + public Optional findPrimaryShard(String shardName) { + String path = findPrimaryPathOrNull(shardName); + if (path == null){ + return Optional.absent(); + } + return Optional.of(actorSystem.actorSelection(path)); } /** @@ -118,36 +123,36 @@ public class ActorContext { * @return a reference to a local shard actor which represents the shard * specified by the shardName */ - public ActorRef findLocalShard(String shardName) { - Object result = executeLocalOperation(shardManager, - new FindLocalShard(shardName)); + public Optional findLocalShard(String shardName) { + Object result = executeOperation(shardManager, new FindLocalShard(shardName)); if (result instanceof LocalShardFound) { LocalShardFound found = (LocalShardFound) result; - - if(LOG.isDebugEnabled()) { - LOG.debug("Local shard found {}", found.getPath()); - } - return found.getPath(); + LOG.debug("Local shard found {}", found.getPath()); + return Optional.of(found.getPath()); } - return null; + return Optional.absent(); } - public String findPrimaryPath(String shardName) { - Object result = executeLocalOperation(shardManager, - new FindPrimary(shardName).toSerializable()); + private String findPrimaryPathOrNull(String shardName) { + Object result = executeOperation(shardManager, new FindPrimary(shardName).toSerializable()); if (result.getClass().equals(PrimaryFound.SERIALIZABLE_CLASS)) { PrimaryFound found = PrimaryFound.fromSerializable(result); - if(LOG.isDebugEnabled()) { - LOG.debug("Primary found {}", found.getPrimaryPath()); - } + LOG.debug("Primary found {}", found.getPrimaryPath()); return found.getPrimaryPath(); + + } else if (result.getClass().equals(ActorNotInitialized.class)){ + throw new NotInitializedException( + String.format("Found primary shard[%s] but its not initialized yet. Please try again later", shardName) + ); + + } else { + return null; } - throw new PrimaryNotFoundException("Could not find primary for shardName " + shardName); } @@ -158,16 +163,25 @@ public class ActorContext { * @param message * @return The response of the operation */ - public Object executeLocalOperation(ActorRef actor, Object message) { - Future future = ask(actor, message, operationTimeout); + public Object executeOperation(ActorRef actor, Object message) { + Future future = executeOperationAsync(actor, message, operationTimeout); try { return Await.result(future, operationDuration); } catch (Exception e) { - throw new TimeoutException("Sending message " + message.getClass().toString() + " to actor " + actor.toString() + " failed" , e); + throw new TimeoutException("Sending message " + message.getClass().toString() + + " to actor " + actor.toString() + " failed. Try again later.", e); } } + public Future executeOperationAsync(ActorRef actor, Object message, Timeout timeout) { + Preconditions.checkArgument(actor != null, "actor must not be null"); + Preconditions.checkArgument(message != null, "message must not be null"); + + LOG.debug("Sending message {} to {}", message.getClass().toString(), actor.toString()); + return ask(actor, message, timeout); + } + /** * Execute an operation on a remote actor and wait for it's response * @@ -175,19 +189,14 @@ public class ActorContext { * @param message * @return */ - public Object executeRemoteOperation(ActorSelection actor, Object message) { - - if(LOG.isDebugEnabled()) { - LOG.debug("Sending remote message {} to {}", message.getClass().toString(), - actor.toString()); - } - Future future = ask(actor, message, operationTimeout); + public Object executeOperation(ActorSelection actor, Object message) { + Future future = executeOperationAsync(actor, message); try { return Await.result(future, operationDuration); } catch (Exception e) { throw new TimeoutException("Sending message " + message.getClass().toString() + - " to actor " + actor.toString() + " failed" , e); + " to actor " + actor.toString() + " failed. Try again later.", e); } } @@ -198,11 +207,12 @@ public class ActorContext { * @param message the message to send * @return a Future containing the eventual result */ - public Future executeRemoteOperationAsync(ActorSelection actor, Object message) { + public Future executeOperationAsync(ActorSelection actor, Object message) { + Preconditions.checkArgument(actor != null, "actor must not be null"); + Preconditions.checkArgument(message != null, "message must not be null"); + + LOG.debug("Sending message {} to {}", message.getClass().toString(), actor.toString()); - if(LOG.isDebugEnabled()) { - LOG.debug("Sending remote message {} to {}", message.getClass().toString(), actor.toString()); - } return ask(actor, message, operationTimeout); } @@ -213,86 +223,15 @@ public class ActorContext { * @param actor the ActorSelection * @param message the message to send */ - public void sendRemoteOperationAsync(ActorSelection actor, Object message) { - actor.tell(message, ActorRef.noSender()); - } - - public void sendShardOperationAsync(String shardName, Object message) { - ActorSelection primary = findPrimary(shardName); - - primary.tell(message, ActorRef.noSender()); - } + public void sendOperationAsync(ActorSelection actor, Object message) { + Preconditions.checkArgument(actor != null, "actor must not be null"); + Preconditions.checkArgument(message != null, "message must not be null"); + LOG.debug("Sending message {} to {}", message.getClass().toString(), actor.toString()); - /** - * Execute an operation on the primary for a given shard - *

      - * This method first finds the primary for a given shard ,then sends - * the message to the remote shard and waits for a response - *

      - * - * @param shardName - * @param message - * @return - * @throws org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException if the message to the remote shard times out - * @throws org.opendaylight.controller.cluster.datastore.exceptions.PrimaryNotFoundException if the primary shard is not found - */ - public Object executeShardOperation(String shardName, Object message) { - ActorSelection primary = findPrimary(shardName); - - return executeRemoteOperation(primary, message); - } - - /** - * Execute an operation on the the local shard only - *

      - * This method first finds the address of the local shard if any. It then - * executes the operation on it. - *

      - * - * @param shardName the name of the shard on which the operation needs to be executed - * @param message the message that needs to be sent to the shard - * @return the message that was returned by the local actor on which the - * the operation was executed. If a local shard was not found then - * null is returned - * @throws org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException - * if the operation does not complete in a specified time duration - */ - public Object executeLocalShardOperation(String shardName, Object message) { - ActorRef local = findLocalShard(shardName); - - if(local != null) { - return executeLocalOperation(local, message); - } - - return null; - } - - - /** - * Execute an operation on the the local shard only asynchronously - * - *

      - * This method first finds the address of the local shard if any. It then - * executes the operation on it. - *

      - * - * @param shardName the name of the shard on which the operation needs to be executed - * @param message the message that needs to be sent to the shard - * @param timeout the amount of time that this method should wait for a response before timing out - * @return null if the shard could not be located else a future on which the caller can wait - * - */ - public Future executeLocalShardOperationAsync(String shardName, Object message, Timeout timeout) { - ActorRef local = findLocalShard(shardName); - if(local == null){ - return null; - } - return Patterns.ask(local, message, timeout); + actor.tell(message, ActorRef.noSender()); } - - public void shutdown() { shardManager.tell(PoisonPill.getInstance(), null); actorSystem.shutdown(); @@ -337,10 +276,13 @@ public class ActorContext { */ public void broadcast(Object message){ for(String shardName : configuration.getAllShardNames()){ - try { - sendShardOperationAsync(shardName, message); - } catch(Exception e){ - LOG.warn("broadcast failed to send message " + message.getClass().getSimpleName() + " to shard " + shardName, e); + + Optional primary = findPrimaryShard(shardName); + if (primary.isPresent()) { + primary.get().tell(message, ActorRef.noSender()); + } else { + LOG.warn("broadcast failed to send message {} to shard {}. Primary not found", + message.getClass().getSimpleName(), shardName); } } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/InstanceIdentifierUtils.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/InstanceIdentifierUtils.java deleted file mode 100644 index c154b81e35..0000000000 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/InstanceIdentifierUtils.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.opendaylight.controller.cluster.datastore.utils; - -import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory; -import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author: syedbahm - */ -public class InstanceIdentifierUtils { - - protected static final Logger logger = LoggerFactory - .getLogger(InstanceIdentifierUtils.class); - - public static String getParentPath(String currentElementPath) { - - StringBuilder parentPath = new StringBuilder(); - - if (currentElementPath != null) { - String[] parentPaths = currentElementPath.split("/"); - if (parentPaths.length > 2) { - for (int i = 0; i < parentPaths.length - 1; i++) { - if (parentPaths[i].length() > 0) { - parentPath.append( "/"); - parentPath.append( parentPaths[i]); - } - } - } - } - return parentPath.toString(); - } - - @Deprecated - public static YangInstanceIdentifier from(String path) { - String[] ids = path.split("/"); - - List pathArguments = - new ArrayList<>(); - for (String nodeId : ids) { - if (!"".equals(nodeId)) { - pathArguments - .add(NodeIdentifierFactory.getArgument(nodeId)); - } - } - final YangInstanceIdentifier instanceIdentifier = - YangInstanceIdentifier.create(pathArguments); - return instanceIdentifier; - } - - /** - * @deprecated Use {@link org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils} instead - * @param path - * @return - */ - @Deprecated - public static NormalizedNodeMessages.InstanceIdentifier toSerializable(YangInstanceIdentifier path){ - return org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils.toSerializable(path); - } - - /** - * @deprecated Use {@link org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils} instead - * @param path - * @return - */ - @Deprecated - public static YangInstanceIdentifier fromSerializable(NormalizedNodeMessages.InstanceIdentifier path){ - return org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils.fromSerializable(path); - } -} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxyTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxyTest.java index 2ed11cfbda..c79d762035 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxyTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxyTest.java @@ -82,7 +82,7 @@ public class DataChangeListenerProxyTest extends AbstractActorTest { ActorContext testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)), new MockClusterWrapper(), new MockConfiguration()); Object messages = testContext - .executeLocalOperation(actorRef, "messages"); + .executeOperation(actorRef, "messages"); Assert.assertNotNull(messages); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxyTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxyTest.java index ab3ff795d3..aaf080bdf7 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxyTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxyTest.java @@ -66,7 +66,7 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest{ ActorContext testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)),new MockClusterWrapper(), new MockConfiguration()); Object messages = testContext - .executeLocalOperation(actorRef, "messages"); + .executeOperation(actorRef, "messages"); assertNotNull(messages); @@ -95,7 +95,7 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest{ ActorContext testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)),new MockClusterWrapper(), new MockConfiguration()); Object messages = testContext - .executeLocalOperation(actorRef, "messages"); + .executeOperation(actorRef, "messages"); assertNotNull(messages); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java index 08c3ea9602..d57a5eea4a 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java @@ -8,6 +8,7 @@ import akka.actor.Props; import akka.dispatch.ExecutionContexts; import akka.dispatch.Futures; import akka.util.Timeout; +import com.google.common.base.Optional; import com.google.common.util.concurrent.MoreExecutors; import org.junit.After; import org.junit.Before; @@ -97,11 +98,11 @@ public class DistributedDataStoreTest extends AbstractActorTest{ ListenerRegistration registration = distributedDataStore.registerChangeListener(TestModel.TEST_PATH, new AsyncDataChangeListener>() { - @Override - public void onDataChanged(AsyncDataChangeEvent> change) { - throw new UnsupportedOperationException("onDataChanged"); - } - }, AsyncDataBroker.DataChangeScope.BASE); + @Override + public void onDataChanged(AsyncDataChangeEvent> change) { + throw new UnsupportedOperationException("onDataChanged"); + } + }, AsyncDataBroker.DataChangeScope.BASE); // Since we do not expect the shard to be local registration will return a NoOpRegistration assertTrue(registration instanceof NoOpDataChangeListenerRegistration); @@ -119,8 +120,9 @@ public class DistributedDataStoreTest extends AbstractActorTest{ Future future = mock(Future.class); when(actorContext.getOperationDuration()).thenReturn(FiniteDuration.apply(5, TimeUnit.SECONDS)); when(actorContext.getActorSystem()).thenReturn(getSystem()); + when(actorContext.findLocalShard(anyString())).thenReturn(Optional.of(doNothingActorRef)); when(actorContext - .executeLocalShardOperationAsync(anyString(), anyObject(), any(Timeout.class))).thenReturn(future); + .executeOperationAsync(eq(doNothingActorRef), anyObject(), any(Timeout.class))).thenReturn(future); ListenerRegistration registration = distributedDataStore.registerChangeListener(TestModel.TEST_PATH, @@ -153,8 +155,9 @@ public class DistributedDataStoreTest extends AbstractActorTest{ when(actorSystem.dispatcher()).thenReturn(executor); when(actorSystem.actorOf(any(Props.class))).thenReturn(doNothingActorRef); when(actorContext.getActorSystem()).thenReturn(actorSystem); + when(actorContext.findLocalShard(anyString())).thenReturn(Optional.of(doNothingActorRef)); when(actorContext - .executeLocalShardOperationAsync(anyString(), anyObject(), any(Timeout.class))).thenReturn(f); + .executeOperationAsync(eq(doNothingActorRef), anyObject(), any(Timeout.class))).thenReturn(f); when(actorContext.actorSelection(any(ActorPath.class))).thenReturn(actorSelection); ListenerRegistration registration = @@ -195,8 +198,9 @@ public class DistributedDataStoreTest extends AbstractActorTest{ when(actorSystem.dispatcher()).thenReturn(executor); when(actorSystem.actorOf(any(Props.class))).thenReturn(doNothingActorRef); when(actorContext.getActorSystem()).thenReturn(actorSystem); + when(actorContext.findLocalShard(anyString())).thenReturn(Optional.of(doNothingActorRef)); when(actorContext - .executeLocalShardOperationAsync(anyString(), anyObject(), any(Timeout.class))).thenReturn(f); + .executeOperationAsync(eq(doNothingActorRef), anyObject(), any(Timeout.class))).thenReturn(f); when(actorContext.actorSelection(any(ActorPath.class))).thenReturn(actorSelection); ListenerRegistration registration = diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java index 8a3cdd0c8a..ed7b6866bf 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java @@ -22,6 +22,8 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier; +import org.opendaylight.controller.cluster.datastore.messages.ActorInitialized; import org.opendaylight.controller.cluster.datastore.messages.FindLocalShard; import org.opendaylight.controller.cluster.datastore.messages.FindPrimary; import org.opendaylight.controller.cluster.datastore.messages.LocalShardFound; @@ -29,6 +31,7 @@ import org.opendaylight.controller.cluster.datastore.messages.LocalShardNotFound import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound; import org.opendaylight.controller.cluster.datastore.messages.PrimaryNotFound; import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext; +import org.opendaylight.controller.cluster.datastore.utils.DoNothingActor; import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper; import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; import org.opendaylight.controller.md.cluster.datastore.model.TestModel; @@ -53,6 +56,8 @@ import static org.mockito.Mockito.when; public class ShardManagerTest { private static ActorSystem system; + Configuration mockConfig = new MockConfiguration(); + private static ActorRef defaultShardMockActor; @BeforeClass public static void setUpClass() { @@ -60,13 +65,18 @@ public class ShardManagerTest { myJournal.put("class", "org.opendaylight.controller.cluster.datastore.ShardManagerTest$MyJournal"); myJournal.put("plugin-dispatcher", "akka.actor.default-dispatcher"); Config config = ConfigFactory.load() - .withValue("akka.persistence.journal.plugin", - ConfigValueFactory.fromAnyRef("my-journal")) - .withValue("my-journal", ConfigValueFactory.fromMap(myJournal)); + .withValue("akka.persistence.journal.plugin", + ConfigValueFactory.fromAnyRef("my-journal")) + .withValue("my-journal", ConfigValueFactory.fromMap(myJournal)); MyJournal.clear(); system = ActorSystem.create("test", config); + + String name = new ShardIdentifier(Shard.DEFAULT_NAME, "member-1","config").toString(); + defaultShardMockActor = system.actorOf(Props.create(DoNothingActor.class), name); + + } @AfterClass @@ -86,15 +96,15 @@ public class ShardManagerTest { new JavaTestKit(system) { { final Props props = ShardManager - .props("config", new MockClusterWrapper(), - new MockConfiguration(), new DatastoreContext()); + .props("config", new MockClusterWrapper(), + new MockConfiguration(), new DatastoreContext()); final ActorRef subject = getSystem().actorOf(props); subject.tell(new FindPrimary("inventory").toSerializable(), getRef()); expectMsgEquals(duration("2 seconds"), - new PrimaryNotFound("inventory").toSerializable()); + new PrimaryNotFound("inventory").toSerializable()); }}; } @@ -103,17 +113,19 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager - .props("config", new MockClusterWrapper(), - new MockConfiguration(), new DatastoreContext()); + .props("config", new MockClusterWrapper(), + new MockConfiguration(), new DatastoreContext()); final ActorRef subject = getSystem().actorOf(props); subject.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef()); + subject.tell(new ActorInitialized(), defaultShardMockActor); subject.tell(new FindPrimary(Shard.DEFAULT_NAME).toSerializable(), getRef()); expectMsgClass(duration("1 seconds"), PrimaryFound.SERIALIZABLE_CLASS); - }}; + } + }; } @Test @@ -121,8 +133,8 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager - .props("config", new MockClusterWrapper(), - new MockConfiguration(), new DatastoreContext()); + .props("config", new MockClusterWrapper(), + new MockConfiguration(), new DatastoreContext()); final ActorRef subject = getSystem().actorOf(props); @@ -150,12 +162,13 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager - .props("config", mockClusterWrapper, - new MockConfiguration(), new DatastoreContext()); + .props("config", mockClusterWrapper, + new MockConfiguration(), new DatastoreContext()); final ActorRef subject = getSystem().actorOf(props); subject.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef()); + subject.tell(new ActorInitialized(), defaultShardMockActor); subject.tell(new FindLocalShard(Shard.DEFAULT_NAME), getRef()); @@ -171,7 +184,7 @@ public class ShardManagerTest { }.get(); // this extracts the received message assertTrue(out.path().toString(), - out.path().toString().contains("member-1-shard-default-config")); + out.path().toString().contains("member-1-shard-default-config")); }}; } @@ -180,8 +193,8 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager - .props("config", new MockClusterWrapper(), - new MockConfiguration(), new DatastoreContext()); + .props("config", new MockClusterWrapper(), + new MockConfiguration(), new DatastoreContext()); final ActorRef subject = getSystem().actorOf(props); @@ -211,8 +224,8 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager - .props("config", new MockClusterWrapper(), - new MockConfiguration(), new DatastoreContext()); + .props("config", new MockClusterWrapper(), + new MockConfiguration(), new DatastoreContext()); final ActorRef subject = getSystem().actorOf(props); @@ -233,14 +246,14 @@ public class ShardManagerTest { @Test public void testOnRecoveryJournalIsEmptied(){ MyJournal.addToJournal(1L, new ShardManager.SchemaContextModules( - ImmutableSet.of("foo"))); + ImmutableSet.of("foo"))); assertEquals(1, MyJournal.get().size()); new JavaTestKit(system) {{ final Props props = ShardManager - .props("config", new MockClusterWrapper(), - new MockConfiguration(), new DatastoreContext()); + .props("config", new MockClusterWrapper(), + new MockConfiguration(), new DatastoreContext()); final ActorRef subject = getSystem().actorOf(props); @@ -257,10 +270,10 @@ public class ShardManagerTest { public void testOnRecoveryPreviouslyKnownModulesAreDiscovered() throws Exception { new JavaTestKit(system) {{ final Props props = ShardManager - .props("config", new MockClusterWrapper(), - new MockConfiguration(), new DatastoreContext()); + .props("config", new MockClusterWrapper(), + new MockConfiguration(), new DatastoreContext()); final TestActorRef subject = - TestActorRef.create(system, props); + TestActorRef.create(system, props); subject.underlyingActor().onReceiveRecover(new ShardManager.SchemaContextModules(ImmutableSet.of("foo"))); @@ -272,13 +285,13 @@ public class ShardManagerTest { @Test public void testOnUpdateSchemaContextUpdateKnownModulesIfTheyContainASuperSetOfTheKnownModules() - throws Exception { + throws Exception { new JavaTestKit(system) {{ final Props props = ShardManager - .props("config", new MockClusterWrapper(), - new MockConfiguration(), new DatastoreContext()); + .props("config", new MockClusterWrapper(), + new MockConfiguration(), new DatastoreContext()); final TestActorRef subject = - TestActorRef.create(system, props); + TestActorRef.create(system, props); Collection knownModules = subject.underlyingActor().getKnownModules(); @@ -318,13 +331,13 @@ public class ShardManagerTest { @Test public void testOnUpdateSchemaContextDoNotUpdateKnownModulesIfTheyDoNotContainASuperSetOfKnownModules() - throws Exception { + throws Exception { new JavaTestKit(system) {{ final Props props = ShardManager - .props("config", new MockClusterWrapper(), - new MockConfiguration(), new DatastoreContext()); + .props("config", new MockClusterWrapper(), + new MockConfiguration(), new DatastoreContext()); final TestActorRef subject = - TestActorRef.create(system, props); + TestActorRef.create(system, props); Collection knownModules = subject.underlyingActor().getKnownModules(); @@ -386,7 +399,7 @@ public class ShardManagerTest { } @Override public Future doAsyncReplayMessages(final String persistenceId, long fromSequenceNr, long toSequenceNr, long max, - final Procedure replayCallback) { + final Procedure replayCallback) { if(journal.size() == 0){ return Futures.successful(null); } @@ -395,8 +408,8 @@ public class ShardManagerTest { public Void call() throws Exception { for (Map.Entry entry : journal.entrySet()) { PersistentRepr persistentMessage = - new PersistentImpl(entry.getValue(), entry.getKey(), persistenceId, - false, null, null); + new PersistentImpl(entry.getValue(), entry.getKey(), persistenceId, + false, null, null); replayCallback.apply(persistentMessage); } return null; @@ -409,7 +422,7 @@ public class ShardManagerTest { } @Override public Future doAsyncWriteMessages( - final Iterable persistentReprs) { + final Iterable persistentReprs) { return Futures.future(new Callable() { @Override public Void call() throws Exception { @@ -424,12 +437,12 @@ public class ShardManagerTest { } @Override public Future doAsyncWriteConfirmations( - Iterable persistentConfirmations) { + Iterable persistentConfirmations) { return Futures.successful(null); } @Override public Future doAsyncDeleteMessages(Iterable persistentIds, - boolean b) { + boolean b) { clear(); return Futures.successful(null); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java index a3e0b3a07d..2051c9debe 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java @@ -208,7 +208,7 @@ public class ShardTest extends AbstractActorTest { YangInstanceIdentifier root = YangInstanceIdentifier.builder().build(); NormalizedNode expected = ref.underlyingActor().readStore(root); - NormalizedNodeMessages.Container encode = codec.encode(root, expected); + NormalizedNodeMessages.Container encode = codec.encode(expected); ApplySnapshot applySnapshot = new ApplySnapshot(Snapshot.create( encode.getNormalizedNode().toByteString().toByteArray(), @@ -260,7 +260,7 @@ public class ShardTest extends AbstractActorTest { InMemorySnapshotStore.addSnapshot(IDENTIFIER.toString(), Snapshot.create( new NormalizedNodeToNodeCodec(SCHEMA_CONTEXT).encode( - YangInstanceIdentifier.builder().build(), root). + root). getNormalizedNode().toByteString().toByteArray(), Collections.emptyList(), 0, 1, -1, -1)); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java index 1cd0f85fa1..3c9d857fe8 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java @@ -91,12 +91,12 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest { .successful(((SerializableMessage) responses[i]).toSerializable())); } - stubber.when(actorContext).executeRemoteOperationAsync(any(ActorSelection.class), + stubber.when(actorContext).executeOperationAsync(any(ActorSelection.class), isA(requestType)); } private void verifyCohortInvocations(int nCohorts, Class requestType) { - verify(actorContext, times(nCohorts)).executeRemoteOperationAsync( + verify(actorContext, times(nCohorts)).executeOperationAsync( any(ActorSelection.class), isA(requestType)); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java index e5392e0251..bdcca42d15 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java @@ -1,28 +1,17 @@ package org.opendaylight.controller.cluster.datastore; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; import akka.actor.ActorPath; import akka.actor.ActorRef; import akka.actor.ActorSelection; import akka.actor.Props; import akka.dispatch.Futures; - import com.google.common.base.Optional; import com.google.common.util.concurrent.CheckedFuture; - import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentMatcher; import org.mockito.Mock; import org.mockito.MockitoAnnotations; - -import static org.opendaylight.controller.cluster.datastore.TransactionProxy.TransactionType.READ_ONLY; -import static org.opendaylight.controller.cluster.datastore.TransactionProxy.TransactionType.WRITE_ONLY; -import static org.opendaylight.controller.cluster.datastore.TransactionProxy.TransactionType.READ_WRITE; - import org.opendaylight.controller.cluster.datastore.TransactionProxy.TransactionType; import org.opendaylight.controller.cluster.datastore.exceptions.PrimaryNotFoundException; import org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException; @@ -52,22 +41,29 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCoh import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; import org.opendaylight.yangtools.yang.model.api.SchemaContext; - import scala.concurrent.Await; import scala.concurrent.Future; import scala.concurrent.duration.Duration; + import java.util.List; import java.util.concurrent.TimeUnit; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.argThat; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.argThat; import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.verify; import static org.mockito.Mockito.isA; import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.opendaylight.controller.cluster.datastore.TransactionProxy.TransactionType.READ_ONLY; +import static org.opendaylight.controller.cluster.datastore.TransactionProxy.TransactionType.READ_WRITE; +import static org.opendaylight.controller.cluster.datastore.TransactionProxy.TransactionType.WRITE_ONLY; @SuppressWarnings("resource") public class TransactionProxyTest extends AbstractActorTest { @@ -224,11 +220,17 @@ public class TransactionProxyTest extends AbstractActorTest { ActorRef actorRef = getSystem().actorOf(Props.create(DoNothingActor.class)); doReturn(getSystem().actorSelection(actorRef.path())). when(mockActorContext).actorSelection(actorRef.path().toString()); + + doReturn(Optional.of(getSystem().actorSelection(actorRef.path()))). + when(mockActorContext).findPrimaryShard(eq(DefaultShardStrategy.DEFAULT_SHARD)); + doReturn(createTransactionReply(actorRef)).when(mockActorContext). - executeShardOperation(eq(DefaultShardStrategy.DEFAULT_SHARD), + executeOperation(eq(getSystem().actorSelection(actorRef.path())), eqCreateTransaction(memberName, type)); + doReturn(actorRef.path().toString()).when(mockActorContext).resolvePath( anyString(), eq(actorRef.path().toString())); + doReturn(actorRef.path()).when(mockActorContext).actorFor(actorRef.path().toString()); return actorRef; @@ -252,7 +254,7 @@ public class TransactionProxyTest extends AbstractActorTest { TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_ONLY); - doReturn(readDataReply(null)).when(mockActorContext).executeRemoteOperationAsync( + doReturn(readDataReply(null)).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqReadData()); Optional> readOptional = transactionProxy.read( @@ -262,7 +264,7 @@ public class TransactionProxyTest extends AbstractActorTest { NormalizedNode expectedNode = ImmutableNodes.containerNode(TestModel.TEST_QNAME); - doReturn(readDataReply(expectedNode)).when(mockActorContext).executeRemoteOperationAsync( + doReturn(readDataReply(expectedNode)).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqReadData()); readOptional = transactionProxy.read(TestModel.TEST_PATH).get(5, TimeUnit.SECONDS); @@ -277,7 +279,7 @@ public class TransactionProxyTest extends AbstractActorTest { setupActorContextWithInitialCreateTransaction(READ_ONLY); doReturn(Futures.successful(new Object())).when(mockActorContext). - executeRemoteOperationAsync(any(ActorSelection.class), any()); + executeOperationAsync(any(ActorSelection.class), any()); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_ONLY); @@ -290,7 +292,7 @@ public class TransactionProxyTest extends AbstractActorTest { setupActorContextWithInitialCreateTransaction(READ_ONLY); doReturn(Futures.failed(new TestException())).when(mockActorContext). - executeRemoteOperationAsync(any(ActorSelection.class), any()); + executeOperationAsync(any(ActorSelection.class), any()); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_ONLY); @@ -300,12 +302,17 @@ public class TransactionProxyTest extends AbstractActorTest { private void testExceptionOnInitialCreateTransaction(Exception exToThrow, Invoker invoker) throws Throwable { + ActorRef actorRef = getSystem().actorOf(Props.create(DoNothingActor.class)); - doThrow(exToThrow).when(mockActorContext).executeShardOperation( - anyString(), any()); + if (exToThrow instanceof PrimaryNotFoundException) { + doReturn(Optional.absent()).when(mockActorContext).findPrimaryShard(anyString()); + } else { + doReturn(Optional.of(getSystem().actorSelection(actorRef.path()))). + when(mockActorContext).findPrimaryShard(anyString()); + } + doThrow(exToThrow).when(mockActorContext).executeOperation(any(ActorSelection.class), any()); - TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, - READ_ONLY); + TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_ONLY); propagateReadFailedExceptionCause(invoker.invoke(transactionProxy)); } @@ -341,13 +348,13 @@ public class TransactionProxyTest extends AbstractActorTest { NormalizedNode nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME); - doReturn(writeDataReply()).when(mockActorContext).executeRemoteOperationAsync( + doReturn(writeDataReply()).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqWriteData(nodeToWrite)); doReturn(Futures.failed(new TestException())).when(mockActorContext). - executeRemoteOperationAsync(eq(actorSelection(actorRef)), eqDeleteData()); + executeOperationAsync(eq(actorSelection(actorRef)), eqDeleteData()); - doReturn(readDataReply(null)).when(mockActorContext).executeRemoteOperationAsync( + doReturn(readDataReply(null)).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqReadData()); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, @@ -360,7 +367,7 @@ public class TransactionProxyTest extends AbstractActorTest { try { propagateReadFailedExceptionCause(transactionProxy.read(TestModel.TEST_PATH)); } finally { - verify(mockActorContext, times(0)).executeRemoteOperationAsync( + verify(mockActorContext, times(0)).executeOperationAsync( eq(actorSelection(actorRef)), eqReadData()); } } @@ -371,10 +378,10 @@ public class TransactionProxyTest extends AbstractActorTest { NormalizedNode expectedNode = ImmutableNodes.containerNode(TestModel.TEST_QNAME); - doReturn(writeDataReply()).when(mockActorContext).executeRemoteOperationAsync( + doReturn(writeDataReply()).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqWriteData(expectedNode)); - doReturn(readDataReply(expectedNode)).when(mockActorContext).executeRemoteOperationAsync( + doReturn(readDataReply(expectedNode)).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqReadData()); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, @@ -406,14 +413,14 @@ public class TransactionProxyTest extends AbstractActorTest { TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_ONLY); - doReturn(dataExistsReply(false)).when(mockActorContext).executeRemoteOperationAsync( + doReturn(dataExistsReply(false)).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqDataExists()); Boolean exists = transactionProxy.exists(TestModel.TEST_PATH).checkedGet(); assertEquals("Exists response", false, exists); - doReturn(dataExistsReply(true)).when(mockActorContext).executeRemoteOperationAsync( + doReturn(dataExistsReply(true)).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqDataExists()); exists = transactionProxy.exists(TestModel.TEST_PATH).checkedGet(); @@ -436,7 +443,7 @@ public class TransactionProxyTest extends AbstractActorTest { setupActorContextWithInitialCreateTransaction(READ_ONLY); doReturn(Futures.successful(new Object())).when(mockActorContext). - executeRemoteOperationAsync(any(ActorSelection.class), any()); + executeOperationAsync(any(ActorSelection.class), any()); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_ONLY); @@ -449,7 +456,7 @@ public class TransactionProxyTest extends AbstractActorTest { setupActorContextWithInitialCreateTransaction(READ_ONLY); doReturn(Futures.failed(new TestException())).when(mockActorContext). - executeRemoteOperationAsync(any(ActorSelection.class), any()); + executeOperationAsync(any(ActorSelection.class), any()); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_ONLY); @@ -463,13 +470,13 @@ public class TransactionProxyTest extends AbstractActorTest { NormalizedNode nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME); - doReturn(writeDataReply()).when(mockActorContext).executeRemoteOperationAsync( + doReturn(writeDataReply()).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqWriteData(nodeToWrite)); doReturn(Futures.failed(new TestException())).when(mockActorContext). - executeRemoteOperationAsync(eq(actorSelection(actorRef)), eqDeleteData()); + executeOperationAsync(eq(actorSelection(actorRef)), eqDeleteData()); - doReturn(dataExistsReply(false)).when(mockActorContext).executeRemoteOperationAsync( + doReturn(dataExistsReply(false)).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqDataExists()); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, @@ -482,7 +489,7 @@ public class TransactionProxyTest extends AbstractActorTest { try { propagateReadFailedExceptionCause(transactionProxy.exists(TestModel.TEST_PATH)); } finally { - verify(mockActorContext, times(0)).executeRemoteOperationAsync( + verify(mockActorContext, times(0)).executeOperationAsync( eq(actorSelection(actorRef)), eqDataExists()); } } @@ -493,10 +500,10 @@ public class TransactionProxyTest extends AbstractActorTest { NormalizedNode nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME); - doReturn(writeDataReply()).when(mockActorContext).executeRemoteOperationAsync( + doReturn(writeDataReply()).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqWriteData(nodeToWrite)); - doReturn(dataExistsReply(true)).when(mockActorContext).executeRemoteOperationAsync( + doReturn(dataExistsReply(true)).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqDataExists()); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, @@ -547,7 +554,7 @@ public class TransactionProxyTest extends AbstractActorTest { NormalizedNode nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME); - doReturn(writeDataReply()).when(mockActorContext).executeRemoteOperationAsync( + doReturn(writeDataReply()).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqWriteData(nodeToWrite)); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, @@ -555,7 +562,7 @@ public class TransactionProxyTest extends AbstractActorTest { transactionProxy.write(TestModel.TEST_PATH, nodeToWrite); - verify(mockActorContext).executeRemoteOperationAsync( + verify(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqWriteData(nodeToWrite)); verifyRecordingOperationFutures(transactionProxy.getRecordedOperationFutures(), @@ -590,7 +597,7 @@ public class TransactionProxyTest extends AbstractActorTest { NormalizedNode nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME); - doReturn(mergeDataReply()).when(mockActorContext).executeRemoteOperationAsync( + doReturn(mergeDataReply()).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqMergeData(nodeToWrite)); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, @@ -598,7 +605,7 @@ public class TransactionProxyTest extends AbstractActorTest { transactionProxy.merge(TestModel.TEST_PATH, nodeToWrite); - verify(mockActorContext).executeRemoteOperationAsync( + verify(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqMergeData(nodeToWrite)); verifyRecordingOperationFutures(transactionProxy.getRecordedOperationFutures(), @@ -609,7 +616,7 @@ public class TransactionProxyTest extends AbstractActorTest { public void testDelete() throws Exception { ActorRef actorRef = setupActorContextWithInitialCreateTransaction(WRITE_ONLY); - doReturn(deleteDataReply()).when(mockActorContext).executeRemoteOperationAsync( + doReturn(deleteDataReply()).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqDeleteData()); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, @@ -617,7 +624,7 @@ public class TransactionProxyTest extends AbstractActorTest { transactionProxy.delete(TestModel.TEST_PATH); - verify(mockActorContext).executeRemoteOperationAsync( + verify(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqDeleteData()); verifyRecordingOperationFutures(transactionProxy.getRecordedOperationFutures(), @@ -656,13 +663,13 @@ public class TransactionProxyTest extends AbstractActorTest { NormalizedNode nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME); - doReturn(readDataReply(null)).when(mockActorContext).executeRemoteOperationAsync( + doReturn(readDataReply(null)).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqReadData()); - doReturn(writeDataReply()).when(mockActorContext).executeRemoteOperationAsync( + doReturn(writeDataReply()).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqWriteData(nodeToWrite)); - doReturn(readyTxReply(actorRef.path())).when(mockActorContext).executeRemoteOperationAsync( + doReturn(readyTxReply(actorRef.path())).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), isA(ReadyTransaction.SERIALIZABLE_CLASS)); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, @@ -691,13 +698,13 @@ public class TransactionProxyTest extends AbstractActorTest { NormalizedNode nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME); - doReturn(mergeDataReply()).when(mockActorContext).executeRemoteOperationAsync( + doReturn(mergeDataReply()).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqMergeData(nodeToWrite)); doReturn(Futures.failed(new TestException())).when(mockActorContext). - executeRemoteOperationAsync(eq(actorSelection(actorRef)), eqWriteData(nodeToWrite)); + executeOperationAsync(eq(actorSelection(actorRef)), eqWriteData(nodeToWrite)); - doReturn(readyTxReply(actorRef.path())).when(mockActorContext).executeRemoteOperationAsync( + doReturn(readyTxReply(actorRef.path())).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), isA(ReadyTransaction.SERIALIZABLE_CLASS)); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, @@ -726,11 +733,11 @@ public class TransactionProxyTest extends AbstractActorTest { NormalizedNode nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME); - doReturn(mergeDataReply()).when(mockActorContext).executeRemoteOperationAsync( + doReturn(mergeDataReply()).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqMergeData(nodeToWrite)); doReturn(Futures.failed(new TestException())).when(mockActorContext). - executeRemoteOperationAsync(eq(actorSelection(actorRef)), + executeOperationAsync(eq(actorSelection(actorRef)), isA(ReadyTransaction.SERIALIZABLE_CLASS)); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, @@ -753,8 +760,9 @@ public class TransactionProxyTest extends AbstractActorTest { @Test public void testReadyWithInitialCreateTransactionFailure() throws Exception { - doThrow(new PrimaryNotFoundException("mock")).when(mockActorContext).executeShardOperation( - anyString(), any()); + doReturn(Optional.absent()).when(mockActorContext).findPrimaryShard(anyString()); +// doThrow(new PrimaryNotFoundException("mock")).when(mockActorContext).executeShardOperation( +// anyString(), any()); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, WRITE_ONLY); @@ -783,11 +791,11 @@ public class TransactionProxyTest extends AbstractActorTest { NormalizedNode nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME); - doReturn(writeDataReply()).when(mockActorContext).executeRemoteOperationAsync( + doReturn(writeDataReply()).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqWriteData(nodeToWrite)); doReturn(Futures.successful(new Object())).when(mockActorContext). - executeRemoteOperationAsync(eq(actorSelection(actorRef)), + executeOperationAsync(eq(actorSelection(actorRef)), isA(ReadyTransaction.SERIALIZABLE_CLASS)); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, @@ -820,7 +828,7 @@ public class TransactionProxyTest extends AbstractActorTest { public void testClose() throws Exception{ ActorRef actorRef = setupActorContextWithInitialCreateTransaction(READ_WRITE); - doReturn(readDataReply(null)).when(mockActorContext).executeRemoteOperationAsync( + doReturn(readDataReply(null)).when(mockActorContext).executeOperationAsync( eq(actorSelection(actorRef)), eqReadData()); TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, @@ -830,7 +838,7 @@ public class TransactionProxyTest extends AbstractActorTest { transactionProxy.close(); - verify(mockActorContext).sendRemoteOperationAsync( + verify(mockActorContext).sendOperationAsync( eq(actorSelection(actorRef)), isA(CloseTransaction.SERIALIZABLE_CLASS)); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/identifiers/ShardIdentifierTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/identifiers/ShardIdentifierTest.java index afcd045434..0b5e7132c7 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/identifiers/ShardIdentifierTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/identifiers/ShardIdentifierTest.java @@ -14,5 +14,14 @@ public class ShardIdentifierTest { assertEquals("member-1-shard-inventory-config", id.toString()); } + @Test + public void testFromShardIdString(){ + String shardIdStr = "member-1-shard-inventory-config"; + + ShardIdentifier id = ShardIdentifier.builder().fromShardIdString(shardIdStr).build(); + assertEquals("member-1", id.getMemberName()); + assertEquals("inventory", id.getShardName()); + assertEquals("config", id.getType()); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/MergeDataTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/MergeDataTest.java index 75128e6a25..8f3ca9c535 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/MergeDataTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/MergeDataTest.java @@ -1,47 +1,21 @@ package org.opendaylight.controller.cluster.datastore.messages; -import junit.framework.Assert; +import org.junit.Assert; import org.junit.Test; -import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec; import org.opendaylight.controller.md.cluster.datastore.model.TestModel; -import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; -import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; public class MergeDataTest { @Test - public void testBasic(){ - MergeData mergeData = new MergeData(TestModel.TEST_PATH, ImmutableNodes - .containerNode(TestModel.TEST_QNAME), - TestModel.createTestContext()); - - MergeData output = MergeData - .fromSerializable(mergeData.toSerializable(), - TestModel.createTestContext()); - - } - - @Test - public void testNormalizedNodeEncodeDecode(){ - NormalizedNode expected = - ImmutableNodes.containerNode(TestModel.TEST_QNAME); - - - NormalizedNodeMessages.Container node = - new NormalizedNodeToNodeCodec(TestModel.createTestContext()) - .encode(TestModel.TEST_PATH, - expected); - - String parentPath = node.getParentPath(); - - NormalizedNodeMessages.Node normalizedNode = - node.getNormalizedNode(); - - NormalizedNode actual = new NormalizedNodeToNodeCodec(TestModel.createTestContext()).decode(TestModel.TEST_PATH, - normalizedNode); - - - Assert.assertEquals(expected, actual); + public void testSerialization() { + SchemaContext schemaContext = TestModel.createTestContext(); + MergeData expected = new MergeData(TestModel.TEST_PATH, ImmutableNodes + .containerNode(TestModel.TEST_QNAME), schemaContext); + + MergeData actual = MergeData.fromSerializable(expected.toSerializable(), schemaContext); + Assert.assertEquals("getPath", expected.getPath(), actual.getPath()); + Assert.assertEquals("getData", expected.getData(), actual.getData()); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/WriteDataTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/WriteDataTest.java new file mode 100644 index 0000000000..6a5d65f8da --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/WriteDataTest.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2014 Brocade Communications Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.cluster.datastore.messages; + +import org.junit.Assert; +import org.junit.Test; +import org.opendaylight.controller.md.cluster.datastore.model.TestModel; +import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; + +/** + * Unit tests for WriteData. + * + * @author Thomas Pantelis + */ +public class WriteDataTest { + + @Test + public void testSerialization() { + SchemaContext schemaContext = TestModel.createTestContext(); + WriteData expected = new WriteData(TestModel.TEST_PATH, ImmutableNodes + .containerNode(TestModel.TEST_QNAME), schemaContext); + + WriteData actual = WriteData.fromSerializable(expected.toSerializable(), schemaContext); + Assert.assertEquals("getPath", expected.getPath(), actual.getPath()); + Assert.assertEquals("getData", expected.getData(), actual.getData()); + } +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MergeModificationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MergeModificationTest.java index 9af3439ae1..5d2021167b 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MergeModificationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MergeModificationTest.java @@ -7,22 +7,38 @@ import org.opendaylight.controller.md.cluster.datastore.model.TestModel; import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; public class MergeModificationTest extends AbstractModificationTest{ - @Test - public void testApply() throws Exception { - //TODO : Need to write a better test for this + @Test + public void testApply() throws Exception { + //TODO : Need to write a better test for this - //Write something into the datastore - DOMStoreReadWriteTransaction writeTransaction = store.newReadWriteTransaction(); - MergeModification writeModification = new MergeModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()); - writeModification.apply(writeTransaction); - commitTransaction(writeTransaction); + //Write something into the datastore + DOMStoreReadWriteTransaction writeTransaction = store.newReadWriteTransaction(); + MergeModification writeModification = new MergeModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()); + writeModification.apply(writeTransaction); + commitTransaction(writeTransaction); - //Check if it's in the datastore - Optional> data = readData(TestModel.TEST_PATH); - Assert.assertTrue(data.isPresent()); + //Check if it's in the datastore + Optional> data = readData(TestModel.TEST_PATH); + Assert.assertTrue(data.isPresent()); - } + } + + @Test + public void testSerialization() { + SchemaContext schemaContext = TestModel.createTestContext(); + NormalizedNode node = ImmutableNodes.containerNode(TestModel.TEST_QNAME); + MergeModification mergeModification = new MergeModification(TestModel.TEST_PATH, + node, schemaContext); + + Object serialized = mergeModification.toSerializable(); + + MergeModification newModification = MergeModification.fromSerializable(serialized, schemaContext); + + Assert.assertEquals("getPath", TestModel.TEST_PATH, newModification.getPath()); + Assert.assertEquals("getData", node, newModification.getData()); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModificationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModificationTest.java index 03aaace0e3..f8116aa78d 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModificationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModificationTest.java @@ -35,8 +35,9 @@ public class MutableCompositeModificationTest extends AbstractModificationTest { MutableCompositeModification compositeModification = new MutableCompositeModification(); compositeModification.addModification(new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext())); - - assertNotEquals(compositeModification.toSerializable(), compositeModification.toSerializable()); - + Object one = compositeModification.toSerializable(); + try{Thread.sleep(10);}catch(Exception err){} + Object two = compositeModification.toSerializable(); + assertNotEquals(one,two); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/WriteModificationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/WriteModificationTest.java index 75d8c00db8..3a82fffccb 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/WriteModificationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/WriteModificationTest.java @@ -7,20 +7,36 @@ import org.opendaylight.controller.md.cluster.datastore.model.TestModel; import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; public class WriteModificationTest extends AbstractModificationTest{ - @Test - public void testApply() throws Exception { - //Write something into the datastore - DOMStoreReadWriteTransaction writeTransaction = store.newReadWriteTransaction(); - WriteModification writeModification = new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()); - writeModification.apply(writeTransaction); - commitTransaction(writeTransaction); + @Test + public void testApply() throws Exception { + //Write something into the datastore + DOMStoreReadWriteTransaction writeTransaction = store.newReadWriteTransaction(); + WriteModification writeModification = new WriteModification(TestModel.TEST_PATH, + ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()); + writeModification.apply(writeTransaction); + commitTransaction(writeTransaction); - //Check if it's in the datastore - Optional> data = readData(TestModel.TEST_PATH); - Assert.assertTrue(data.isPresent()); + //Check if it's in the datastore + Optional> data = readData(TestModel.TEST_PATH); + Assert.assertTrue(data.isPresent()); + } - } + @Test + public void testSerialization() { + SchemaContext schemaContext = TestModel.createTestContext(); + NormalizedNode node = ImmutableNodes.containerNode(TestModel.TEST_QNAME); + WriteModification writeModification = new WriteModification(TestModel.TEST_PATH, + node, schemaContext); + + Object serialized = writeModification.toSerializable(); + + WriteModification newModification = WriteModification.fromSerializable(serialized, schemaContext); + + Assert.assertEquals("getPath", TestModel.TEST_PATH, newModification.getPath()); + Assert.assertEquals("getData", node, newModification.getData()); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java index 5d8fb8393d..fa6d0b060f 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java @@ -1,6 +1,5 @@ package org.opendaylight.controller.cluster.datastore.utils; -import java.util.concurrent.TimeUnit; import akka.actor.ActorRef; import akka.actor.ActorSelection; import akka.actor.ActorSystem; @@ -8,7 +7,7 @@ import akka.actor.Props; import akka.actor.UntypedActor; import akka.japi.Creator; import akka.testkit.JavaTestKit; - +import com.google.common.base.Optional; import org.junit.Test; import org.opendaylight.controller.cluster.datastore.AbstractActorTest; import org.opendaylight.controller.cluster.datastore.ClusterWrapper; @@ -16,12 +15,14 @@ import org.opendaylight.controller.cluster.datastore.Configuration; import org.opendaylight.controller.cluster.datastore.messages.FindLocalShard; import org.opendaylight.controller.cluster.datastore.messages.LocalShardFound; import org.opendaylight.controller.cluster.datastore.messages.LocalShardNotFound; - import scala.concurrent.Await; import scala.concurrent.Future; import scala.concurrent.duration.Duration; + +import java.util.concurrent.TimeUnit; + import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; public class ActorContextTest extends AbstractActorTest{ @@ -100,63 +101,6 @@ public class ActorContextTest extends AbstractActorTest{ } } - @Test - public void testExecuteLocalShardOperationWithShardFound(){ - new JavaTestKit(getSystem()) {{ - - new Within(duration("1 seconds")) { - @Override - protected void run() { - - ActorRef shardActorRef = getSystem().actorOf(Props.create(EchoActor.class)); - - ActorRef shardManagerActorRef = getSystem() - .actorOf(MockShardManager.props(true, shardActorRef)); - - ActorContext actorContext = - new ActorContext(getSystem(), shardManagerActorRef , mock(ClusterWrapper.class), - mock(Configuration.class)); - - Object out = actorContext.executeLocalShardOperation("default", "hello"); - - assertEquals("hello", out); - - - expectNoMsg(); - } - }; - }}; - - } - - @Test - public void testExecuteLocalShardOperationWithShardNotFound(){ - new JavaTestKit(getSystem()) {{ - - new Within(duration("1 seconds")) { - @Override - protected void run() { - - ActorRef shardManagerActorRef = getSystem() - .actorOf(MockShardManager.props(false, null)); - - ActorContext actorContext = - new ActorContext(getSystem(), shardManagerActorRef , mock(ClusterWrapper.class), - mock(Configuration.class)); - - Object out = actorContext.executeLocalShardOperation("default", "hello"); - - assertNull(out); - - - expectNoMsg(); - } - }; - }}; - - } - - @Test public void testFindLocalShardWithShardFound(){ new JavaTestKit(getSystem()) {{ @@ -174,9 +118,9 @@ public class ActorContextTest extends AbstractActorTest{ new ActorContext(getSystem(), shardManagerActorRef , mock(ClusterWrapper.class), mock(Configuration.class)); - Object out = actorContext.findLocalShard("default"); + Optional out = actorContext.findLocalShard("default"); - assertEquals(shardActorRef, out); + assertEquals(shardActorRef, out.get()); expectNoMsg(); @@ -201,11 +145,8 @@ public class ActorContextTest extends AbstractActorTest{ new ActorContext(getSystem(), shardManagerActorRef , mock(ClusterWrapper.class), mock(Configuration.class)); - Object out = actorContext.findLocalShard("default"); - - assertNull(out); - - + Optional out = actorContext.findLocalShard("default"); + assertTrue(!out.isPresent()); expectNoMsg(); } }; @@ -232,7 +173,7 @@ public class ActorContextTest extends AbstractActorTest{ ActorSelection actor = actorContext.actorSelection(shardActorRef.path()); - Object out = actorContext.executeRemoteOperation(actor, "hello"); + Object out = actorContext.executeOperation(actor, "hello"); assertEquals("hello", out); @@ -261,7 +202,7 @@ public class ActorContextTest extends AbstractActorTest{ ActorSelection actor = actorContext.actorSelection(shardActorRef.path()); - Future future = actorContext.executeRemoteOperationAsync(actor, "hello"); + Future future = actorContext.executeOperationAsync(actor, "hello"); try { Object result = Await.result(future, Duration.create(3, TimeUnit.SECONDS)); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockActorContext.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockActorContext.java index 8fa3a17f90..81b6bccaf0 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockActorContext.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockActorContext.java @@ -12,6 +12,7 @@ import static org.junit.Assert.assertNotNull; import akka.actor.ActorRef; import akka.actor.ActorSelection; import akka.actor.ActorSystem; +import com.google.common.base.Optional; public class MockActorContext extends ActorContext { @@ -30,19 +31,13 @@ public class MockActorContext extends ActorContext { super(actorSystem, shardManager, new MockClusterWrapper(), new MockConfiguration()); } - - @Override public Object executeShardOperation(String shardName, - Object message) { - return executeShardOperationResponse; - } - - @Override public Object executeRemoteOperation(ActorSelection actor, - Object message) { + @Override public Object executeOperation(ActorSelection actor, + Object message) { return executeRemoteOperationResponse; } - @Override public ActorSelection findPrimary(String shardName) { - return null; + @Override public Optional findPrimaryShard(String shardName) { + return Optional.absent(); } public void setExecuteShardOperationResponse(Object response){ @@ -74,14 +69,9 @@ public class MockActorContext extends ActorContext { } @Override - public Object executeLocalOperation(ActorRef actor, - Object message) { + public Object executeOperation(ActorRef actor, + Object message) { return this.executeLocalOperationResponse; } - @Override - public Object executeLocalShardOperation(String shardName, - Object message) { - return this.executeLocalShardOperationResponse; - } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/TestUtils.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/TestUtils.java index 4ddba2f1b9..3bad468950 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/TestUtils.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/TestUtils.java @@ -21,7 +21,7 @@ public class TestUtils { ActorContext testContext = new ActorContext(actorSystem, actorSystem.actorOf( Props.create(DoNothingActor.class)), new MockClusterWrapper(), new MockConfiguration()); Object messages = testContext - .executeLocalOperation(actorRef, "messages"); + .executeOperation(actorRef, "messages"); Assert.assertNotNull(messages); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SampleModelsTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SampleModelsTest.java index be8713c702..2300f9d130 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SampleModelsTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SampleModelsTest.java @@ -12,7 +12,6 @@ import junit.framework.Assert; import org.junit.Test; import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec; import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; public class SampleModelsTest { @@ -23,14 +22,12 @@ public class SampleModelsTest { final NormalizedNodeMessages.Container node = new NormalizedNodeToNodeCodec(SchemaContextHelper.full()) - .encode(YangInstanceIdentifier.of(PeopleModel.BASE_QNAME), - expected); + .encode(expected); final NormalizedNodeMessages.Node normalizedNode = node.getNormalizedNode(); - final NormalizedNode actual = new NormalizedNodeToNodeCodec(SchemaContextHelper.full()).decode(YangInstanceIdentifier.of(PeopleModel.BASE_QNAME), - normalizedNode); + final NormalizedNode actual = new NormalizedNodeToNodeCodec(SchemaContextHelper.full()).decode(normalizedNode); Assert.assertEquals(expected, actual); @@ -45,14 +42,12 @@ public class SampleModelsTest { final NormalizedNodeMessages.Container node = new NormalizedNodeToNodeCodec(SchemaContextHelper.full()) - .encode(YangInstanceIdentifier.of(CarsModel.BASE_QNAME), - expected); + .encode(expected); final NormalizedNodeMessages.Node normalizedNode = node.getNormalizedNode(); final NormalizedNode actual = new NormalizedNodeToNodeCodec(SchemaContextHelper.full()).decode( - YangInstanceIdentifier.of(CarsModel.BASE_QNAME), normalizedNode); diff --git a/opendaylight/md-sal/sal-dom-api/pom.xml b/opendaylight/md-sal/sal-dom-api/pom.xml index ab392a06f8..0302a7d920 100644 --- a/opendaylight/md-sal/sal-dom-api/pom.xml +++ b/opendaylight/md-sal/sal-dom-api/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-core-api bundle diff --git a/opendaylight/md-sal/sal-dom-broker/pom.xml b/opendaylight/md-sal/sal-dom-broker/pom.xml index 96e353b80e..dc20296ff5 100644 --- a/opendaylight/md-sal/sal-dom-broker/pom.xml +++ b/opendaylight/md-sal/sal-dom-broker/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-broker-impl bundle @@ -45,7 +45,7 @@ org.opendaylight.controller sal-inmemory-datastore - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT diff --git a/opendaylight/md-sal/sal-dom-spi/pom.xml b/opendaylight/md-sal/sal-dom-spi/pom.xml index 88ac86a45e..6cc721e68d 100644 --- a/opendaylight/md-sal/sal-dom-spi/pom.xml +++ b/opendaylight/md-sal/sal-dom-spi/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-core-spi bundle diff --git a/opendaylight/md-sal/sal-dom-xsql-config/pom.xml b/opendaylight/md-sal/sal-dom-xsql-config/pom.xml index 077405fe6e..e8919d0ee1 100644 --- a/opendaylight/md-sal/sal-dom-xsql-config/pom.xml +++ b/opendaylight/md-sal/sal-dom-xsql-config/pom.xml @@ -12,7 +12,7 @@ sal-parent org.opendaylight.controller - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-dom-xsql-config org.opendaylight.controller diff --git a/opendaylight/md-sal/sal-dom-xsql/pom.xml b/opendaylight/md-sal/sal-dom-xsql/pom.xml index 2ab80daf3b..f5898a2bb9 100644 --- a/opendaylight/md-sal/sal-dom-xsql/pom.xml +++ b/opendaylight/md-sal/sal-dom-xsql/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-dom-xsql bundle diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCDriver.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/odl/xsql/JDBCDriver.java similarity index 84% rename from opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCDriver.java rename to opendaylight/md-sal/sal-dom-xsql/src/main/java/org/odl/xsql/JDBCDriver.java index e4b4e249df..cc92b48a15 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCDriver.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/odl/xsql/JDBCDriver.java @@ -1,4 +1,4 @@ -package org.opendaylight.controller.md.sal.dom.xsql.jdbc; +package org.odl.xsql; import java.sql.Connection; import java.sql.Driver; @@ -9,6 +9,8 @@ import java.sql.SQLFeatureNotSupportedException; import java.util.Properties; import java.util.logging.Logger; +import org.opendaylight.controller.md.sal.dom.xsql.jdbc.JDBCConnection; + public class JDBCDriver implements Driver { public static JDBCDriver drv = new JDBCDriver(); @@ -34,11 +36,12 @@ public class JDBCDriver implements Driver { if (url.equals("svr")) { return new JDBCConnection(true); } else { - return new JDBCConnection(url); + return new JDBCConnection(url).getProxy(); } } catch (Exception err) { err.printStackTrace(); } + System.err.println("Error JDBC Connection"); return null; } @@ -55,7 +58,7 @@ public class JDBCDriver implements Driver { @Override public DriverPropertyInfo[] getPropertyInfo(String arg0, Properties arg1) throws SQLException { - DriverPropertyInfo i = new DriverPropertyInfo("NQL", "NQL"); + DriverPropertyInfo i = new DriverPropertyInfo("OpenDayLight", "OpenDayLight"); return new DriverPropertyInfo[] {i}; } diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java index d1f11ba9a3..beab6d2fb1 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java @@ -63,6 +63,18 @@ public class XSQLAdapter extends Thread implements SchemaContextListener { } + public void loadBluePrint(){ + try{ + InputStream in = this.getClass().getClassLoader().getResourceAsStream("BluePrintCache.dat"); + if(in!=null){ + this.bluePrint = XSQLBluePrint.load(in); + } + in.close(); + }catch(Exception err){ + err.printStackTrace(); + } + } + public static XSQLAdapter getInstance() { return a; } @@ -164,6 +176,10 @@ public class XSQLAdapter extends Thread implements SchemaContextListener { } public void execute(JDBCResultSet rs) { + if(this.domDataBroker==null){ + rs.setFinished(true); + return; + } List tables = rs.getTables(); List roots = collectModuleRoots(tables.get(0),LogicalDatastoreType.OPERATIONAL); roots.addAll(collectModuleRoots(tables.get(0),LogicalDatastoreType.CONFIGURATION)); @@ -282,6 +298,8 @@ public class XSQLAdapter extends Thread implements SchemaContextListener { sout.close(); } catch (Exception err) { } + } else if (input.equals("save")) { + XSQLBluePrint.save(this.bluePrint); } else if (input.equals("tocsv")) { toCsv = !toCsv; sout.println("to csv file is " + toCsv); diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java index 1a31662020..7b51d03a97 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java @@ -1,5 +1,12 @@ package org.opendaylight.controller.md.sal.dom.xsql; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; @@ -17,18 +24,20 @@ import java.util.List; import java.util.Map; import java.util.Set; -public class XSQLBluePrint implements DatabaseMetaData { +public class XSQLBluePrint implements DatabaseMetaData, Serializable { - public static final String CACHE_FILE_NAME = "BluePrintCache.dat"; + private static final long serialVersionUID = 1L; + + public static final String CACHE_FILE_NAME = "./BluePrintCache.dat"; private Map tableNameToBluePrint = new HashMap(); - private Map> odlNameToBluePrint = new HashMap>(); + private Map> odlNameToBluePrint = new HashMap>(); private boolean cacheLoadedSuccessfuly = false; private DatabaseMetaData myProxy = null; public static final String replaceAll(String source, String toReplace, - String withThis) { + String withThis) { int index = source.indexOf(toReplace); int index2 = 0; StringBuffer result = new StringBuffer(); @@ -47,9 +56,41 @@ public class XSQLBluePrint implements DatabaseMetaData { public XSQLBluePrint() { } + public static void save(XSQLBluePrint bp) { + ObjectOutputStream out = null; + try { + out = new ObjectOutputStream(new DataOutputStream( + new FileOutputStream(CACHE_FILE_NAME))); + out.writeObject(bp); + } catch (Exception err) { + err.printStackTrace(); + } finally { + try { + out.close(); + } catch (Exception err) { + } + } + } + + public static XSQLBluePrint load(InputStream ins) { + ObjectInputStream in = null; + try { + in = new ObjectInputStream(new DataInputStream(ins)); + return (XSQLBluePrint) in.readObject(); + } catch (Exception err) { + err.printStackTrace(); + } finally { + try { + in.close(); + } catch (Exception err) { + } + } + return null; + } + private class NQLBluePrintProxy implements InvocationHandler { public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable { + throws Throwable { System.out.println("Method " + method); return method.invoke(XSQLBluePrint.this, args); } @@ -58,9 +99,9 @@ public class XSQLBluePrint implements DatabaseMetaData { public DatabaseMetaData getProxy() { if (myProxy == null) { try { - myProxy = (DatabaseMetaData) Proxy - .newProxyInstance(getClass().getClassLoader(), - new Class[] {DatabaseMetaData.class}, + myProxy = (DatabaseMetaData) Proxy.newProxyInstance(getClass() + .getClassLoader(), + new Class[] { DatabaseMetaData.class }, new NQLBluePrintProxy()); } catch (Exception err) { err.printStackTrace(); @@ -69,22 +110,12 @@ public class XSQLBluePrint implements DatabaseMetaData { return myProxy; } - /* - public void loadBluePrintCache(String hostName) { - try { - ObjectInputStream in = new ObjectInputStream( - new FileInputStream(hostName + "-" + CACHE_FILE_NAME)); - cache = (Map) in.readObject(); - in.close(); - cacheLoadedSuccessfuly = true; - } catch (Exception err) { - //err.printStackTrace(); - } - }*/ - - public XSQLBluePrintNode[] getBluePrintNodeByODLTableName(String odlTableName) { - Map map = this.odlNameToBluePrint.get(odlTableName); - if(map==null) return null; + public XSQLBluePrintNode[] getBluePrintNodeByODLTableName( + String odlTableName) { + Map map = this.odlNameToBluePrint + .get(odlTableName); + if (map == null) + return null; return map.values().toArray(new XSQLBluePrintNode[map.size()]); } @@ -106,26 +137,28 @@ public class XSQLBluePrint implements DatabaseMetaData { } for (XSQLBluePrintNode n : tableNameToBluePrint.values()) { - if (n.getBluePrintNodeName().toLowerCase().endsWith(tableName.toLowerCase())) { + if (n.getBluePrintNodeName().toLowerCase() + .endsWith(tableName.toLowerCase())) { return n; } } for (XSQLBluePrintNode n : tableNameToBluePrint.values()) { - if (n.getBluePrintNodeName().toLowerCase().equals(tableName.toLowerCase())) { + if (n.getBluePrintNodeName().toLowerCase() + .equals(tableName.toLowerCase())) { return n; } } for (XSQLBluePrintNode n : tableNameToBluePrint.values()) { - if (n.getBluePrintNodeName().toLowerCase().indexOf(tableName.toLowerCase())!= -1) { + if (n.getBluePrintNodeName().toLowerCase() + .indexOf(tableName.toLowerCase()) != -1) { return n; } } return null; } - public boolean isCacheLoaded() { return cacheLoadedSuccessfuly; } @@ -133,7 +166,7 @@ public class XSQLBluePrint implements DatabaseMetaData { private static Map> superClassMap = new HashMap>(); public static Set getInheritance(Class myObjectClass, - Class returnType) { + Class returnType) { if (returnType != null && myObjectClass.equals(returnType)) { return new HashSet(); @@ -171,10 +204,11 @@ public class XSQLBluePrint implements DatabaseMetaData { public void addToBluePrintCache(XSQLBluePrintNode blNode) { this.tableNameToBluePrint.put(blNode.getBluePrintNodeName(), blNode); - Map map = this.odlNameToBluePrint.get(blNode.getODLTableName()); - if(map==null){ - map = new HashMap(); - this.odlNameToBluePrint.put(blNode.getODLTableName(),map); + Map map = this.odlNameToBluePrint.get(blNode + .getODLTableName()); + if (map == null) { + map = new HashMap(); + this.odlNameToBluePrint.put(blNode.getODLTableName(), map); } map.put(blNode.getBluePrintNodeName(), blNode); } @@ -265,15 +299,15 @@ public class XSQLBluePrint implements DatabaseMetaData { @Override public ResultSet getAttributes(String catalog, String schemaPattern, - String typeNamePattern, String attributeNamePattern) - throws SQLException { + String typeNamePattern, String attributeNamePattern) + throws SQLException { // TODO Auto-generated method stub return null; } @Override public ResultSet getBestRowIdentifier(String catalog, String schema, - String table, int scope, boolean nullable) throws SQLException { + String table, int scope, boolean nullable) throws SQLException { // TODO Auto-generated method stub return null; } @@ -304,15 +338,15 @@ public class XSQLBluePrint implements DatabaseMetaData { @Override public ResultSet getColumnPrivileges(String catalog, String schema, - String table, String columnNamePattern) throws SQLException { + String table, String columnNamePattern) throws SQLException { // TODO Auto-generated method stub return null; } @Override public ResultSet getColumns(String catalog, String schemaPattern, - String tableNamePattern, String columnNamePattern) - throws SQLException { + String tableNamePattern, String columnNamePattern) + throws SQLException { // TODO Auto-generated method stub return null; } @@ -325,8 +359,8 @@ public class XSQLBluePrint implements DatabaseMetaData { @Override public ResultSet getCrossReference(String parentCatalog, - String parentSchema, String parentTable, String foreignCatalog, - String foreignSchema, String foreignTable) throws SQLException { + String parentSchema, String parentTable, String foreignCatalog, + String foreignSchema, String foreignTable) throws SQLException { // TODO Auto-generated method stub return null; } @@ -344,7 +378,7 @@ public class XSQLBluePrint implements DatabaseMetaData { @Override public String getDatabaseProductName() throws SQLException { - return "VNE Query Language"; + return "OpenDayLight"; } @Override @@ -383,9 +417,8 @@ public class XSQLBluePrint implements DatabaseMetaData { } @Override - public ResultSet getExportedKeys(String catalog, String schema, - String table) - throws SQLException { + public ResultSet getExportedKeys(String catalog, String schema, String table) + throws SQLException { // TODO Auto-generated method stub return null; } @@ -398,15 +431,15 @@ public class XSQLBluePrint implements DatabaseMetaData { @Override public ResultSet getFunctionColumns(String catalog, String schemaPattern, - String functionNamePattern, String columnNamePattern) - throws SQLException { + String functionNamePattern, String columnNamePattern) + throws SQLException { // TODO Auto-generated method stub return null; } @Override public ResultSet getFunctions(String catalog, String schemaPattern, - String functionNamePattern) throws SQLException { + String functionNamePattern) throws SQLException { // TODO Auto-generated method stub return null; } @@ -418,16 +451,15 @@ public class XSQLBluePrint implements DatabaseMetaData { } @Override - public ResultSet getImportedKeys(String catalog, String schema, - String table) - throws SQLException { + public ResultSet getImportedKeys(String catalog, String schema, String table) + throws SQLException { // TODO Auto-generated method stub return null; } @Override public ResultSet getIndexInfo(String catalog, String schema, String table, - boolean unique, boolean approximate) throws SQLException { + boolean unique, boolean approximate) throws SQLException { // TODO Auto-generated method stub return null; } @@ -572,22 +604,22 @@ public class XSQLBluePrint implements DatabaseMetaData { @Override public ResultSet getPrimaryKeys(String catalog, String schema, String table) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return null; } @Override public ResultSet getProcedureColumns(String catalog, String schemaPattern, - String procedureNamePattern, String columnNamePattern) - throws SQLException { + String procedureNamePattern, String columnNamePattern) + throws SQLException { // TODO Auto-generated method stub return null; } @Override public ResultSet getProcedures(String catalog, String schemaPattern, - String procedureNamePattern) throws SQLException { + String procedureNamePattern) throws SQLException { // TODO Auto-generated method stub return null; } @@ -618,7 +650,7 @@ public class XSQLBluePrint implements DatabaseMetaData { @Override public ResultSet getSchemas(String catalog, String schemaPattern) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return null; } @@ -655,14 +687,14 @@ public class XSQLBluePrint implements DatabaseMetaData { @Override public ResultSet getSuperTables(String catalog, String schemaPattern, - String tableNamePattern) throws SQLException { + String tableNamePattern) throws SQLException { // TODO Auto-generated method stub return null; } @Override public ResultSet getSuperTypes(String catalog, String schemaPattern, - String typeNamePattern) throws SQLException { + String typeNamePattern) throws SQLException { // TODO Auto-generated method stub return null; } @@ -675,14 +707,14 @@ public class XSQLBluePrint implements DatabaseMetaData { @Override public ResultSet getTablePrivileges(String catalog, String schemaPattern, - String tableNamePattern) throws SQLException { + String tableNamePattern) throws SQLException { // TODO Auto-generated method stub return null; } @Override public ResultSet getTables(String catalog, String schemaPattern, - String tableNamePattern, String[] types) throws SQLException { + String tableNamePattern, String[] types) throws SQLException { return new TablesResultSet(this); } @@ -706,7 +738,7 @@ public class XSQLBluePrint implements DatabaseMetaData { @Override public ResultSet getUDTs(String catalog, String schemaPattern, - String typeNamePattern, int[] types) throws SQLException { + String typeNamePattern, int[] types) throws SQLException { // TODO Auto-generated method stub return null; } @@ -725,7 +757,7 @@ public class XSQLBluePrint implements DatabaseMetaData { @Override public ResultSet getVersionColumns(String catalog, String schema, - String table) throws SQLException { + String table) throws SQLException { // TODO Auto-generated method stub return null; } @@ -905,8 +937,7 @@ public class XSQLBluePrint implements DatabaseMetaData { } @Override - public boolean supportsCatalogsInPrivilegeDefinitions() - throws SQLException { + public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException { // TODO Auto-generated method stub return false; } @@ -937,7 +968,7 @@ public class XSQLBluePrint implements DatabaseMetaData { @Override public boolean supportsConvert(int fromType, int toType) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return false; } @@ -956,21 +987,20 @@ public class XSQLBluePrint implements DatabaseMetaData { @Override public boolean supportsDataDefinitionAndDataManipulationTransactions() - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return false; } @Override public boolean supportsDataManipulationTransactionsOnly() - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return false; } @Override - public boolean supportsDifferentTableCorrelationNames() - throws SQLException { + public boolean supportsDifferentTableCorrelationNames() throws SQLException { // TODO Auto-generated method stub return false; } @@ -1133,14 +1163,14 @@ public class XSQLBluePrint implements DatabaseMetaData { @Override public boolean supportsResultSetConcurrency(int type, int concurrency) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return false; } @Override public boolean supportsResultSetHoldability(int holdability) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return false; } @@ -1200,8 +1230,7 @@ public class XSQLBluePrint implements DatabaseMetaData { } @Override - public boolean supportsStoredFunctionsUsingCallSyntax() - throws SQLException { + public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException { // TODO Auto-generated method stub return false; } @@ -1244,7 +1273,7 @@ public class XSQLBluePrint implements DatabaseMetaData { @Override public boolean supportsTransactionIsolationLevel(int level) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return false; } @@ -1299,8 +1328,8 @@ public class XSQLBluePrint implements DatabaseMetaData { @Override public ResultSet getPseudoColumns(String catalog, String schemaPattern, - String tableNamePattern, String columnNamePattern) - throws SQLException { + String tableNamePattern, String columnNamePattern) + throws SQLException { // TODO Auto-generated method stub return null; } diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintNode.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintNode.java index fbd818e632..8d905f2081 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintNode.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintNode.java @@ -3,7 +3,9 @@ package org.opendaylight.controller.md.sal.dom.xsql; import java.io.Serializable; import java.sql.SQLException; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; +import java.util.Map; import java.util.Set; public class XSQLBluePrintNode implements Serializable { @@ -11,10 +13,8 @@ public class XSQLBluePrintNode implements Serializable { private static final long serialVersionUID = 1L; private Class myInterface = null; private String myInterfaceString = null; - private Set relations = - new HashSet(); - private Set inheritingNodes = - new HashSet(); + private Set relations = new HashSet(); + private Set inheritingNodes = new HashSet(); private Set children = new HashSet(); private XSQLBluePrintNode parent = null; @@ -22,11 +22,20 @@ public class XSQLBluePrintNode implements Serializable { private transient Set parentHierarchySet = null; private String myInterfaceName = null; private Set columns = new HashSet(); + private Map origNameToColumn = new HashMap(); private transient Object odlNode = null; private boolean module = false; private String bluePrintTableName = null; private String odlTableName = null; + private String origName = null; + + public XSQLBluePrintNode(String name, String _origName, int _level) { + this.level = _level; + this.odlTableName = name; + this.bluePrintTableName = name; + this.origName = _origName; + } public XSQLBluePrintNode(Class _myInterface, int _level) { this.myInterface = _myInterface; @@ -35,16 +44,21 @@ public class XSQLBluePrintNode implements Serializable { this.level = _level; } - public XSQLBluePrintNode(Object _odlNode, int _level,XSQLBluePrintNode _parent) { + public XSQLBluePrintNode(Object _odlNode, int _level, + XSQLBluePrintNode _parent) { this.odlNode = _odlNode; this.level = _level; this.module = XSQLODLUtils.isModule(_odlNode); this.parent = _parent; this.bluePrintTableName = XSQLODLUtils.getBluePrintName(_odlNode); + this.odlTableName = XSQLODLUtils.getODLNodeName(this.odlNode); + } + public String getOrigName() { + return this.origName; } - public String getBluePrintNodeName(){ + public String getBluePrintNodeName() { return this.bluePrintTableName; } @@ -82,10 +96,11 @@ public class XSQLBluePrintNode implements Serializable { } for (XSQLBluePrintRelation dtr : this.relations) { XSQLBluePrintNode parent = dtr.getParent(); - if (!parent.getInterface().equals(this.getInterface()) && !parent - .getInterface().isAssignableFrom(this.getInterface()) && - this.getInterface().isAssignableFrom(parent.getInterface()) - && parent.isModelChild(p)) { + if (!parent.getInterface().equals(this.getInterface()) + && !parent.getInterface().isAssignableFrom( + this.getInterface()) + && this.getInterface().isAssignableFrom( + parent.getInterface()) && parent.isModelChild(p)) { return true; } } @@ -109,8 +124,16 @@ public class XSQLBluePrintNode implements Serializable { } public void addColumn(Object node, String tableName) { - XSQLColumn c = new XSQLColumn(node,getBluePrintNodeName(), this); + XSQLColumn c = new XSQLColumn(node, getBluePrintNodeName(), this); + this.columns.add(c); + } + + public XSQLColumn addColumn(String name, String tableName, String origName, + String origTableName) { + XSQLColumn c = new XSQLColumn(name, tableName, origName, origTableName); this.columns.add(c); + this.origNameToColumn.put(origName, c); + return c; } public void addColumn(String methodName) { @@ -165,17 +188,16 @@ public class XSQLBluePrintNode implements Serializable { throw new SQLException("Unknown field name '" + name + "'"); } - public void addParent(XSQLBluePrintNode parent, String property) { try { if (property.equals("ContainingTPs")) { return; } - //Method m = parent.getInterface().getMethod("get"+property, null); - //if(!m.getDeclaringClass().equals(parent.getInterface())) - //return; - XSQLBluePrintRelation rel = - new XSQLBluePrintRelation(parent, property, myInterface); + // Method m = parent.getInterface().getMethod("get"+property, null); + // if(!m.getDeclaringClass().equals(parent.getInterface())) + // return; + XSQLBluePrintRelation rel = new XSQLBluePrintRelation(parent, + property, myInterface); relations.add(rel); } catch (Exception err) { err.printStackTrace(); @@ -187,8 +209,7 @@ public class XSQLBluePrintNode implements Serializable { } public Set getClonedParents() { - Set result = - new HashSet(); + Set result = new HashSet(); result.addAll(this.relations); return result; } @@ -200,6 +221,9 @@ public class XSQLBluePrintNode implements Serializable { if (odlNode != null) { return getBluePrintNodeName(); } + if (odlTableName != null) { + return odlTableName; + } return "Unknown"; } @@ -216,11 +240,12 @@ public class XSQLBluePrintNode implements Serializable { XSQLBluePrintNode other = (XSQLBluePrintNode) obj; if (odlNode != null) { return getBluePrintNodeName().equals(other.getBluePrintNodeName()); - } else if (this.odlTableName != null) { + } else if (this.odlTableName == null && other.odlTableName != null) + return false; + if (this.odlTableName != null && other.odlTableName == null) + return false; + else return this.odlTableName.equals(other.odlTableName); - } else { - return other.myInterface.equals(myInterface); - } } @Override diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLColumn.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLColumn.java index 55ac600f4a..4c6cca7fa6 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLColumn.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLColumn.java @@ -8,6 +8,8 @@ public class XSQLColumn implements Serializable, Comparable { private int charWidth = -1; private Class type = null; private transient Object bluePrintNode = null; + private String origName = null; + private String origTableName = null; public XSQLColumn(Object odlNode, String _tableName, Object _bluePrintNode) { this.name = XSQLODLUtils.getNodeNameFromDSN(odlNode); @@ -16,6 +18,13 @@ public class XSQLColumn implements Serializable, Comparable { this.type = XSQLODLUtils.getTypeForODLColumn(odlNode); } + public XSQLColumn(String _name, String _tableName,String _origName, String _origTableName){ + this.name = _name; + this.tableName = _tableName; + this.origName = _origName; + this.origTableName = _origTableName; + } + public String getName() { return name; } diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCCommand.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCCommand.java index 85ce0e5392..019711157c 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCCommand.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCCommand.java @@ -3,6 +3,8 @@ package org.opendaylight.controller.md.sal.dom.xsql.jdbc; import java.io.Serializable; import java.util.Map; +import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint; + public class JDBCCommand implements Serializable { public int type = 0; public static final int TYPE_EXECUTE_QUERY = 1; @@ -10,11 +12,22 @@ public class JDBCCommand implements Serializable { public static final int TYPE_QUERY_RECORD = 3; public static final int TYPE_QUERY_FINISH = 4; public static final int TYPE_QUERY_ERROR = 5; + public static final int TYPE_METADATA = 6; + public static final int TYPE_METADATA_REPLY = 7; private JDBCResultSet rs = null; private Map record = null; private int rsID = -1; private Exception err = null; + private XSQLBluePrint bluePrint = null; + + public JDBCCommand() { + + } + + public void setType(int t) { + this.type = t; + } public JDBCCommand(Exception _err, int _RSID) { this.type = TYPE_QUERY_ERROR; @@ -22,6 +35,11 @@ public class JDBCCommand implements Serializable { this.rsID = _RSID; } + public JDBCCommand(XSQLBluePrint bl) { + this.type = TYPE_METADATA_REPLY; + this.bluePrint = bl; + } + public JDBCCommand(JDBCResultSet _rs, int _type) { this.type = TYPE_EXECUTE_QUERY; this.rs = _rs; @@ -59,4 +77,8 @@ public class JDBCCommand implements Serializable { public Exception getERROR() { return this.err; } + + public XSQLBluePrint getBluePrint() { + return this.bluePrint; + } } diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCConnection.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCConnection.java index 3e72dc95ee..bf1244f2e3 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCConnection.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCConnection.java @@ -31,38 +31,59 @@ import java.util.Properties; import java.util.concurrent.Executor; import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter; +import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint; -public class JDBCConnection extends Thread implements Connection { +public class JDBCConnection implements Connection, Runnable { private Socket socket = null; private DataInputStream in = null; private DataOutputStream out = null; private LinkedList queue = new LinkedList(); private XSQLAdapter adapter = null; + private XSQLBluePrint metaData = null; + private String addr = null; + private boolean wasClosed = false; public JDBCConnection(Socket s, XSQLAdapter _a) { this.socket = s; this.adapter = _a; try { in = new DataInputStream( - new BufferedInputStream(s.getInputStream())); - out = new DataOutputStream( - new BufferedOutputStream(s.getOutputStream())); + new BufferedInputStream(s.getInputStream())); + out = new DataOutputStream(new BufferedOutputStream( + s.getOutputStream())); new JDBCObjectReader(); - this.start(); + new Thread(this).start(); } catch (Exception err) { err.printStackTrace(); } } - public JDBCConnection(String addr) throws Exception { + public Connection getProxy() { + return this; + /* + return (Connection) Proxy.newProxyInstance(this.getClass() + .getClassLoader(), new Class[] { Connection.class }, + new JDBCProxy(this)); + */ + } + + public JDBCConnection(String _addr) throws Exception { + this.addr = _addr; + init(); + } + + private void init() throws Exception { + if (addr.startsWith("http://")) + addr = addr.substring(7); + System.err.print("Address is:" + addr); socket = new Socket(addr, 40004); try { - in = new DataInputStream( - new BufferedInputStream(socket.getInputStream())); - out = new DataOutputStream( - new BufferedOutputStream(socket.getOutputStream())); + in = new DataInputStream(new BufferedInputStream( + socket.getInputStream())); + out = new DataOutputStream(new BufferedOutputStream( + socket.getOutputStream())); new JDBCObjectReader(); - this.start(); + new Thread(this).start(); } catch (Exception err) { err.printStackTrace(); } @@ -73,12 +94,12 @@ public class JDBCConnection extends Thread implements Connection { ServerSocket s = new ServerSocket(50003); socket = s.accept(); try { - in = new DataInputStream( - new BufferedInputStream(socket.getInputStream())); - out = new DataOutputStream( - new BufferedOutputStream(socket.getOutputStream())); + in = new DataInputStream(new BufferedInputStream( + socket.getInputStream())); + out = new DataOutputStream(new BufferedOutputStream( + socket.getOutputStream())); new JDBCObjectReader(); - this.start(); + new Thread(this).start(); } catch (Exception err) { err.printStackTrace(); } @@ -87,7 +108,6 @@ public class JDBCConnection extends Thread implements Connection { } } - private boolean isStopped() { if (adapter != null && adapter.stopped) { return true; @@ -109,11 +129,21 @@ public class JDBCConnection extends Thread implements Connection { } catch (Exception err) { System.out.println("Connection Lost or Closed."); + try { + out.close(); + } catch (Exception er) { + } + out = null; + try { + in.close(); + } catch (Exception er) { + } + in = null; try { socket.close(); } catch (Exception err2) { } - //err.printStackTrace(); + socket = null; } } } @@ -167,38 +197,46 @@ public class JDBCConnection extends Thread implements Connection { public void processCommand(JDBCCommand cmd) { switch (cmd.getType()) { - case JDBCCommand.TYPE_EXECUTE_QUERY: - try { - JDBCServer.execute(cmd.getRS(), adapter); - send(new JDBCCommand(cmd.getRS(), - JDBCCommand.TYPE_QUERY_REPLY)); - QueryUpdater u = new QueryUpdater(cmd.getRS()); - new Thread(u).start(); - } catch (Exception err) { - send(new JDBCCommand(err, cmd.getRSID())); - } - break; - case JDBCCommand.TYPE_QUERY_REPLY: - JDBCResultSet rs1 = JDBCStatement.getQuery(cmd.getRS().getID()); - rs1.updateData(cmd.getRS()); - break; - case JDBCCommand.TYPE_QUERY_RECORD: - JDBCResultSet rs2 = JDBCStatement.getQuery(cmd.getRSID()); - rs2.addRecord(cmd.getRecord()); - break; - case JDBCCommand.TYPE_QUERY_FINISH: - JDBCResultSet rs3 = JDBCStatement.removeQuery(cmd.getRSID()); - rs3.setFinished(true); - break; - case JDBCCommand.TYPE_QUERY_ERROR: - System.err.println("ERROR Executing Query\n"); - cmd.getERROR().printStackTrace(); - JDBCResultSet rs4 = JDBCStatement.removeQuery(cmd.getRSID()); - rs4.setError(cmd.getERROR()); - rs4.setFinished(true); - synchronized (rs4) { - rs4.notifyAll(); - } + case JDBCCommand.TYPE_METADATA_REPLY: + this.metaData = cmd.getBluePrint(); + synchronized (this) { + this.notifyAll(); + } + break; + case JDBCCommand.TYPE_METADATA: + send(new JDBCCommand(this.adapter.getBluePrint())); + break; + case JDBCCommand.TYPE_EXECUTE_QUERY: + try { + JDBCServer.execute(cmd.getRS(), adapter); + send(new JDBCCommand(cmd.getRS(), JDBCCommand.TYPE_QUERY_REPLY)); + QueryUpdater u = new QueryUpdater(cmd.getRS()); + new Thread(u).start(); + } catch (Exception err) { + send(new JDBCCommand(err, cmd.getRSID())); + } + break; + case JDBCCommand.TYPE_QUERY_REPLY: + JDBCResultSet rs1 = JDBCStatement.getQuery(cmd.getRS().getID()); + rs1.updateData(cmd.getRS()); + break; + case JDBCCommand.TYPE_QUERY_RECORD: + JDBCResultSet rs2 = JDBCStatement.getQuery(cmd.getRSID()); + rs2.addRecord(cmd.getRecord()); + break; + case JDBCCommand.TYPE_QUERY_FINISH: + JDBCResultSet rs3 = JDBCStatement.removeQuery(cmd.getRSID()); + rs3.setFinished(true); + break; + case JDBCCommand.TYPE_QUERY_ERROR: + System.err.println("ERROR Executing Query\n"); + cmd.getERROR().printStackTrace(); + JDBCResultSet rs4 = JDBCStatement.removeQuery(cmd.getRSID()); + rs4.setError(cmd.getERROR()); + rs4.setFinished(true); + synchronized (rs4) { + rs4.notifyAll(); + } } } @@ -221,6 +259,15 @@ public class JDBCConnection extends Thread implements Connection { } public void send(Object o) { + + if (this.socket == null) { + try { + init(); + } catch (Exception err) { + err.printStackTrace(); + } + } + try { ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oout = new ObjectOutputStream(bout); @@ -256,6 +303,7 @@ public class JDBCConnection extends Thread implements Connection { @Override public void close() throws SQLException { + wasClosed = true; try { socket.close(); } catch (Exception err) { @@ -271,7 +319,7 @@ public class JDBCConnection extends Thread implements Connection { @Override public Array createArrayOf(String typeName, Object[] elements) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return null; } @@ -302,28 +350,25 @@ public class JDBCConnection extends Thread implements Connection { @Override public Statement createStatement() throws SQLException { - return new JDBCStatement(this); + return new JDBCStatement(this).getProxy(); } @Override public Statement createStatement(int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - // TODO Auto-generated method stub - return null; + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + return new JDBCStatement(this).getProxy(); } @Override - public Statement createStatement(int resultSetType, - int resultSetConcurrency) - throws SQLException { - // TODO Auto-generated method stub - return null; + public Statement createStatement(int resultSetType, int resultSetConcurrency) + throws SQLException { + return new JDBCStatement(this).getProxy(); } @Override public Struct createStruct(String typeName, Object[] attributes) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return null; } @@ -360,8 +405,19 @@ public class JDBCConnection extends Thread implements Connection { @Override public DatabaseMetaData getMetaData() throws SQLException { - // TODO Auto-generated method stub - return null; + if (this.metaData == null) { + JDBCCommand cmd = new JDBCCommand(); + cmd.setType(JDBCCommand.TYPE_METADATA); + synchronized (this) { + send(cmd); + try { + this.wait(); + } catch (Exception err) { + err.printStackTrace(); + } + } + } + return metaData; } @Override @@ -384,7 +440,6 @@ public class JDBCConnection extends Thread implements Connection { @Override public boolean isClosed() throws SQLException { - // TODO Auto-generated method stub return false; } @@ -408,15 +463,15 @@ public class JDBCConnection extends Thread implements Connection { @Override public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { // TODO Auto-generated method stub return null; } @Override public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException { + int resultSetConcurrency) throws SQLException { // TODO Auto-generated method stub return null; } @@ -429,44 +484,44 @@ public class JDBCConnection extends Thread implements Connection { @Override public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - // TODO Auto-generated method stub - return null; + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + System.err.println("SQL 1=" + sql); + return new JDBCStatement(this, sql).getProxy(); } @Override public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException { - // TODO Auto-generated method stub - return null; + int resultSetConcurrency) throws SQLException { + System.err.println("SQL 2=" + sql); + return new JDBCStatement(this, sql).getProxy(); } @Override public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) - throws SQLException { - // TODO Auto-generated method stub - return null; + throws SQLException { + System.err.println("SQL 3=" + sql); + return new JDBCStatement(this, sql).getProxy(); } @Override public PreparedStatement prepareStatement(String sql, int[] columnIndexes) - throws SQLException { - // TODO Auto-generated method stub - return null; + throws SQLException { + System.err.println("SQL 4=" + sql); + return new JDBCStatement(this, sql).getProxy(); } @Override public PreparedStatement prepareStatement(String sql, String[] columnNames) - throws SQLException { - // TODO Auto-generated method stub - return null; + throws SQLException { + System.err.println("SQL 5=" + sql); + return new JDBCStatement(this, sql).getProxy(); } @Override public PreparedStatement prepareStatement(String sql) throws SQLException { - // TODO Auto-generated method stub - return null; + System.err.println("SQL 6=" + sql); + return new JDBCStatement(this, sql).getProxy(); } @Override @@ -501,14 +556,14 @@ public class JDBCConnection extends Thread implements Connection { @Override public void setClientInfo(Properties properties) - throws SQLClientInfoException { + throws SQLClientInfoException { // TODO Auto-generated method stub } @Override public void setClientInfo(String name, String value) - throws SQLClientInfoException { + throws SQLClientInfoException { // TODO Auto-generated method stub } @@ -569,7 +624,7 @@ public class JDBCConnection extends Thread implements Connection { @Override public void setNetworkTimeout(Executor executor, int milliseconds) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @@ -579,5 +634,5 @@ public class JDBCConnection extends Thread implements Connection { // TODO Auto-generated method stub return 0; } -} +} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCProxy.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCProxy.java new file mode 100644 index 0000000000..7e29947a01 --- /dev/null +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCProxy.java @@ -0,0 +1,24 @@ +package org.opendaylight.controller.md.sal.dom.xsql.jdbc; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; + +public class JDBCProxy implements InvocationHandler { + + private Object myObject = null; + private Class myObjectClass = null; + + public JDBCProxy(Object obj) { + this.myObject = obj; + this.myObjectClass = this.myObject.getClass(); + } + + @Override + public Object invoke(Object proxy, Method method, Object[] args) + throws Throwable { + System.err.println("Class " + this.myObjectClass.getSimpleName() + + " Method " + method.getName()); + return method.invoke(this.myObject, args); + } + +} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java index 7603a3e9ae..021f6ee19b 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java @@ -4,6 +4,7 @@ import java.io.InputStream; import java.io.Reader; import java.io.Serializable; import java.lang.reflect.Method; +import java.lang.reflect.Proxy; import java.math.BigDecimal; import java.net.URL; import java.sql.Array; @@ -37,15 +38,13 @@ import org.opendaylight.controller.md.sal.dom.xsql.XSQLColumn; import org.opendaylight.controller.md.sal.dom.xsql.XSQLCriteria; import org.opendaylight.controller.md.sal.dom.xsql.XSQLODLUtils; -public class JDBCResultSet - implements Serializable, ResultSet, ResultSetMetaData { +public class JDBCResultSet implements Serializable, ResultSet, + ResultSetMetaData { private static final long serialVersionUID = -7450200738431047057L; private String sql = null; - private List tablesInQuery = - new ArrayList(); - private Map tablesInQueryMap = - new ConcurrentHashMap(); + private List tablesInQuery = new ArrayList(); + private Map tablesInQueryMap = new ConcurrentHashMap(); private List fieldsInQuery = new ArrayList(); private transient LinkedList records = new LinkedList(); private transient Map currentRecord = null; @@ -53,10 +52,32 @@ public class JDBCResultSet private int id = 0; private static Integer nextID = new Integer(0); public int numberOfTasks = 0; - private Map>> criteria = - new ConcurrentHashMap>>(); + private Map>> criteria = new ConcurrentHashMap>>(); private Exception err = null; private List EMPTY_RESULT = new LinkedList(); + private transient Map subQueries = new HashMap(); + + public ResultSet getProxy() { + return (ResultSet) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {ResultSet.class }, new JDBCProxy(this)); + } + + public void setSQL(String _sql) { + this.sql = _sql; + } + + public JDBCResultSet addSubQuery(String _sql,String logicalName) { + if(subQueries == null) + subQueries = new HashMap(); + JDBCResultSet rs = new JDBCResultSet(_sql); + this.subQueries.put(logicalName,rs); + return rs; + } + + public Map getSubQueries() { + if(this.subQueries==null) + this.subQueries = new HashMap<>(); + return this.subQueries; + } public JDBCResultSet(String _sql) { synchronized (JDBCResultSet.class) { @@ -88,12 +109,13 @@ public class JDBCResultSet } public int isObjectFitCriteria(Map objValues, String tableName) { - Map> tblCriteria = criteria.get(tableName); + Map> tblCriteria = criteria + .get(tableName); if (tblCriteria == null) { return 1; } for (Map.Entry> cc : tblCriteria - .entrySet()) { + .entrySet()) { for (XSQLCriteria c : cc.getValue()) { Object value = objValues.get(cc.getKey().toString()); int result = c.checkValue(value); @@ -106,16 +128,16 @@ public class JDBCResultSet } public int isObjectFitCriteria(Object element, Class cls) { - Map> tblCriteria = - criteria.get(cls.getName()); + Map> tblCriteria = criteria.get(cls + .getName()); if (tblCriteria == null) { return 1; } for (Map.Entry> cc : tblCriteria - .entrySet()) { + .entrySet()) { for (XSQLCriteria c : cc.getValue()) { - int result = - c.isObjectFitCriteria(element, cc.getKey().getName()); + int result = c.isObjectFitCriteria(element, cc.getKey() + .getName()); if (result == 0) { return 0; } @@ -185,16 +207,15 @@ public class JDBCResultSet } } - public void addRecord(ArrayList hierarchy) { Map rec = new HashMap(); for (int i = hierarchy.size() - 1; i >= 0; i--) { Object element = hierarchy.get(i); for (XSQLColumn c : fieldsInQuery) { - if (c.getTableName() - .equals(element.getClass().getSimpleName())) { + if (c.getTableName().equals(element.getClass().getSimpleName())) { try { - Method m = element.getClass().getMethod(c.getName(), null); + Method m = element.getClass().getMethod(c.getName(), + null); Object value = m.invoke(element, null); rec.put(c.getName(), value); } catch (Exception err) { @@ -276,18 +297,16 @@ public class JDBCResultSet Map subChildren = XSQLODLUtils.getChildren(node); Map result = new HashMap(); for (Object stc : subChildren.values()) { - if (stc.getClass().getName() - .endsWith("ImmutableAugmentationNode")) { + if (stc.getClass().getName().endsWith("ImmutableAugmentationNode")) { Map values = XSQLODLUtils.getChildren(stc); for (Object key : values.keySet()) { Object val = values.get(key); - if (val.getClass().getName() - .endsWith("ImmutableLeafNode")) { + if (val.getClass().getName().endsWith("ImmutableLeafNode")) { Object value = XSQLODLUtils.getValue(val); String k = XSQLODLUtils.getNodeName(val); if (value != null) { result.put(bpn.getBluePrintNodeName() + "." + k, - value.toString()); + value.toString()); } } } @@ -295,20 +314,27 @@ public class JDBCResultSet String k = XSQLODLUtils.getNodeName(stc); Object value = XSQLODLUtils.getValue(stc); if (value != null) { - result.put(bpn.getBluePrintNodeName() + "." + k, value.toString()); + result.put(bpn.getBluePrintNodeName() + "." + k, + value.toString()); } } } return result; } - private void addToData(Record rec, XSQLBluePrintNode bpn, XSQLBluePrint bluePrint, Map fullRecord) { - XSQLBluePrintNode eNodes[] = bluePrint.getBluePrintNodeByODLTableName(XSQLODLUtils.getNodeIdentiofier(rec.element)); + private void addToData(Record rec, XSQLBluePrintNode bpn, + XSQLBluePrint bluePrint, Map fullRecord) { + XSQLBluePrintNode eNodes[] = bluePrint + .getBluePrintNodeByODLTableName(XSQLODLUtils + .getNodeIdentiofier(rec.element)); if (bpn != null) { for (XSQLColumn c : fieldsInQuery) { - for(XSQLBluePrintNode eNode:eNodes){ - if (((XSQLBluePrintNode) c.getBluePrintNode()).getBluePrintNodeName().equals(eNode.getBluePrintNodeName())) { - //Object value = Criteria.getValue(rec.element, c.getName()); + for (XSQLBluePrintNode eNode : eNodes) { + if (((XSQLBluePrintNode) c.getBluePrintNode()) + .getBluePrintNodeName().equals( + eNode.getBluePrintNodeName())) { + // Object value = Criteria.getValue(rec.element, + // c.getName()); String columnName = c.toString(); Object value = fullRecord.get(columnName); if (value != null) { @@ -346,7 +372,8 @@ public class JDBCResultSet return false; } - public List getChildren(Object node, String tableName,XSQLBluePrint bluePrint) { + public List getChildren(Object node, String tableName, + XSQLBluePrint bluePrint) { List children = XSQLODLUtils.getMChildren(node); List result = new LinkedList(); @@ -354,28 +381,33 @@ public class JDBCResultSet for (Object child : children) { String odlNodeName = XSQLODLUtils.getNodeIdentiofier(child); - if(odlNodeName==null) continue; + if (odlNodeName == null) + continue; - XSQLBluePrintNode eNodes[] = bluePrint.getBluePrintNodeByODLTableName(odlNodeName); - if(eNodes==null) continue; + XSQLBluePrintNode eNodes[] = bluePrint + .getBluePrintNodeByODLTableName(odlNodeName); + if (eNodes == null) + continue; boolean match = false; - for(XSQLBluePrintNode enode:eNodes){ - if(tableName.startsWith(enode.toString())){ + for (XSQLBluePrintNode enode : eNodes) { + if (tableName.startsWith(enode.toString())) { match = true; break; } } - if(!match) continue; + if (!match) + continue; if (child.getClass().getName().endsWith("ImmutableContainerNode")) { result.add(child); - }else - if (child.getClass().getName().endsWith("ImmutableAugmentationNode")) { + } else if (child.getClass().getName() + .endsWith("ImmutableAugmentationNode")) { List _children = XSQLODLUtils.getMChildren(child); for (Object c : _children) { - if (c.getClass().getName().endsWith("ImmutableContainerNode")) { + if (c.getClass().getName() + .endsWith("ImmutableContainerNode")) { result.add(c); } } @@ -386,21 +418,26 @@ public class JDBCResultSet return result; } - public List addRecords(Object element, XSQLBluePrintNode node,boolean root, String tableName,XSQLBluePrint bluePrint) { + public List addRecords(Object element, XSQLBluePrintNode node, + boolean root, String tableName, XSQLBluePrint bluePrint) { List result = new LinkedList(); String nodeID = XSQLODLUtils.getNodeIdentiofier(element); if (node.getODLTableName().equals(nodeID)) { - XSQLBluePrintNode bluePrintNode = bluePrint.getBluePrintNodeByODLTableName(nodeID)[0]; + XSQLBluePrintNode bluePrintNode = bluePrint + .getBluePrintNodeByODLTableName(nodeID)[0]; Record rec = new Record(); rec.element = element; - XSQLBluePrintNode bpn = this.tablesInQueryMap.get(bluePrintNode.getBluePrintNodeName()); - if (this.criteria.containsKey(bluePrintNode.getBluePrintNodeName()) || bpn != null) { + XSQLBluePrintNode bpn = this.tablesInQueryMap.get(bluePrintNode + .getBluePrintNodeName()); + if (this.criteria.containsKey(bluePrintNode.getBluePrintNodeName()) + || bpn != null) { Map allKeyValues = collectColumnValues(element, bpn); - if (!(isObjectFitCriteria(allKeyValues, bpn.getBluePrintNodeName()) == 1)) { + if (!(isObjectFitCriteria(allKeyValues, + bpn.getBluePrintNodeName()) == 1)) { return EMPTY_RESULT; } - addToData(rec, bpn, bluePrint,allKeyValues); + addToData(rec, bpn, bluePrint, allKeyValues); } if (root) { addRecord(rec.data); @@ -411,9 +448,11 @@ public class JDBCResultSet } XSQLBluePrintNode parent = node.getParent(); - List subRecords = addRecords(element, parent, false, tableName,bluePrint); + List subRecords = addRecords(element, parent, false, tableName, + bluePrint); for (Record subRec : subRecords) { - List subO = getChildren(subRec.element, tableName,bluePrint); + List subO = getChildren(subRec.element, tableName, + bluePrint); if (subO != null) { for (Object subData : subO) { Record rec = new Record(); @@ -421,18 +460,21 @@ public class JDBCResultSet rec.data.putAll(subRec.data); String recID = XSQLODLUtils.getNodeIdentiofier(rec.element); - XSQLBluePrintNode eNodes[] = bluePrint.getBluePrintNodeByODLTableName(recID); + XSQLBluePrintNode eNodes[] = bluePrint + .getBluePrintNodeByODLTableName(recID); XSQLBluePrintNode bpn = null; - for(XSQLBluePrintNode eNode:eNodes){ - bpn = this.tablesInQueryMap.get(eNode.getBluePrintNodeName()); - if(bpn!=null) + for (XSQLBluePrintNode eNode : eNodes) { + bpn = this.tablesInQueryMap.get(eNode + .getBluePrintNodeName()); + if (bpn != null) break; } boolean isObjectInCriteria = true; if (bpn != null) { Map allKeyValues = collectColumnValues(rec.element, bpn); - if ((isObjectFitCriteria(allKeyValues, bpn.getBluePrintNodeName()) == 1)) { - addToData(rec, bpn,bluePrint,allKeyValues); + if ((isObjectFitCriteria(allKeyValues, + bpn.getBluePrintNodeName()) == 1)) { + addToData(rec, bpn, bluePrint, allKeyValues); } else { isObjectInCriteria = false; } @@ -440,7 +482,7 @@ public class JDBCResultSet if (isObjectInCriteria) { if (root) { - if(!rec.data.isEmpty()) + if (!rec.data.isEmpty()) addRecord(rec.data); } else { result.add(rec); @@ -545,7 +587,7 @@ public class JDBCResultSet @Override public BigDecimal getBigDecimal(int columnIndex, int scale) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return null; } @@ -558,7 +600,7 @@ public class JDBCResultSet @Override public BigDecimal getBigDecimal(String columnLabel, int scale) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return null; } @@ -798,22 +840,20 @@ public class JDBCResultSet @Override public Object getObject(int columnIndex, Map> map) - throws SQLException { - // TODO Auto-generated method stub - return null; + throws SQLException { + return getObject(columnIndex); } @Override public Object getObject(int columnIndex) throws SQLException { - return currentRecord - .get(this.fieldsInQuery.get(columnIndex - 1).toString()); + return currentRecord.get(this.fieldsInQuery.get(columnIndex - 1) + .toString()); } @Override public Object getObject(String columnLabel, Map> map) - throws SQLException { - // TODO Auto-generated method stub - return null; + throws SQLException { + return getObject(columnLabel); } @Override @@ -883,14 +923,12 @@ public class JDBCResultSet @Override public String getString(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; + return "Kuku"; } @Override public String getString(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; + return "Kuku"; } @Override @@ -919,7 +957,7 @@ public class JDBCResultSet @Override public Timestamp getTimestamp(int columnIndex, Calendar cal) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return null; } @@ -932,7 +970,7 @@ public class JDBCResultSet @Override public Timestamp getTimestamp(String columnLabel, Calendar cal) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return null; } @@ -945,8 +983,7 @@ public class JDBCResultSet @Override public int getType() throws SQLException { - // TODO Auto-generated method stub - return 0; + return ResultSet.TYPE_FORWARD_ONLY; } @Override @@ -968,8 +1005,7 @@ public class JDBCResultSet } @Override - public InputStream getUnicodeStream(String columnLabel) - throws SQLException { + public InputStream getUnicodeStream(String columnLabel) throws SQLException { // TODO Auto-generated method stub return null; } @@ -1096,100 +1132,98 @@ public class JDBCResultSet @Override public void updateAsciiStream(int columnIndex, InputStream x, int length) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateAsciiStream(int columnIndex, InputStream x, long length) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateAsciiStream(int columnIndex, InputStream x) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateAsciiStream(String columnLabel, InputStream x, int length) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override - public void updateAsciiStream(String columnLabel, InputStream x, - long length) - throws SQLException { + public void updateAsciiStream(String columnLabel, InputStream x, long length) + throws SQLException { // TODO Auto-generated method stub } @Override public void updateAsciiStream(String columnLabel, InputStream x) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateBigDecimal(int columnIndex, BigDecimal x) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateBigDecimal(String columnLabel, BigDecimal x) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateBinaryStream(int columnIndex, InputStream x, int length) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateBinaryStream(int columnIndex, InputStream x, long length) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateBinaryStream(int columnIndex, InputStream x) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override - public void updateBinaryStream(String columnLabel, InputStream x, - int length) - throws SQLException { + public void updateBinaryStream(String columnLabel, InputStream x, int length) + throws SQLException { // TODO Auto-generated method stub } @Override public void updateBinaryStream(String columnLabel, InputStream x, - long length) throws SQLException { + long length) throws SQLException { // TODO Auto-generated method stub } @Override public void updateBinaryStream(String columnLabel, InputStream x) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @@ -1201,16 +1235,15 @@ public class JDBCResultSet } @Override - public void updateBlob(int columnIndex, InputStream inputStream, - long length) - throws SQLException { + public void updateBlob(int columnIndex, InputStream inputStream, long length) + throws SQLException { // TODO Auto-generated method stub } @Override public void updateBlob(int columnIndex, InputStream inputStream) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @@ -1223,14 +1256,14 @@ public class JDBCResultSet @Override public void updateBlob(String columnLabel, InputStream inputStream, - long length) throws SQLException { + long length) throws SQLException { // TODO Auto-generated method stub } @Override public void updateBlob(String columnLabel, InputStream inputStream) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @@ -1243,7 +1276,7 @@ public class JDBCResultSet @Override public void updateBoolean(String columnLabel, boolean x) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @@ -1274,42 +1307,42 @@ public class JDBCResultSet @Override public void updateCharacterStream(int columnIndex, Reader x, int length) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateCharacterStream(int columnIndex, Reader x, long length) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateCharacterStream(int columnIndex, Reader x) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateCharacterStream(String columnLabel, Reader reader, - int length) throws SQLException { + int length) throws SQLException { // TODO Auto-generated method stub } @Override public void updateCharacterStream(String columnLabel, Reader reader, - long length) throws SQLException { + long length) throws SQLException { // TODO Auto-generated method stub } @Override public void updateCharacterStream(String columnLabel, Reader reader) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @@ -1322,7 +1355,7 @@ public class JDBCResultSet @Override public void updateClob(int columnIndex, Reader reader, long length) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @@ -1341,14 +1374,14 @@ public class JDBCResultSet @Override public void updateClob(String columnLabel, Reader reader, long length) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateClob(String columnLabel, Reader reader) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @@ -1415,28 +1448,28 @@ public class JDBCResultSet @Override public void updateNCharacterStream(int columnIndex, Reader x, long length) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateNCharacterStream(int columnIndex, Reader x) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateNCharacterStream(String columnLabel, Reader reader, - long length) throws SQLException { + long length) throws SQLException { // TODO Auto-generated method stub } @Override public void updateNCharacterStream(String columnLabel, Reader reader) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @@ -1449,49 +1482,48 @@ public class JDBCResultSet @Override public void updateNClob(int columnIndex, Reader reader, long length) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override - public void updateNClob(int columnIndex, Reader reader) - throws SQLException { + public void updateNClob(int columnIndex, Reader reader) throws SQLException { // TODO Auto-generated method stub } @Override public void updateNClob(String columnLabel, NClob nClob) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateNClob(String columnLabel, Reader reader, long length) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateNClob(String columnLabel, Reader reader) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateNString(int columnIndex, String nString) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateNString(String columnLabel, String nString) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @@ -1510,7 +1542,7 @@ public class JDBCResultSet @Override public void updateObject(int columnIndex, Object x, int scaleOrLength) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @@ -1523,7 +1555,7 @@ public class JDBCResultSet @Override public void updateObject(String columnLabel, Object x, int scaleOrLength) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @@ -1566,14 +1598,14 @@ public class JDBCResultSet @Override public void updateSQLXML(int columnIndex, SQLXML xmlObject) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateSQLXML(String columnLabel, SQLXML xmlObject) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @@ -1616,14 +1648,14 @@ public class JDBCResultSet @Override public void updateTimestamp(int columnIndex, Timestamp x) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @Override public void updateTimestamp(String columnLabel, Timestamp x) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub } @@ -1670,8 +1702,7 @@ public class JDBCResultSet @Override public int getColumnType(int column) throws SQLException { - // TODO Auto-generated method stub - return 0; + return 12; } @Override @@ -1766,15 +1797,11 @@ public class JDBCResultSet @Override public T getObject(String columnLabel, Class type) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return null; } - - - ////Metadata - - + // //Metadata } diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCServer.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCServer.java index 26b8c70b8b..5be701f82e 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCServer.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCServer.java @@ -1,20 +1,22 @@ package org.opendaylight.controller.md.sal.dom.xsql.jdbc; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrintNode; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLColumn; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLCriteria; - import java.net.ServerSocket; import java.net.Socket; import java.sql.SQLException; import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import java.util.concurrent.ConcurrentHashMap; +import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter; +import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint; +import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrintNode; +import org.opendaylight.controller.md.sal.dom.xsql.XSQLColumn; +import org.opendaylight.controller.md.sal.dom.xsql.XSQLCriteria; + public class JDBCServer extends Thread { private ServerSocket socket = null; private XSQLAdapter adapter = null; @@ -47,19 +49,179 @@ public class JDBCServer extends Thread { } public static void execute(JDBCResultSet rs, XSQLAdapter adapter) - throws SQLException { - parseTables(rs, adapter.getBluePrint()); - parseFields(rs, adapter.getBluePrint()); - parseCriteria(rs, adapter.getBluePrint()); + throws SQLException { + if(rs.getSQL().toLowerCase().trim().equals("select 1")){ + rs.setFinished(true); + return; + } + checkAndBreakSubQueries(rs, adapter); + if (rs.getSubQueries().size() == 0) { + parseTables(rs, adapter.getBluePrint()); + parseFields(rs, adapter.getBluePrint()); + parseCriteria(rs, adapter.getBluePrint()); + try { + adapter.execute(rs); + } catch (Exception err) { + throw new SQLException("Error", err); + } + } else { + parseExternalQuery(rs); + } + } + + public static void parseExternalQuery(JDBCResultSet rs) throws SQLException { + String sql = rs.getSQL(); + for (Map.Entry entry : rs.getSubQueries() + .entrySet()) { + int index = sql.toLowerCase().indexOf(entry.getValue().getSQL()); + String extSql = sql.substring(0, index); + index = extSql.lastIndexOf("("); + extSql = extSql.substring(0, index); + System.out.println("External SQL=" + extSql); + parseLogicalFields(extSql, rs); + } + } + + public static void parseLogicalFields(String sql, JDBCResultSet rs) + throws SQLException { + if(sql.trim().toLowerCase().equals("select * from")){ + for (Map.Entry entry : rs.getSubQueries().entrySet()) { + for(XSQLBluePrintNode node:entry.getValue().getTables()){ + rs.addTableToQuery(node); + } + rs.getFields().addAll(entry.getValue().getFields()); + while (entry.getValue().next()) { + Map rec = entry.getValue().getCurrent(); + Map newRec = new HashMap(); + newRec.putAll(rec); + rs.addRecord(newRec); + } + } + rs.setFinished(true); + return; + } + + Map logicalNameToNode = new HashMap(); + Map origNameToName = new HashMap(); + List columnOrder = new ArrayList<>(); + int nextLogField = addNextLogicalField(sql, 0, + logicalNameToNode, origNameToName,columnOrder); + int next = sql.toLowerCase().indexOf(" as ", nextLogField); + while (next != -1) { + nextLogField = addNextLogicalField(sql, nextLogField + 1, + logicalNameToNode, origNameToName,columnOrder); + next = sql.toLowerCase().indexOf(" as ", nextLogField + 1); + } + + for (XSQLBluePrintNode node : logicalNameToNode.values()) { + rs.addTableToQuery(node); + } + rs.getFields().addAll(columnOrder); + for (Map.Entry entry : rs.getSubQueries().entrySet()) { + while (entry.getValue().next()) { + Map rec = entry.getValue().getCurrent(); + Map newRec = new HashMap(); + for (Iterator iter = rec.entrySet().iterator(); iter.hasNext();) { + Map.Entry e = (Map.Entry) iter.next(); + String key = (String) e.getKey(); + Object value = e.getValue(); + String logicalKey = origNameToName.get(key); + if (value != null && logicalKey != null) { + newRec.put(logicalKey, value); + } + } + rs.addRecord(newRec); + } + } + rs.setFinished(true); + } + + public static void main(String args[]) { + String sql = "SELECT DISTINCT" + + "\"LOGICAL_TABLE_1\".\"nodes/node.id\" AS \"COL0\"\n" + + ",\"LOGICAL_TABLE_1\".\"nodes/node.id\" AS \"COL1\"\n" + + ",\"LOGICAL_TABLE_1\".\"nodes/node.id\" AS \"COL2\"\n" + + "FROM\n" + + "(select * from nodes/node;) \"LOGICAL_TABLE_1\"\n"; + JDBCResultSet rs = new JDBCResultSet(sql); try { - adapter.execute(rs); + parseLogicalFields(sql, rs); } catch (Exception err) { - throw new SQLException("Error", err); + err.printStackTrace(); + } + } + + public static int addNextLogicalField(String sql, int startIndex, + Map logicalNameToNode, + Map origNameToName, List columnOrder) { + int index1 = sql.indexOf("\"", startIndex); + int index2 = sql.indexOf("\".\"", index1); + int index3 = sql.indexOf("\"", index2 + 3); + int index4 = sql.toLowerCase().indexOf(" as ", startIndex); + int index5 = sql.indexOf("\"", index4); + int index6 = sql.indexOf("\"", index5 + 1); + + String tblName = sql.substring(index1 + 1, index2); + String origFieldNameFull = sql.substring(index2 + 3, index3); + String origTableName = ""; + String origFieldName = ""; + if (origFieldNameFull.indexOf(".") != -1) { + origTableName = origFieldNameFull.substring(0,origFieldNameFull.indexOf(".")); + origFieldName = origFieldNameFull.substring(origFieldNameFull.indexOf(".") + 1); + } + String logicalFieldName = sql.substring(index5 + 1, index6); + XSQLBluePrintNode node = logicalNameToNode.get(tblName); + if (node == null) { + node = new XSQLBluePrintNode(tblName, origTableName, 0); + logicalNameToNode.put(tblName, node); + } + columnOrder.add(node.addColumn(logicalFieldName, tblName, origFieldName, origTableName)); + origNameToName.put(origFieldNameFull, tblName + "." + logicalFieldName); + return index6; + } + + public static void checkAndBreakSubQueries(JDBCResultSet rs,XSQLAdapter adapter) throws SQLException { + String sql = rs.getSQL().toLowerCase(); + int index = sql.indexOf("select"); + if (index == -1) + throw new SQLException("Select statement is missing..."); + int index2 = sql.indexOf("select", index + 6); + if (index2 != -1) { + int startSubQuery = index2; + for (int i = startSubQuery; i >= 0; i--) { + if (sql.charAt(i) == '(') { + startSubQuery = i; + break; + } + } + int braketCount = 0; + int endSubQuery = startSubQuery; + do { + if (sql.charAt(endSubQuery) == '(') + braketCount++; + else if (sql.charAt(endSubQuery) == ')') + braketCount--; + endSubQuery++; + } while (braketCount > 0 || endSubQuery == sql.length()); + String subQuerySQL = sql.substring(startSubQuery + 1,endSubQuery - 1); + if(rs.getSQL().toLowerCase().substring(0,startSubQuery).trim().equals("select * from")){ + rs.setSQL(subQuerySQL); + return; + } + index = sql.indexOf("\"", endSubQuery); + index2 = sql.indexOf("\"", index + 1); + if(index==-1){ + index = endSubQuery; + index2 = sql.length(); + } + String logicalName = rs.getSQL().substring(index + 1, index2).trim(); + JDBCResultSet subRS = rs.addSubQuery(subQuerySQL, logicalName); + JDBCServer.execute(subRS, adapter); } } public static void parseTables(JDBCResultSet rs, XSQLBluePrint bp) - throws SQLException { + throws SQLException { String lowSQL = rs.getSQL().toLowerCase(); int from = lowSQL.indexOf("from"); int where = lowSQL.indexOf("where"); @@ -90,20 +252,19 @@ public class JDBCServer extends Thread { String tableName = tokens.nextToken().trim(); XSQLBluePrintNode table = bp.getBluePrintNodeByTableName(tableName); if (table == null) { - throw new SQLException( - "Unknown table name \"" + tableName + "\""); + throw new SQLException("Unknown table name \"" + tableName + + "\""); } rs.addTableToQuery(table); } } public static void addCriteria(XSQLColumn col, XSQLCriteria c, - JDBCResultSet rs) { - Map> tblCriteria = - rs.getCriteria().get(col.getTableName()); + JDBCResultSet rs) { + Map> tblCriteria = rs.getCriteria().get( + col.getTableName()); if (tblCriteria == null) { - tblCriteria = - new ConcurrentHashMap>(); + tblCriteria = new ConcurrentHashMap>(); rs.getCriteria().put(col.getTableName(), tblCriteria); } List lstCriteria = tblCriteria.get(col); @@ -115,7 +276,7 @@ public class JDBCServer extends Thread { } public static void parseFields(JDBCResultSet rs, XSQLBluePrint bp) - throws SQLException { + throws SQLException { String lowSQL = rs.getSQL().toLowerCase(); if (!lowSQL.startsWith("select")) { throw new SQLException("Missing 'select' statement."); @@ -135,8 +296,8 @@ public class JDBCServer extends Thread { return; } if (token.indexOf(".") != -1) { - XSQLBluePrintNode tbl = bp.getBluePrintNodeByTableName( - token.substring(0, token.indexOf(".")).trim()); + XSQLBluePrintNode tbl = bp.getBluePrintNodeByTableName(token + .substring(0, token.indexOf(".")).trim()); String p = token.substring(token.indexOf(".") + 1); if (p.equals("*")) { for (XSQLColumn c : tbl.getColumns()) { @@ -158,8 +319,8 @@ public class JDBCServer extends Thread { } } if (col == null) { - throw new SQLException( - "Unknown field name '" + token + "'."); + throw new SQLException("Unknown field name '" + token + + "'."); } rs.getFields().add(col); @@ -171,28 +332,21 @@ public class JDBCServer extends Thread { String lowSQL = rs.getSQL().toLowerCase(); int where = lowSQL.indexOf("where"); int order = lowSQL.indexOf("order"); - int subQuery = lowSQL.indexOf("select", 2); int whereTo = lowSQL.indexOf(";"); if (where == -1) { return; } - if (where != -1 && subQuery != -1 && subQuery < where) { - return; - } - - if (order != -1 && subQuery != -1 && order < subQuery) { - whereTo = order; - } else if (order != -1 && subQuery != -1 && order > subQuery) { - whereTo = subQuery; - } else if (order != -1) { + if (order != -1) { whereTo = order; - } else if (subQuery != -1) { - whereTo = subQuery; } - String whereStatement = - rs.getSQL().substring(where + 5, whereTo).trim(); + + if(whereTo==-1) + whereTo=lowSQL.length(); + + String whereStatement = rs.getSQL().substring(where + 5, whereTo) + .trim(); XSQLCriteria cr = new XSQLCriteria(whereStatement, -1); for (XSQLBluePrintNode tbl : rs.getTables()) { for (XSQLColumn col : tbl.getColumns()) { diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCStatement.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCStatement.java index a9ce1dd9bf..b71b015351 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCStatement.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCStatement.java @@ -1,28 +1,63 @@ package org.opendaylight.controller.md.sal.dom.xsql.jdbc; +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; import java.sql.Connection; +import java.sql.Date; +import java.sql.NClob; +import java.sql.ParameterMetaData; +import java.sql.PreparedStatement; +import java.sql.Ref; import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.RowId; import java.sql.SQLException; import java.sql.SQLWarning; -import java.sql.Statement; +import java.sql.SQLXML; +import java.sql.Time; +import java.sql.Timestamp; import java.util.ArrayList; +import java.util.Calendar; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -public class JDBCStatement implements Statement { +public class JDBCStatement implements PreparedStatement { private JDBCResultSet rs = null; private transient JDBCConnection connection = null; - private static Map queries = - new ConcurrentHashMap(); + private static Map queries = new ConcurrentHashMap(); + private String sql = null; + + public JDBCStatement(JDBCConnection con,String _sql) { + this.connection = con; + this.sql = _sql; + } public JDBCStatement(JDBCConnection con) { this.connection = con; } + public void setSQL(String _sql){ + this.sql = _sql; + } + public JDBCStatement() { } + public PreparedStatement getProxy() { + return this; + /* + return (PreparedStatement) Proxy.newProxyInstance(this.getClass() + .getClassLoader(), new Class[] { PreparedStatement.class }, + new JDBCProxy(this)); + */ + } + public static JDBCResultSet getQuery(int id) { return queries.get(id); } @@ -36,8 +71,8 @@ public class JDBCStatement implements Statement { rs = new JDBCResultSet(_sql); queries.put(rs.getID(), rs); synchronized (rs) { - this.connection - .send(new JDBCCommand(rs, JDBCCommand.TYPE_EXECUTE_QUERY)); + this.connection.send(new JDBCCommand(rs, + JDBCCommand.TYPE_EXECUTE_QUERY)); try { rs.wait(); } catch (Exception err) { @@ -46,7 +81,7 @@ public class JDBCStatement implements Statement { throw ((SQLException) rs.getError()); } } - return rs; + return rs.getProxy(); } @Override @@ -118,21 +153,20 @@ public class JDBCStatement implements Statement { @Override public boolean execute(String sql, int autoGeneratedKeys) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return false; } @Override - public boolean execute(String sql, int[] columnIndexes) - throws SQLException { + public boolean execute(String sql, int[] columnIndexes) throws SQLException { // TODO Auto-generated method stub return false; } @Override public boolean execute(String sql, String[] columnNames) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return false; } @@ -145,21 +179,21 @@ public class JDBCStatement implements Statement { @Override public int executeUpdate(String sql, int autoGeneratedKeys) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return 0; } @Override public int executeUpdate(String sql, int[] columnIndexes) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return 0; } @Override public int executeUpdate(String sql, String[] columnNames) - throws SQLException { + throws SQLException { // TODO Auto-generated method stub return 0; } @@ -202,8 +236,7 @@ public class JDBCStatement implements Statement { @Override public int getMaxRows() throws SQLException { - // TODO Auto-generated method stub - return 0; + return 200; } @Override @@ -326,5 +359,358 @@ public class JDBCStatement implements Statement { return false; } + @Override + public ResultSet executeQuery() throws SQLException { + return this.executeQuery(this.sql); + } + + @Override + public int executeUpdate() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public void setNull(int parameterIndex, int sqlType) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setByte(int parameterIndex, byte x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setShort(int parameterIndex, short x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setInt(int parameterIndex, int x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setLong(int parameterIndex, long x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setFloat(int parameterIndex, float x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setDouble(int parameterIndex, double x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setBigDecimal(int parameterIndex, BigDecimal x) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setString(int parameterIndex, String x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setDate(int parameterIndex, Date x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setTime(int parameterIndex, Time x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setTimestamp(int parameterIndex, Timestamp x) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x, int length) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setUnicodeStream(int parameterIndex, InputStream x, int length) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x, int length) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void clearParameters() throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setObject(int parameterIndex, Object x, int targetSqlType) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setObject(int parameterIndex, Object x) throws SQLException { + // TODO Auto-generated method stub + } + + @Override + public boolean execute() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public void addBatch() throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader, int length) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setRef(int parameterIndex, Ref x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setBlob(int parameterIndex, Blob x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setClob(int parameterIndex, Clob x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setArray(int parameterIndex, Array x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public ResultSetMetaData getMetaData() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setDate(int parameterIndex, Date x, Calendar cal) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setTime(int parameterIndex, Time x, Calendar cal) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setNull(int parameterIndex, int sqlType, String typeName) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setURL(int parameterIndex, URL x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public ParameterMetaData getParameterMetaData() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setRowId(int parameterIndex, RowId x) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setNString(int parameterIndex, String value) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setNCharacterStream(int parameterIndex, Reader value, + long length) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setNClob(int parameterIndex, NClob value) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setClob(int parameterIndex, Reader reader, long length) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setBlob(int parameterIndex, InputStream inputStream, long length) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setNClob(int parameterIndex, Reader reader, long length) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setSQLXML(int parameterIndex, SQLXML xmlObject) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setObject(int parameterIndex, Object x, int targetSqlType, + int scaleOrLength) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x, long length) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x, long length) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader, + long length) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setNCharacterStream(int parameterIndex, Reader value) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setClob(int parameterIndex, Reader reader) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setBlob(int parameterIndex, InputStream inputStream) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + // TODO Auto-generated method stub + + } } diff --git a/opendaylight/md-sal/sal-dom-xsql/src/test/java/org/opendaylight/xsql/test/XSQLTest.java b/opendaylight/md-sal/sal-dom-xsql/src/test/java/org/opendaylight/xsql/test/XSQLTest.java new file mode 100644 index 0000000000..8a6b184f82 --- /dev/null +++ b/opendaylight/md-sal/sal-dom-xsql/src/test/java/org/opendaylight/xsql/test/XSQLTest.java @@ -0,0 +1,170 @@ +package org.opendaylight.xsql.test; + +import java.io.InputStream; +import java.sql.SQLException; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter; +import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint; +import org.opendaylight.controller.md.sal.dom.xsql.jdbc.JDBCResultSet; +import org.opendaylight.controller.md.sal.dom.xsql.jdbc.JDBCServer; + +public class XSQLTest { + + XSQLBluePrint bluePrint = null; + + @Before + public void before() { + try{ + InputStream in = this.getClass().getClassLoader().getResourceAsStream("BluePrintCache.dat"); + if(in!=null){ + bluePrint = XSQLBluePrint.load(in); + log("Loaded Blue Print!"); + }else{ + log("Can't find Blue Print!"); + } + in.close(); + }catch(Exception err){ + err.printStackTrace(); + } + } + + @Test + public void testQueryParsingSimpleNoCriteria() { + String sql = "select * from nodes/node;"; + JDBCResultSet rs = new JDBCResultSet(sql); + parseTables(sql,bluePrint, rs); + parseFields(sql, bluePrint, rs); + JDBCServer.parseCriteria(rs, bluePrint); + if(rs.getCriteria().isEmpty()){ + log("Test Criteria parsing of \""+sql+"\" Passed!"); + Assert.assertEquals(true, true); + }else{ + log("Test Criteria parsing of \""+sql+"\" Failed!"); + Assert.assertEquals(false, true); + } + } + + @Test + public void testQueryParsingComplexNoCriteria() { + String sql = "select nodes/node.id,nodes/node/node-connector.id,nodes/node/node-connector.hardware-address from nodes/node,nodes/node/node-connector;"; + JDBCResultSet rs = new JDBCResultSet(sql); + parseTables(sql,bluePrint, rs); + parseFields(sql, bluePrint, rs); + JDBCServer.parseCriteria(rs, bluePrint); + if(rs.getCriteria().isEmpty()){ + log("Test Criteria parsing of \""+sql+"\" Passed!"); + Assert.assertEquals(true, true); + }else{ + log("Test Criteria parsing of \""+sql+"\" Failed!"); + Assert.assertEquals(false, true); + } + } + + @Test + public void testQueryParsingComplexWithCriteria() { + String sql = "select nodes/node.id,nodes/node/node-connector.id,nodes/node/node-connector.hardware-address from nodes/node,nodes/node/node-connector where hardware-address like 'AB';"; + JDBCResultSet rs = new JDBCResultSet(sql); + parseTables(sql,bluePrint, rs); + parseFields(sql, bluePrint, rs); + JDBCServer.parseCriteria(rs, bluePrint); + if(!rs.getCriteria().isEmpty()){ + log("Test Criteria parsing of \""+sql+"\" Passed!"); + Assert.assertEquals(true, true); + }else{ + log("Test Criteria parsing of \""+sql+"\" Failed!"); + Assert.assertEquals(false, true); + } + } + + @Test + public void testQueryParsingSimpleWithCriteria() { + String sql = "select * from nodes/node where nodes/node.id like 'something...';"; + JDBCResultSet rs = new JDBCResultSet(sql); + parseTables(sql,bluePrint, rs); + parseFields(sql, bluePrint, rs); + JDBCServer.parseCriteria(rs, bluePrint); + if(!rs.getCriteria().isEmpty()){ + log("Test Criteria parsing of \""+sql+"\" Passed!"); + Assert.assertEquals(true, true); + }else{ + log("Test Criteria parsing of \""+sql+"\" Failed!"); + Assert.assertEquals(false, true); + } + } + + private static void parseTables(String sql,XSQLBluePrint bp,JDBCResultSet rs){ + try{ + JDBCServer.parseTables(rs, bp); + log("Test Table parsing of \""+sql+"\" Passed!"); + Assert.assertEquals(true,true); + }catch(SQLException err){ + log("Test Table parsing of \""+sql+"\" Failed!"); + err.printStackTrace(); + Assert.assertEquals(false,true); + } + } + + @Test + public void testQueryParsingComplexWithCriteriaAndGrouping() { + + String sub_sql = "select nodes/node.id,nodes/node/node-connector.id,nodes/node/node-connector.hardware-address from nodes/node,nodes/node/node-connector where hardware-address like 'AB';"; + + String sql = "SELECT DISTINCT" + + "\"LOGICAL_TABLE_1\".\"nodes/node.id\" AS \"COL0\"\n" + + ",\"LOGICAL_TABLE_1\".\"nodes/node.address\" AS \"COL1\"\n" + + ",\"LOGICAL_TABLE_1\".\"nodes/node/node-connector.hardware-address\" AS \"COL2\"\n" + + "FROM\n" + + "("+sub_sql+") \"LOGICAL_TABLE_1\"\n"; + + + + JDBCResultSet rs = new JDBCResultSet(sql); + XSQLAdapter.getInstance().loadBluePrint(); + try{ + JDBCServer.checkAndBreakSubQueries(rs, XSQLAdapter.getInstance()); + if(rs.getSubQueries().isEmpty()){ + log("Logical table parsing for "+sql+" Failed!"); + }else{ + JDBCServer.parseExternalQuery(rs); + log("Fields="+rs.getFields().size()); + Assert.assertEquals(rs.getFields().size(), 3); + Assert.assertEquals(rs.getTables().size(), 1); + Assert.assertEquals(rs.getTables().get(0).getODLTableName(), "LOGICAL_TABLE_1"); + + JDBCResultSet subRS = rs.getSubQueries().values().iterator().next(); + parseTables(sql,bluePrint, subRS); + parseFields(sql, bluePrint, subRS); + JDBCServer.parseCriteria(subRS, bluePrint); + if(!subRS.getCriteria().isEmpty()){ + log("Test Criteria parsing of \""+sql+"\" Passed!"); + Assert.assertEquals(true, true); + }else{ + log("Test Criteria parsing of \""+sql+"\" Failed!"); + Assert.assertEquals(false, true); + } + } + }catch(SQLException err){ + err.printStackTrace(); + } + } + + private static void parseFields(String sql,XSQLBluePrint bp,JDBCResultSet rs){ + try{ + JDBCServer.parseFields(rs, bp); + log("Test Fields parsing of \""+sql+"\" Passed!"); + Assert.assertEquals(true,true); + }catch(SQLException err){ + log("Test Fields parsing of \""+sql+"\" Failed!"); + err.printStackTrace(); + Assert.assertEquals(false,true); + } + } + + private static void log(String str) { + System.out.print("*** XSQL Tests -"); + System.out.println(str); + } +} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/test/resources/BluePrintCache.dat b/opendaylight/md-sal/sal-dom-xsql/src/test/resources/BluePrintCache.dat new file mode 100644 index 0000000000..b6b34acfcd Binary files /dev/null and b/opendaylight/md-sal/sal-dom-xsql/src/test/resources/BluePrintCache.dat differ diff --git a/opendaylight/md-sal/sal-inmemory-datastore/pom.xml b/opendaylight/md-sal/sal-inmemory-datastore/pom.xml index 725b24cd9e..473b065b59 100644 --- a/opendaylight/md-sal/sal-inmemory-datastore/pom.xml +++ b/opendaylight/md-sal/sal-inmemory-datastore/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-inmemory-datastore diff --git a/opendaylight/md-sal/sal-karaf-xsql/pom.xml b/opendaylight/md-sal/sal-karaf-xsql/pom.xml index a1bf2c806e..9ed3707d3d 100644 --- a/opendaylight/md-sal/sal-karaf-xsql/pom.xml +++ b/opendaylight/md-sal/sal-karaf-xsql/pom.xml @@ -23,7 +23,7 @@ sal-parent org.opendaylight.controller - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT org.opendaylight.controller @@ -63,7 +63,7 @@ org.opendaylight.controller sal-dom-xsql - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT diff --git a/opendaylight/md-sal/sal-karaf-xsql/src/main/java/org/opendaylight/controller/xsql/xsql.java b/opendaylight/md-sal/sal-karaf-xsql/src/main/java/org/opendaylight/controller/xsql/xsql.java index b7994dc1bf..9f0266c19d 100644 --- a/opendaylight/md-sal/sal-karaf-xsql/src/main/java/org/opendaylight/controller/xsql/xsql.java +++ b/opendaylight/md-sal/sal-karaf-xsql/src/main/java/org/opendaylight/controller/xsql/xsql.java @@ -16,6 +16,10 @@ public class xsql extends OsgiCommandSupport { private String argument; protected Object doExecute() throws Exception { + if(argument==null){ + System.out.println("Nothing to do..., please specify a command."); + return null; + } XSQLAdapter.getInstance().processCommand(new StringBuffer(argument), System.out); return null; diff --git a/opendaylight/md-sal/sal-netconf-connector/pom.xml b/opendaylight/md-sal/sal-netconf-connector/pom.xml index 049f8c2e3c..c8836d1b88 100644 --- a/opendaylight/md-sal/sal-netconf-connector/pom.xml +++ b/opendaylight/md-sal/sal-netconf-connector/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-netconf-connector diff --git a/opendaylight/md-sal/sal-remote/pom.xml b/opendaylight/md-sal/sal-remote/pom.xml index 31f1f02693..d47cf4ca07 100644 --- a/opendaylight/md-sal/sal-remote/pom.xml +++ b/opendaylight/md-sal/sal-remote/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-remote bundle diff --git a/opendaylight/md-sal/sal-remoterpc-connector/pom.xml b/opendaylight/md-sal/sal-remoterpc-connector/pom.xml index 0fb468be86..d16f67209f 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/pom.xml +++ b/opendaylight/md-sal/sal-remoterpc-connector/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-remoterpc-connector bundle diff --git a/opendaylight/md-sal/sal-rest-connector-config/pom.xml b/opendaylight/md-sal/sal-rest-connector-config/pom.xml index fa91f0398d..dc3dd8e476 100644 --- a/opendaylight/md-sal/sal-rest-connector-config/pom.xml +++ b/opendaylight/md-sal/sal-rest-connector-config/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-rest-connector-config Configuration files for sal-rest-connector diff --git a/opendaylight/md-sal/sal-rest-connector/pom.xml b/opendaylight/md-sal/sal-rest-connector/pom.xml index fe5c9f39d8..4a96847175 100644 --- a/opendaylight/md-sal/sal-rest-connector/pom.xml +++ b/opendaylight/md-sal/sal-rest-connector/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-rest-connector bundle @@ -139,7 +139,7 @@ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.rest.connector.rev140724.*, *, - com.sun.jersey.spi.container.servlet + com.sun.jersey.spi.container.servlet, org.eclipse.jetty.servlets /restconf diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonToCompositeNodeReader.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonToCompositeNodeReader.java index 5fbb605558..552e2bbd19 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonToCompositeNodeReader.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonToCompositeNodeReader.java @@ -29,7 +29,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; class JsonToCompositeNodeReader { - private static final Logger LOG = LoggerFactory.getLogger(JsonReader.class); + private static final Logger LOG = LoggerFactory.getLogger(JsonToCompositeNodeReader.class); private static final Splitter COLON_SPLITTER = Splitter.on(':'); private JsonToCompositeNodeReader() { @@ -113,14 +113,29 @@ class JsonToCompositeNodeReader { } } + /** + * Transform input value to URI instance. + * + * Input string has to be in format moduleName:localName. moduleName part is then transformed to URI instance. + * If moduleName part contains character like "<" or ">" then null value is returned because they + * aren't valid URI characters. + * + * @param jsonElementName + * value in format moduleName:localName + * @return + */ private static URI getNamespaceFor(final String jsonElementName) { final Iterator it = COLON_SPLITTER.split(jsonElementName).iterator(); - // The string needs to me in form "moduleName:localName" + // The string needs to be in form "moduleName:localName" if (it.hasNext()) { final String maybeURI = it.next(); if (Iterators.size(it) == 1) { - return URI.create(maybeURI); + try { + return URI.create(maybeURI); + } catch (IllegalArgumentException e) { + LOG.debug("Value {} couldn't be interpreted as URI.", maybeURI); + } } } @@ -144,7 +159,7 @@ class JsonToCompositeNodeReader { } } - // it could be identityref Built-In Type + // it could be identityref Built-In Type therefore it is necessary to look at value as module_name:local_name URI namespace = getNamespaceFor(value); if (namespace != null) { return new IdentityValuesDTO(namespace.toString(), getLocalNameFor(value), null, value); diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/resources/WEB-INF/web.xml b/opendaylight/md-sal/sal-rest-connector/src/main/resources/WEB-INF/web.xml index 60c3378471..120a826b32 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/resources/WEB-INF/web.xml +++ b/opendaylight/md-sal/sal-rest-connector/src/main/resources/WEB-INF/web.xml @@ -23,6 +23,27 @@ /* + + cross-origin-restconf + org.eclipse.jetty.servlets.CrossOriginFilter + + allowedOrigins + * + + + allowedMethods + GET,POST,OPTIONS,DELETE,PUT,HEAD + + + allowedHeaders + origin, content-type, accept, authorization + + + + cross-origin-restconf + /* + + NB api diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonToCnSnTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonToCnSnTest.java index 3699e4924f..d65cb1bdbf 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonToCnSnTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonToCnSnTest.java @@ -422,4 +422,36 @@ public class JsonToCnSnTest { assertTrue(exceptionMessage.contains("Root element of Json has to be Object")); } + /** + * Tests case when JSON input data value is in format string1:string2 and first string contain characters "<" or ">" (invalid URI characters). + * + * During loading data it is also interpreting as data value in moduleName:localName (potential leafref value). + * ModuleName part is transformed to URI which causes exception which is caught and URI value is null which cause that potential value in simple node is + * simple string (value from JSON input) and not IdentityValueDTO instance which is used for leaf-ref candidates. + */ + @Test + public void invalidUriCharacterInValue() { + final Node rootNode = TestUtils.readInputToCnSn("/json-to-cnsn/invalid-uri-character-in-value.json", true, + JsonToCompositeNodeProvider.INSTANCE); + + assertTrue(rootNode instanceof CompositeNode); + Node lf1 = null; + Node lf2 = null; + for(Node child : ((CompositeNode)rootNode).getChildren()) { + if (child.getNodeType().getLocalName().equals("lf1")) { + lf1 = child; + } else if (child.getNodeType().getLocalName().equals("lf2")) { + lf2 = child; + } + } + + assertNotNull(lf1); + assertNotNull(lf2); + assertTrue(lf1 instanceof SimpleNode); + assertTrue(lf2 instanceof SimpleNode); + + assertEquals("module) lf1).getValue()); + assertEquals("module>Name:value lf2", ((SimpleNode) lf2).getValue()); + } + } diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/json-to-cnsn/invalid-uri-character-in-value.json b/opendaylight/md-sal/sal-rest-connector/src/test/resources/json-to-cnsn/invalid-uri-character-in-value.json new file mode 100644 index 0000000000..6a78e9fc87 --- /dev/null +++ b/opendaylight/md-sal/sal-rest-connector/src/test/resources/json-to-cnsn/invalid-uri-character-in-value.json @@ -0,0 +1,6 @@ +{ + "moduleName:cont":{ + "lf1":"moduleName:value lf2" + } +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-rest-docgen/pom.xml b/opendaylight/md-sal/sal-rest-docgen/pom.xml index 1141e1d72e..5abb4f8910 100644 --- a/opendaylight/md-sal/sal-rest-docgen/pom.xml +++ b/opendaylight/md-sal/sal-rest-docgen/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-rest-docgen @@ -113,7 +113,7 @@ MD SAL Rest Api Doc Generator *, - com.sun.jersey.spi.container.servlet + com.sun.jersey.spi.container.servlet, org.eclipse.jetty.servlets org.opendaylight.controller.sal.rest.doc.DocProvider /apidoc diff --git a/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/BaseYangSwaggerGenerator.java b/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/BaseYangSwaggerGenerator.java index 5d0f3612e4..4d567bdef5 100644 --- a/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/BaseYangSwaggerGenerator.java +++ b/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/BaseYangSwaggerGenerator.java @@ -173,12 +173,12 @@ public class BaseYangSwaggerGenerator { resourcePath = getDataStorePath("/operational/", context); addApis(node, apis, resourcePath, pathParams, schemaContext, false); } + } - Set rpcs = m.getRpcs(); - for (RpcDefinition rpcDefinition : rpcs) { - String resourcePath = getDataStorePath("/operations/", context); - addRpcs(rpcDefinition, apis, resourcePath, schemaContext); - } + Set rpcs = m.getRpcs(); + for (RpcDefinition rpcDefinition : rpcs) { + String resourcePath = getDataStorePath("/operations/", context); + addRpcs(rpcDefinition, apis, resourcePath, schemaContext); } _logger.debug("Number of APIs found [{}]", apis.size()); diff --git a/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGenerator.java b/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGenerator.java index f4274870c9..3b503ebba3 100644 --- a/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGenerator.java +++ b/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGenerator.java @@ -146,8 +146,10 @@ public class ModelGenerator { for (DataSchemaNode childNode : module.getChildNodes()) { // For every container and list in the module - processDataNodeContainer((DataNodeContainer) childNode, moduleName, models, true, schemaContext); - processDataNodeContainer((DataNodeContainer) childNode, moduleName, models, false, schemaContext); + if (childNode instanceof ContainerSchemaNode || childNode instanceof ListSchemaNode) { + processDataNodeContainer((DataNodeContainer) childNode, moduleName, models, true, schemaContext); + processDataNodeContainer((DataNodeContainer) childNode, moduleName, models, false, schemaContext); + } } } @@ -306,6 +308,9 @@ public class ModelGenerator { property.put(TYPE_KEY, childNode instanceof ListSchemaNode ? ARRAY_TYPE : OBJECT_TYPE); property.put(ITEMS_KEY, items); properties.put(childNode.getQName().getLocalName(), property); + } else if (childNode instanceof LeafSchemaNode){ + JSONObject property = processLeafNode((LeafSchemaNode)childNode); + properties.put(childNode.getQName().getLocalName(), property); } } return properties; diff --git a/opendaylight/md-sal/sal-rest-docgen/src/main/resources/WEB-INF/web.xml b/opendaylight/md-sal/sal-rest-docgen/src/main/resources/WEB-INF/web.xml index c470b3237e..d777942b53 100644 --- a/opendaylight/md-sal/sal-rest-docgen/src/main/resources/WEB-INF/web.xml +++ b/opendaylight/md-sal/sal-rest-docgen/src/main/resources/WEB-INF/web.xml @@ -20,39 +20,28 @@ /apis/* - + cross-origin-api-doc + /apis/* + + + free access diff --git a/opendaylight/md-sal/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGeneratorTest.java b/opendaylight/md-sal/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGeneratorTest.java new file mode 100644 index 0000000000..5918a0e839 --- /dev/null +++ b/opendaylight/md-sal/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGeneratorTest.java @@ -0,0 +1,45 @@ +package org.opendaylight.controller.sal.rest.doc.impl; + +import com.google.common.base.Preconditions; +import org.json.JSONObject; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.opendaylight.yangtools.yang.model.api.Module; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; +import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl; + +import java.io.File; +import java.util.HashSet; +import java.util.Map; + + +public class ModelGeneratorTest { + + private DocGenTestHelper helper; + private SchemaContext schemaContext; + + @Before + public void setUp() throws Exception { + helper = new DocGenTestHelper(); + helper.setUp(); + schemaContext = new YangParserImpl().resolveSchemaContext(new HashSet(helper.getModules().values())); + } + + @Test + public void testConvertToJsonSchema() throws Exception { + + Preconditions.checkArgument(helper.getModules() != null, "No modules found"); + + ModelGenerator generator = new ModelGenerator(); + + for (Map.Entry m : helper.getModules().entrySet()) { + if (m.getKey().getAbsolutePath().endsWith("opflex.yang")) { + + JSONObject jsonObject = generator.convertToJsonSchema(m.getValue(), schemaContext); + Assert.assertNotNull(jsonObject); + } + } + + } +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-rest-docgen/src/test/resources/yang/opflex.yang b/opendaylight/md-sal/sal-rest-docgen/src/test/resources/yang/opflex.yang new file mode 100644 index 0000000000..8e598ddaab --- /dev/null +++ b/opendaylight/md-sal/sal-rest-docgen/src/test/resources/yang/opflex.yang @@ -0,0 +1,50 @@ +module opflex { + yang-version 1; + + namespace "urn:opendaylight:groupbasedpolicy:opflex"; + prefix "opflex"; + + + + + + description + "This module defines the group-based policy OpFlex renderer model."; + + revision "2014-05-28" { + description + "Initial revision."; + } + + typedef serialization { + description + "The serialization to use for OpFlex messages."; + + type enumeration { + enum json { + description + "JSON 1.0 serialization."; + } + enum xml { + description + "XML serialization."; + } + enum binary { + description + "OpFlex binary serialization."; + } + } + } + + // ****************** + // Configuration Data + // ****************** + leaf domain { + description + "The OpFlex administrative domain."; + + config true; + + type string; + } +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-rest-docgen/src/test/resources/yang/toaster.yang b/opendaylight/md-sal/sal-rest-docgen/src/test/resources/yang/toaster.yang index 20bbd78622..ffddc8c3da 100644 --- a/opendaylight/md-sal/sal-rest-docgen/src/test/resources/yang/toaster.yang +++ b/opendaylight/md-sal/sal-rest-docgen/src/test/resources/yang/toaster.yang @@ -20,11 +20,19 @@ module toaster { "Toaster module in progress."; } + leaf domain { + description + "Toaster domain."; + + config true; + + type string; + } identity toast-type { description "Base for all bread types supported by the toaster. - New bread types not listed here nay be added in the + New bread types not listed here nay be added in the future."; } @@ -72,7 +80,7 @@ module toaster { "Indicates the toaster service is available"; description "Top-level container for all toaster database objects."; - + leaf testToasterBits { type bits { bit testbit1 { @@ -84,21 +92,21 @@ module toaster { } default "testbit2"; } - + leaf testUnion { type union { type int32; type string; } - - } - + + } + leaf-list allow-user { type string; description "A list of user name patterns to allow"; - + } - + choice how { default interval; case interval { @@ -123,14 +131,14 @@ module toaster { type string; } } - } - + } + leaf toasterManufacturer { type DisplayString; config false; mandatory true; description - "The name of the toaster's manufacturer. For instance, + "The name of the toaster's manufacturer. For instance, Microsoft Toaster."; } @@ -161,7 +169,7 @@ module toaster { config false; mandatory true; description - "This variable indicates the current state of + "This variable indicates the current state of the toaster."; } } @@ -169,11 +177,11 @@ module toaster { rpc make-toast { description "Make some toast. - The toastDone notification will be sent when + The toastDone notification will be sent when the toast is finished. An 'in-use' error will be returned if toast is already being made. - A 'resource-denied' error will be returned + A 'resource-denied' error will be returned if the toaster service is disabled."; input { leaf toasterDoneness { @@ -182,10 +190,10 @@ module toaster { } default '5'; description - "This variable controls how well-done is the + "This variable controls how well-done is the ensuing toast. It should be on a scale of 1 to 10. - Toast made at 10 generally is considered unfit - for human consumption; toast made at 1 is warmed + Toast made at 10 generally is considered unfit + for human consumption; toast made at 1 is warmed lightly."; } @@ -195,23 +203,23 @@ module toaster { } default 'wheat-bread'; description - "This variable informs the toaster of the type of - material that is being toasted. The toaster - uses this information, combined with - toasterDoneness, to compute for how - long the material must be toasted to achieve + "This variable informs the toaster of the type of + material that is being toasted. The toaster + uses this information, combined with + toasterDoneness, to compute for how + long the material must be toasted to achieve the required doneness."; } } - } + } rpc cancel-toast { description "Stop making toast, if any is being made. - A 'resource-denied' error will be returned + A 'resource-denied' error will be returned if the toaster service is disabled."; - } - + } + notification toastDone { description "Indicates that the toast in progress has completed."; @@ -236,5 +244,5 @@ module toaster { description "Indicates the final toast status"; } - } - } + } + } diff --git a/opendaylight/md-sal/sal-restconf-broker/pom.xml b/opendaylight/md-sal/sal-restconf-broker/pom.xml index 9e64c3aed6..db2b06e714 100644 --- a/opendaylight/md-sal/sal-restconf-broker/pom.xml +++ b/opendaylight/md-sal/sal-restconf-broker/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sal-restconf-broker bundle diff --git a/opendaylight/md-sal/sal-test-model/pom.xml b/opendaylight/md-sal/sal-test-model/pom.xml index 11a0ef211a..2a8a80da09 100644 --- a/opendaylight/md-sal/sal-test-model/pom.xml +++ b/opendaylight/md-sal/sal-test-model/pom.xml @@ -5,7 +5,7 @@ sal-parent org.opendaylight.controller - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT 4.0.0 diff --git a/opendaylight/md-sal/samples/clustering-test-app/configuration/pom.xml b/opendaylight/md-sal/samples/clustering-test-app/configuration/pom.xml index 8d4bbbd64c..33a8a92f9f 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/configuration/pom.xml +++ b/opendaylight/md-sal/samples/clustering-test-app/configuration/pom.xml @@ -12,7 +12,7 @@ clustering-it org.opendaylight.controller.samples - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT clustering-it-config jar diff --git a/opendaylight/md-sal/samples/clustering-test-app/model/pom.xml b/opendaylight/md-sal/samples/clustering-test-app/model/pom.xml index a23e32df2b..60eeba64c7 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/model/pom.xml +++ b/opendaylight/md-sal/samples/clustering-test-app/model/pom.xml @@ -4,7 +4,7 @@ clustering-it org.opendaylight.controller.samples - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT clustering-it-model bundle diff --git a/opendaylight/md-sal/samples/clustering-test-app/pom.xml b/opendaylight/md-sal/samples/clustering-test-app/pom.xml index 863bbecdf9..5824621331 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/pom.xml +++ b/opendaylight/md-sal/samples/clustering-test-app/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller.samples sal-samples - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT clustering-it pom diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/pom.xml b/opendaylight/md-sal/samples/clustering-test-app/provider/pom.xml index 093b681125..d4d55b04c0 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/pom.xml +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/pom.xml @@ -4,7 +4,7 @@ clustering-it org.opendaylight.controller.samples - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT clustering-it-provider bundle diff --git a/opendaylight/md-sal/samples/l2switch/implementation/pom.xml b/opendaylight/md-sal/samples/l2switch/implementation/pom.xml index 8824284785..a0e119b49c 100644 --- a/opendaylight/md-sal/samples/l2switch/implementation/pom.xml +++ b/opendaylight/md-sal/samples/l2switch/implementation/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller.samples sal-samples - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT ../.. org.opendaylight.controller.samples.l2switch.md diff --git a/opendaylight/md-sal/samples/l2switch/model/pom.xml b/opendaylight/md-sal/samples/l2switch/model/pom.xml index 0ccc74d952..fa35c1f6cd 100644 --- a/opendaylight/md-sal/samples/l2switch/model/pom.xml +++ b/opendaylight/md-sal/samples/l2switch/model/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller.samples sal-samples - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT ../.. org.opendaylight.controller.samples.l2switch.md diff --git a/opendaylight/md-sal/samples/l2switch/pom.xml b/opendaylight/md-sal/samples/l2switch/pom.xml index e0a51a8e3c..6a715c74ab 100644 --- a/opendaylight/md-sal/samples/l2switch/pom.xml +++ b/opendaylight/md-sal/samples/l2switch/pom.xml @@ -7,12 +7,12 @@ org.opendaylight.controller.samples sal-samples - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT l2switch.aggregator org.opendaylight.controller.samples.l2switch - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT pom diff --git a/opendaylight/md-sal/samples/pom.xml b/opendaylight/md-sal/samples/pom.xml index d13200e4e8..6070c72472 100644 --- a/opendaylight/md-sal/samples/pom.xml +++ b/opendaylight/md-sal/samples/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT org.opendaylight.controller.samples diff --git a/opendaylight/md-sal/samples/toaster-config/pom.xml b/opendaylight/md-sal/samples/toaster-config/pom.xml index b30c4ba12f..b0592b654d 100644 --- a/opendaylight/md-sal/samples/toaster-config/pom.xml +++ b/opendaylight/md-sal/samples/toaster-config/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.controller.samples sal-samples - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT toaster-config Configuration files for toaster diff --git a/opendaylight/md-sal/samples/toaster-consumer/pom.xml b/opendaylight/md-sal/samples/toaster-consumer/pom.xml index 6e720299d8..fb6828a250 100644 --- a/opendaylight/md-sal/samples/toaster-consumer/pom.xml +++ b/opendaylight/md-sal/samples/toaster-consumer/pom.xml @@ -4,13 +4,13 @@ org.opendaylight.controller.samples sal-samples - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sample-toaster-consumer bundle - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT diff --git a/opendaylight/md-sal/samples/toaster-it/pom.xml b/opendaylight/md-sal/samples/toaster-it/pom.xml index 56ed9a07a6..804da597ac 100644 --- a/opendaylight/md-sal/samples/toaster-it/pom.xml +++ b/opendaylight/md-sal/samples/toaster-it/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller.samples sal-samples - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sample-toaster-it diff --git a/opendaylight/md-sal/samples/toaster-provider/pom.xml b/opendaylight/md-sal/samples/toaster-provider/pom.xml index 89dcab2c3d..08f0988b5c 100644 --- a/opendaylight/md-sal/samples/toaster-provider/pom.xml +++ b/opendaylight/md-sal/samples/toaster-provider/pom.xml @@ -4,13 +4,13 @@ org.opendaylight.controller.samples sal-samples - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sample-toaster-provider bundle - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT diff --git a/opendaylight/md-sal/samples/toaster/pom.xml b/opendaylight/md-sal/samples/toaster/pom.xml index 5c8b20a4e3..ab761fd6bf 100644 --- a/opendaylight/md-sal/samples/toaster/pom.xml +++ b/opendaylight/md-sal/samples/toaster/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller.samples sal-samples - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT sample-toaster bundle diff --git a/opendaylight/md-sal/statistics-manager/pom.xml b/opendaylight/md-sal/statistics-manager/pom.xml index 5b8c6268e2..1a443177c6 100644 --- a/opendaylight/md-sal/statistics-manager/pom.xml +++ b/opendaylight/md-sal/statistics-manager/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT org.opendaylight.controller.md statistics-manager diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatListeningCommiter.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatListeningCommiter.java index 7589c72a45..be3d40246b 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatListeningCommiter.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatListeningCommiter.java @@ -9,7 +9,9 @@ package org.opendaylight.controller.md.statistics.manager; import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.NotificationListener; /** @@ -30,5 +32,13 @@ import org.opendaylight.yangtools.yang.binding.NotificationListener; public interface StatListeningCommiter extends DataChangeListener, StatNotifyCommiter { + /** + * All StatListeningCommiter implementer has to clean its actual state + * for all cached data related to disconnected node. + * Method prevents unwanted dataStore changes. + * + * @param nodeIdent + */ + void cleanForDisconnect(InstanceIdentifier nodeIdent); } diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsManagerActivator.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsManagerActivator.java index 912a6eda4b..c505af49e6 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsManagerActivator.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsManagerActivator.java @@ -31,7 +31,7 @@ public class StatisticsManagerActivator extends AbstractBindingAwareProvider { /* TODO move it to ConfigSubsystem */ private static final long DEFAULT_MIN_REQUEST_NET_MONITOR_INTERVAL = 3000L; - private static final int MAX_NODES_FOR_COLLECTOR = 8; + private static final int MAX_NODES_FOR_COLLECTOR = 16; private StatisticsManager statsProvider; diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatAbstractListenCommit.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatAbstractListenCommit.java index 6ebf944b22..6db73d5ddc 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatAbstractListenCommit.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatAbstractListenCommit.java @@ -108,6 +108,11 @@ public abstract class StatAbstractListenCommit nodeIdent) { + mapNodesForDelete.remove(nodeIdent); + } + @Override public void close() { if (listenerRegistration != null) { diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitFlow.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitFlow.java index c5aefcbf96..230425999e 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitFlow.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitFlow.java @@ -35,6 +35,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.no import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.nodes.node.table.FlowHashIdMapBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.nodes.node.table.FlowHashIdMapKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; @@ -82,10 +83,12 @@ import com.google.common.collect.HashBiMap; public class StatListenCommitFlow extends StatAbstractListenCommit implements OpendaylightFlowStatisticsListener { - private static final Logger LOG = LoggerFactory.getLogger(StatListenCommitFlow.class); + protected static final Logger LOG = LoggerFactory.getLogger(StatListenCommitFlow.class); private static final String ALIEN_SYSTEM_FLOW_ID = "#UF$TABLE*"; + private static final Integer REMOVE_AFTER_MISSING_COLLECTION = 1; + private final AtomicInteger unaccountedFlowsCounter = new AtomicInteger(0); public StatListenCommitFlow (final StatisticsManager manager, final DataBroker db, @@ -137,18 +140,19 @@ public class StatListenCommitFlow extends StatAbstractListenCommit fNodeIdent = InstanceIdentifier.create(Nodes.class) .child(Node.class, new NodeKey(nodeId)).augmentation(FlowCapableNode.class); - final InstanceIdentifier tableStatRef = fNodeIdent - .child(Table.class, table.getKey()).augmentation(AggregateFlowStatisticsData.class); + final InstanceIdentifier tableRef = fNodeIdent.child(Table.class, table.getKey()); + final InstanceIdentifier tableStatRef = tableRef + .augmentation(AggregateFlowStatisticsData.class); Optional fNode = Optional.absent(); try { fNode = tx.read(LogicalDatastoreType.OPERATIONAL, fNodeIdent).checkedGet(); - } - catch (final ReadFailedException e) { + } catch (final ReadFailedException e) { LOG.debug("Read Operational/DS for FlowCapableNode fail! {}", fNodeIdent, e); return; } if (fNode.isPresent()) { - tx.put(LogicalDatastoreType.OPERATIONAL, tableStatRef, stats, true); + ensureTable(tx, table.getId(), tableRef); + tx.put(LogicalDatastoreType.OPERATIONAL, tableStatRef, stats); } } } @@ -156,6 +160,11 @@ public class StatListenCommitFlow extends StatAbstractListenCommit tableRef) { + final Table tableNew = new TableBuilder().setId(tableId).build(); + tx.merge(LogicalDatastoreType.OPERATIONAL, tableRef, tableNew); + } + @Override public void onFlowsStatisticsUpdate(final FlowsStatisticsUpdate notification) { final TransactionId transId = notification.getTransactionId(); @@ -192,6 +201,20 @@ public class StatListenCommitFlow extends StatAbstractListenCommit, Integer> listAliens = mapNodesForDelete.get(nodeIdent); + if (listAliens != null) { + for (final Entry, Integer> nodeForDelete : listAliens.entrySet()) { + final Integer lifeIndex = nodeForDelete.getValue(); + if (nodeForDelete.getValue() > 0) { + nodeForDelete.setValue(Integer.valueOf(lifeIndex.intValue() - 1)); + } else { + final InstanceIdentifier flowNodeIdent = nodeForDelete.getKey(); + mapNodesForDelete.get(nodeIdent).remove(flowNodeIdent); + tx.delete(LogicalDatastoreType.OPERATIONAL, flowNodeIdent); + } + } + } /* Notification for continue collecting statistics */ notifyToCollectNextStatistics(nodeIdent); } @@ -246,14 +269,13 @@ public class StatListenCommitFlow extends StatAbstractListenCommit tableRef; final TableKey tableKey; @@ -302,17 +325,22 @@ public class StatListenCommitFlow extends StatAbstractListenCommit flowHashMap = flowHashMapping.getFlowHashIdMap() != null ? flowHashMapping.getFlowHashIdMap() : Collections. emptyList(); for (final FlowHashIdMap flowHashId : flowHashMap) { - flowIdByHash.put(flowHashId.getKey(), flowHashId.getFlowId()); + try { + flowIdByHash.put(flowHashId.getKey(), flowHashId.getFlowId()); + } catch (final Exception e) { + LOG.warn("flow hashing hit a duplicate for {} -> {}", flowHashId.getKey(), flowHashId.getFlowId()); + } } } } } - private void ensureTable(final ReadWriteTransaction tx) { + private void ensureTableFowHashIdMapping(final ReadWriteTransaction tx) { if( ! tableEnsured) { + ensureTable(tx, tableKey.getId(), tableRef); final FlowHashIdMapping emptyMapping = new FlowHashIdMappingBuilder() .setFlowHashIdMap(Collections. emptyList()).build(); - tx.merge(LogicalDatastoreType.OPERATIONAL, tableRef.augmentation(FlowHashIdMapping.class), emptyMapping, true); + tx.merge(LogicalDatastoreType.OPERATIONAL, tableRef.augmentation(FlowHashIdMapping.class), emptyMapping); tableEnsured = true; } } @@ -334,12 +362,7 @@ public class StatListenCommitFlow extends StatAbstractListenCommit table = readLatestConfiguration(tableRef); - try { - table = trans.read(LogicalDatastoreType.CONFIGURATION, tableRef).checkedGet(); - } catch (final ReadFailedException e) { - table = Optional.absent(); - } + final Optional
      table = readLatestConfiguration(tableRef); List localList = null; if(table.isPresent()) { localList = table.get().getFlow(); @@ -373,8 +396,8 @@ public class StatListenCommitFlow extends StatAbstractListenCommit nodeIdent = tableRef.firstIdentifierOf(Node.class); + final List> listMissingConfigFlows = notStatReportedConfigFlows(); + final Map, Integer> nodeDeleteMap = mapNodesForDelete.get(nodeIdent); final Map listForRemove = getRemovalList(); - final Optional
      configTable = readLatestConfiguration(tableRef); - List configFlows = Collections.emptyList(); - if (configTable.isPresent() && configTable.get().getFlow() != null) { - configFlows = new ArrayList<>(configTable.get().getFlow()); - } for (final Entry entryForRemove : listForRemove.entrySet()) { final FlowKey flowKey = new FlowKey(entryForRemove.getValue()); final InstanceIdentifier flowRef = tableRef.child(Flow.class, flowKey); - final InstanceIdentifier flowStatIdent = flowRef.augmentation(FlowStatisticsData.class); - if (flowKey.getId().getValue().startsWith(ALIEN_SYSTEM_FLOW_ID)) { - final InstanceIdentifier nodeIdent = tableRef.firstIdentifierOf(Node.class); - final Integer lifeIndex = mapNodesForDelete.get(nodeIdent).remove(flowRef); + if (nodeDeleteMap != null && flowKey.getId().getValue().startsWith(ALIEN_SYSTEM_FLOW_ID)) { + final Integer lifeIndex = nodeDeleteMap.get(flowRef); if (lifeIndex > 0) { - mapNodesForDelete.get(nodeIdent).put(flowRef, Integer.valueOf(lifeIndex.intValue() - 1)); break; + } else { + nodeDeleteMap.remove(flowRef); } } else { - if (configFlows.remove(flowRef)) { - /* Node is still presented in Config/DataStore - probably lost some multipart msg */ - break; + if (listMissingConfigFlows.remove(flowRef)) { + break; // we probably lost some multipart msg } } - final Optional flowStatNodeCheck; - try { - flowStatNodeCheck = tx.read(LogicalDatastoreType.OPERATIONAL, flowStatIdent).checkedGet(); - } - catch (final ReadFailedException e) { - LOG.debug("Read FlowStatistics {} in Operational/DS fail! Statisticscan not beupdated.", flowStatIdent, e); - break; - } - if (flowStatNodeCheck.isPresent()) { - /* Node isn't new and it has not been removed yet */ - final InstanceIdentifier flHashIdent = tableRef.augmentation(FlowHashIdMapping.class).child(FlowHashIdMap.class, entryForRemove.getKey()); - tx.delete(LogicalDatastoreType.OPERATIONAL, flowRef); - tx.delete(LogicalDatastoreType.OPERATIONAL, flHashIdent); + final InstanceIdentifier flHashIdent = + tableRef.augmentation(FlowHashIdMapping.class).child(FlowHashIdMap.class, entryForRemove.getKey()); + tx.delete(LogicalDatastoreType.OPERATIONAL, flowRef); + tx.delete(LogicalDatastoreType.OPERATIONAL, flHashIdent); + } + } + + List> notStatReportedConfigFlows() { + if (configFlows != null) { + final List> returnList = new ArrayList<>(configFlows.size()); + for (final Flow confFlow : configFlows) { + final InstanceIdentifier confFlowIdent = tableRef.child(Flow.class, confFlow.getKey()); + returnList.add(confFlowIdent); } + return returnList; } + return Collections.emptyList(); } } } diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitGroup.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitGroup.java index 41d97f080a..f351132f7f 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitGroup.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitGroup.java @@ -155,7 +155,7 @@ public class StatListenCommitGroup extends StatAbstractListenCommit existGroups = fNode.get().getGroup().isEmpty() - ? Collections. emptyList() : fNode.get().getGroup(); + final List existGroups = fNode.get().getGroup() != null + ? fNode.get().getGroup() : Collections. emptyList(); /* Add all existed groups paths - no updated paths has to be removed */ for (final Group group : existGroups) { if (deviceGroupKeys.remove(group.getKey())) { diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitMeter.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitMeter.java index e2ae7637c6..9c9de59a6a 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitMeter.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitMeter.java @@ -151,7 +151,7 @@ public class StatListenCommitMeter extends StatAbstractListenCommit existMeters = fNode.get().getMeter().isEmpty() - ? Collections. emptyList() : fNode.get().getMeter(); + final List existMeters = fNode.get().getMeter() != null + ? fNode.get().getMeter() : Collections. emptyList(); /* Add all existed groups paths - no updated paths has to be removed */ for (final Meter meter : existMeters) { if (deviceMeterKeys.remove(meter.getKey())) { diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitQueue.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitQueue.java index 29fe5d8e5e..e336f01874 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitQueue.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitQueue.java @@ -142,7 +142,7 @@ public class StatListenCommitQueue extends StatAbstractListenCommit nodeConnectorIdent = nodeIdent.child(NodeConnector.class, key); final InstanceIdentifier nodeConnStatIdent = nodeConnectorIdent .augmentation(FlowCapableNodeConnectorStatisticsData.class); + final InstanceIdentifier flowCapNodeConnStatIdent = + nodeConnStatIdent.child(FlowCapableNodeConnectorStatistics.class); Optional fNodeConector; try { fNodeConector = tx.read(LogicalDatastoreType.OPERATIONAL, nodeConnectorIdent).checkedGet(); @@ -140,7 +143,9 @@ public class StatNotifyCommitPort extends StatAbstractNotifyCommit tStatIdent = fNodeIdent - .child(Table.class, new TableKey(tableStat.getTableId().getValue())) + final InstanceIdentifier
      tableIdent = fNodeIdent + .child(Table.class, new TableKey(tableStat.getTableId().getValue())); + final Table table = new TableBuilder().setId(tableStat.getTableId().getValue()).build(); + trans.merge(LogicalDatastoreType.OPERATIONAL, tableIdent, table); + final InstanceIdentifier tableStatIdent = tableIdent .augmentation(FlowTableStatisticsData.class); - trans.put(LogicalDatastoreType.OPERATIONAL, tStatIdent, stats, true); + trans.merge(LogicalDatastoreType.OPERATIONAL, tableStatIdent, new FlowTableStatisticsDataBuilder().build()); + + final FlowTableStatistics stats = new FlowTableStatisticsBuilder(tableStat).build(); + final InstanceIdentifier tStatIdent = tableStatIdent.child(FlowTableStatistics.class); + trans.put(LogicalDatastoreType.OPERATIONAL, tStatIdent, stats); } } } diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatRpcMsgManagerImpl.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatRpcMsgManagerImpl.java index 8058554840..e53f494129 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatRpcMsgManagerImpl.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatRpcMsgManagerImpl.java @@ -15,10 +15,8 @@ import java.util.concurrent.Future; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; import org.opendaylight.controller.md.statistics.manager.StatRpcMsgManager; import org.opendaylight.controller.md.statistics.manager.StatisticsManager; -import org.opendaylight.controller.md.statistics.manager.StatisticsManager.StatDataStoreOperation; import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey; @@ -86,7 +84,6 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager { private final long maxLifeForRequest = 50; /* 50 second */ private final int queueCapacity = 5000; - private final StatisticsManager manager; private final OpendaylightGroupStatisticsService groupStatsService; private final OpendaylightMeterStatisticsService meterStatsService; @@ -101,7 +98,7 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager { public StatRpcMsgManagerImpl (final StatisticsManager manager, final RpcConsumerRegistry rpcRegistry, final long minReqNetMonitInt) { - this.manager = Preconditions.checkNotNull(manager, "StatisticManager can not be null!"); + Preconditions.checkArgument(manager != null, "StatisticManager can not be null!"); Preconditions.checkArgument(rpcRegistry != null, "RpcConsumerRegistry can not be null !"); groupStatsService = Preconditions.checkNotNull( rpcRegistry.getRpcService(OpendaylightGroupStatisticsService.class), @@ -322,30 +319,26 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager { @Override public void getAggregateFlowStat(final NodeRef nodeRef, final TableId tableId) { - - manager.enqueue(new StatDataStoreOperation() { + Preconditions.checkArgument(nodeRef != null, "NodeRef can not be null!"); + Preconditions.checkArgument(tableId != null, "TableId can not be null!"); + final RpcJobsQueue getAggregateFlowStat = new RpcJobsQueue() { @Override - public void applyOperation(final ReadWriteTransaction tx) { - final RpcJobsQueue getAggregateFlowStat = new RpcJobsQueue() { - @Override - public Void call() throws Exception { - final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder builder = - new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder(); - builder.setNode(nodeRef); - builder.setTableId(tableId); - - final TableBuilder tbuilder = new TableBuilder(); - tbuilder.setId(tableId.getValue()); - tbuilder.setKey(new TableKey(tableId.getValue())); - registrationRpcFutureCallBack(flowStatsService - .getAggregateFlowStatisticsFromFlowTableForAllFlows(builder.build()), tbuilder.build(), nodeRef); - return null; - } - }; - addGetAllStatJob(getAggregateFlowStat); + public Void call() throws Exception { + final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder builder = + new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder(); + builder.setNode(nodeRef); + builder.setTableId(tableId); + + final TableBuilder tbuilder = new TableBuilder(); + tbuilder.setId(tableId.getValue()); + tbuilder.setKey(new TableKey(tableId.getValue())); + registrationRpcFutureCallBack(flowStatsService + .getAggregateFlowStatisticsFromFlowTableForAllFlows(builder.build()), tbuilder.build(), nodeRef); + return null; } - }); + }; + addGetAllStatJob(getAggregateFlowStat); } @Override diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatisticsManagerImpl.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatisticsManagerImpl.java index 8430549be1..0f8030f620 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatisticsManagerImpl.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatisticsManagerImpl.java @@ -22,7 +22,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; import org.opendaylight.controller.md.sal.common.api.data.TransactionChain; -import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; import org.opendaylight.controller.md.statistics.manager.StatListeningCommiter; import org.opendaylight.controller.md.statistics.manager.StatNodeRegistration; import org.opendaylight.controller.md.statistics.manager.StatNotifyCommiter; @@ -68,8 +67,8 @@ public class StatisticsManagerImpl implements StatisticsManager, Runnable { private final static Logger LOG = LoggerFactory.getLogger(StatisticsManagerImpl.class); - private static final int QUEUE_DEPTH = 500; - private static final int MAX_BATCH = 1; + private static final int QUEUE_DEPTH = 5000; + private static final int MAX_BATCH = 100; private final BlockingQueue dataStoreOperQueue = new LinkedBlockingDeque<>(QUEUE_DEPTH); @@ -205,31 +204,22 @@ public class StatisticsManagerImpl implements StatisticsManager, Runnable { LOG.trace("Processed {} operations, submitting transaction {}", ops, tx.getIdentifier()); - try { tx.submit().checkedGet(); - } catch (final TransactionCommitFailedException e) { - LOG.warn("Stat DataStoreOperation unexpected State!", e); - txChain.close(); - txChain = dataBroker.createTransactionChain(StatisticsManagerImpl.this); - cleanDataStoreOperQueue(); - } - } - catch (final IllegalStateException e) { - LOG.warn("Stat DataStoreOperation unexpected State!", e); - } - catch (final InterruptedException e) { + } catch (final InterruptedException e) { LOG.warn("Stat Manager DS Operation thread interupted!", e); finishing = true; - } - catch (final Exception e) { - LOG.warn("Stat DataStore Operation executor fail!", e); + } catch (final Exception e) { + LOG.warn("Unhandled exception during processing statistics. Restarting transaction chain.", e); + txChain.close(); + txChain = dataBroker.createTransactionChain(StatisticsManagerImpl.this); + cleanDataStoreOperQueue(); } } // Drain all events, making sure any blocked threads are unblocked cleanDataStoreOperQueue(); } - private void cleanDataStoreOperQueue() { + private synchronized void cleanDataStoreOperQueue() { // Drain all events, making sure any blocked threads are unblocked while (! dataStoreOperQueue.isEmpty()) { dataStoreOperQueue.poll(); @@ -240,9 +230,6 @@ public class StatisticsManagerImpl implements StatisticsManager, Runnable { public void onTransactionChainFailed(final TransactionChain chain, final AsyncTransaction transaction, final Throwable cause) { LOG.warn("Failed to export Flow Capable Statistics, Transaction {} failed.",transaction.getIdentifier(),cause); - txChain.close(); - txChain = dataBroker.createTransactionChain(StatisticsManagerImpl.this); - cleanDataStoreOperQueue(); } @Override @@ -294,6 +281,8 @@ public class StatisticsManagerImpl implements StatisticsManager, Runnable { @Override public void disconnectedNodeUnregistration(final InstanceIdentifier nodeIdent) { + flowListeningCommiter.cleanForDisconnect(nodeIdent); + for (final StatPermCollector collector : statCollectors) { if (collector.disconnectedNodeUnregistration(nodeIdent)) { if ( ! collector.hasActiveNodes()) { diff --git a/opendaylight/md-sal/topology-lldp-discovery/pom.xml b/opendaylight/md-sal/topology-lldp-discovery/pom.xml index 97ed15df19..e6a9a75337 100644 --- a/opendaylight/md-sal/topology-lldp-discovery/pom.xml +++ b/opendaylight/md-sal/topology-lldp-discovery/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT ../ org.opendaylight.controller.md diff --git a/opendaylight/md-sal/topology-manager/pom.xml b/opendaylight/md-sal/topology-manager/pom.xml index 57313d2948..bfef646da1 100644 --- a/opendaylight/md-sal/topology-manager/pom.xml +++ b/opendaylight/md-sal/topology-manager/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller sal-parent - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT org.opendaylight.controller.md topology-manager diff --git a/opendaylight/netconf/config-netconf-connector/pom.xml b/opendaylight/netconf/config-netconf-connector/pom.xml index 8a29139854..edba4e11da 100644 --- a/opendaylight/netconf/config-netconf-connector/pom.xml +++ b/opendaylight/netconf/config-netconf-connector/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT config-netconf-connector bundle diff --git a/opendaylight/netconf/config-persister-impl/pom.xml b/opendaylight/netconf/config-persister-impl/pom.xml index 2e2b622bd2..2b297fbadd 100644 --- a/opendaylight/netconf/config-persister-impl/pom.xml +++ b/opendaylight/netconf/config-persister-impl/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../ config-persister-impl diff --git a/opendaylight/netconf/ietf-netconf-monitoring-extension/pom.xml b/opendaylight/netconf/ietf-netconf-monitoring-extension/pom.xml index 330bcc8796..33e4ef0050 100644 --- a/opendaylight/netconf/ietf-netconf-monitoring-extension/pom.xml +++ b/opendaylight/netconf/ietf-netconf-monitoring-extension/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ietf-netconf-monitoring-extension bundle diff --git a/opendaylight/netconf/ietf-netconf-monitoring/pom.xml b/opendaylight/netconf/ietf-netconf-monitoring/pom.xml index 8d4b99bf03..5a6c66b95c 100644 --- a/opendaylight/netconf/ietf-netconf-monitoring/pom.xml +++ b/opendaylight/netconf/ietf-netconf-monitoring/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ietf-netconf-monitoring bundle diff --git a/opendaylight/netconf/netconf-api/pom.xml b/opendaylight/netconf/netconf-api/pom.xml index a15047224b..c5fd8f1894 100644 --- a/opendaylight/netconf/netconf-api/pom.xml +++ b/opendaylight/netconf/netconf-api/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT netconf-api bundle diff --git a/opendaylight/netconf/netconf-auth/pom.xml b/opendaylight/netconf/netconf-auth/pom.xml index e19359adb8..6f1fafff40 100644 --- a/opendaylight/netconf/netconf-auth/pom.xml +++ b/opendaylight/netconf/netconf-auth/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../ netconf-auth diff --git a/opendaylight/netconf/netconf-cli/pom.xml b/opendaylight/netconf/netconf-cli/pom.xml index 55a8715000..c292d93206 100644 --- a/opendaylight/netconf/netconf-cli/pom.xml +++ b/opendaylight/netconf/netconf-cli/pom.xml @@ -10,7 +10,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT netconf-cli jar diff --git a/opendaylight/netconf/netconf-client/pom.xml b/opendaylight/netconf/netconf-client/pom.xml index 6bb67d0681..7fbb54165c 100644 --- a/opendaylight/netconf/netconf-client/pom.xml +++ b/opendaylight/netconf/netconf-client/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT netconf-client bundle diff --git a/opendaylight/netconf/netconf-config/pom.xml b/opendaylight/netconf/netconf-config/pom.xml index db5d14d75a..77551f7080 100644 --- a/opendaylight/netconf/netconf-config/pom.xml +++ b/opendaylight/netconf/netconf-config/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT netconf-config Configuration files for netconf diff --git a/opendaylight/netconf/netconf-connector-config/pom.xml b/opendaylight/netconf/netconf-connector-config/pom.xml index d9cc5eab43..f4e6e99ea0 100644 --- a/opendaylight/netconf/netconf-connector-config/pom.xml +++ b/opendaylight/netconf/netconf-connector-config/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT netconf-connector-config Configuration files for netconf-connector diff --git a/opendaylight/netconf/netconf-impl/pom.xml b/opendaylight/netconf/netconf-impl/pom.xml index c6544466d4..a987ceefc8 100644 --- a/opendaylight/netconf/netconf-impl/pom.xml +++ b/opendaylight/netconf/netconf-impl/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT netconf-impl bundle diff --git a/opendaylight/netconf/netconf-it/pom.xml b/opendaylight/netconf/netconf-it/pom.xml index 3a70a399bb..b2c5c4c8f7 100644 --- a/opendaylight/netconf/netconf-it/pom.xml +++ b/opendaylight/netconf/netconf-it/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT netconf-it diff --git a/opendaylight/netconf/netconf-mapping-api/pom.xml b/opendaylight/netconf/netconf-mapping-api/pom.xml index 1a510f939c..7d51f6db99 100644 --- a/opendaylight/netconf/netconf-mapping-api/pom.xml +++ b/opendaylight/netconf/netconf-mapping-api/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT netconf-mapping-api diff --git a/opendaylight/netconf/netconf-monitoring/pom.xml b/opendaylight/netconf/netconf-monitoring/pom.xml index 03193b8492..22c61954c3 100644 --- a/opendaylight/netconf/netconf-monitoring/pom.xml +++ b/opendaylight/netconf/netconf-monitoring/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT netconf-monitoring bundle diff --git a/opendaylight/netconf/netconf-netty-util/pom.xml b/opendaylight/netconf/netconf-netty-util/pom.xml index cb8461a299..e2afcc42f5 100644 --- a/opendaylight/netconf/netconf-netty-util/pom.xml +++ b/opendaylight/netconf/netconf-netty-util/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT netconf-netty-util bundle diff --git a/opendaylight/netconf/netconf-ssh/pom.xml b/opendaylight/netconf/netconf-ssh/pom.xml index 6dd23776ce..221626b741 100644 --- a/opendaylight/netconf/netconf-ssh/pom.xml +++ b/opendaylight/netconf/netconf-ssh/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../ netconf-ssh diff --git a/opendaylight/netconf/netconf-tcp/pom.xml b/opendaylight/netconf/netconf-tcp/pom.xml index 3c4ee4728d..8ec33286a7 100644 --- a/opendaylight/netconf/netconf-tcp/pom.xml +++ b/opendaylight/netconf/netconf-tcp/pom.xml @@ -11,7 +11,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../ netconf-tcp diff --git a/opendaylight/netconf/netconf-testtool/pom.xml b/opendaylight/netconf/netconf-testtool/pom.xml index ae0bb76832..c9de92b9d5 100644 --- a/opendaylight/netconf/netconf-testtool/pom.xml +++ b/opendaylight/netconf/netconf-testtool/pom.xml @@ -14,7 +14,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT netconf-testtool diff --git a/opendaylight/netconf/netconf-usermanager/pom.xml b/opendaylight/netconf/netconf-usermanager/pom.xml index f8c3e5a504..44e6c61472 100644 --- a/opendaylight/netconf/netconf-usermanager/pom.xml +++ b/opendaylight/netconf/netconf-usermanager/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT ../ netconf-usermanager diff --git a/opendaylight/netconf/netconf-util/pom.xml b/opendaylight/netconf/netconf-util/pom.xml index bed58beb0f..de9b2a0a06 100644 --- a/opendaylight/netconf/netconf-util/pom.xml +++ b/opendaylight/netconf/netconf-util/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT netconf-util bundle diff --git a/opendaylight/netconf/pom.xml b/opendaylight/netconf/pom.xml index 8abf67ec8c..2bb6a20035 100644 --- a/opendaylight/netconf/pom.xml +++ b/opendaylight/netconf/pom.xml @@ -5,12 +5,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../commons/opendaylight netconf-subsystem - 0.2.5-SNAPSHOT + 0.3.0-SNAPSHOT pom ${project.artifactId} diff --git a/opendaylight/networkconfiguration/neutron/implementation/pom.xml b/opendaylight/networkconfiguration/neutron/implementation/pom.xml index c8f1dd270d..a9061d57d1 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/pom.xml +++ b/opendaylight/networkconfiguration/neutron/implementation/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../../commons/opendaylight networkconfig.neutron.implementation - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle 1.26.2 diff --git a/opendaylight/networkconfiguration/neutron/pom.xml b/opendaylight/networkconfiguration/neutron/pom.xml index 998dd4488c..75ab2816cc 100644 --- a/opendaylight/networkconfiguration/neutron/pom.xml +++ b/opendaylight/networkconfiguration/neutron/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight networkconfig.neutron - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle 1.26.2 diff --git a/opendaylight/northbound/archetype-app-northbound/pom.xml b/opendaylight/northbound/archetype-app-northbound/pom.xml index 558bf41915..67c111f94d 100644 --- a/opendaylight/northbound/archetype-app-northbound/pom.xml +++ b/opendaylight/northbound/archetype-app-northbound/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller app-northbound - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT maven-archetype app-northbound diff --git a/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/pom.xml b/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/pom.xml index da1bd41192..adb0c98705 100644 --- a/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/pom.xml +++ b/opendaylight/northbound/archetype-app-northbound/src/main/resources/archetype-resources/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight diff --git a/opendaylight/northbound/bundlescanner/api/pom.xml b/opendaylight/northbound/bundlescanner/api/pom.xml index ee83c93580..78bfd38579 100644 --- a/opendaylight/northbound/bundlescanner/api/pom.xml +++ b/opendaylight/northbound/bundlescanner/api/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../../commons/opendaylight bundlescanner - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/northbound/bundlescanner/implementation/pom.xml b/opendaylight/northbound/bundlescanner/implementation/pom.xml index c06f8b4215..5694b2adcf 100644 --- a/opendaylight/northbound/bundlescanner/implementation/pom.xml +++ b/opendaylight/northbound/bundlescanner/implementation/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../../commons/opendaylight bundlescanner.implementation - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/northbound/commons/pom.xml b/opendaylight/northbound/commons/pom.xml index cbc1f0c328..9d229e4e70 100644 --- a/opendaylight/northbound/commons/pom.xml +++ b/opendaylight/northbound/commons/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight commons.northbound - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/northbound/connectionmanager/pom.xml b/opendaylight/northbound/connectionmanager/pom.xml index ad315ac008..893dcd14f3 100644 --- a/opendaylight/northbound/connectionmanager/pom.xml +++ b/opendaylight/northbound/connectionmanager/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight connectionmanager.northbound - 0.1.2-SNAPSHOT + 0.2.0-SNAPSHOT bundle diff --git a/opendaylight/northbound/containermanager/pom.xml b/opendaylight/northbound/containermanager/pom.xml index 2e6bb7d40c..74fd115dee 100644 --- a/opendaylight/northbound/containermanager/pom.xml +++ b/opendaylight/northbound/containermanager/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight containermanager.northbound - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/northbound/controllermanager/pom.xml b/opendaylight/northbound/controllermanager/pom.xml index 89d2b99cad..33f9a06246 100644 --- a/opendaylight/northbound/controllermanager/pom.xml +++ b/opendaylight/northbound/controllermanager/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight controllermanager.northbound - 0.0.2-SNAPSHOT + 0.1.0-SNAPSHOT bundle diff --git a/opendaylight/northbound/flowprogrammer/pom.xml b/opendaylight/northbound/flowprogrammer/pom.xml index 43797f5c65..083a7a2cb8 100644 --- a/opendaylight/northbound/flowprogrammer/pom.xml +++ b/opendaylight/northbound/flowprogrammer/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight flowprogrammer.northbound - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/northbound/hosttracker/pom.xml b/opendaylight/northbound/hosttracker/pom.xml index c8415f8b4f..3cd3f36be0 100644 --- a/opendaylight/northbound/hosttracker/pom.xml +++ b/opendaylight/northbound/hosttracker/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight hosttracker.northbound - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/northbound/httpservice-bridge/pom.xml b/opendaylight/northbound/httpservice-bridge/pom.xml index c7b9cfc9a0..deeabd9d00 100644 --- a/opendaylight/northbound/httpservice-bridge/pom.xml +++ b/opendaylight/northbound/httpservice-bridge/pom.xml @@ -5,12 +5,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight httpservice-bridge - 0.0.2-SNAPSHOT + 0.1.0-SNAPSHOT bundle HttpService bridge web application diff --git a/opendaylight/northbound/integrationtest/pom.xml b/opendaylight/northbound/integrationtest/pom.xml index 6f0d897f99..df0d1139af 100644 --- a/opendaylight/northbound/integrationtest/pom.xml +++ b/opendaylight/northbound/integrationtest/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.integrationtest - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ../../commons/integrationtest northbound.integrationtest - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT ch.qos.logback diff --git a/opendaylight/northbound/java-client/pom.xml b/opendaylight/northbound/java-client/pom.xml index ae8924feb6..a4bcde461e 100644 --- a/opendaylight/northbound/java-client/pom.xml +++ b/opendaylight/northbound/java-client/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight northbound.client - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT pom diff --git a/opendaylight/northbound/jolokia/pom.xml b/opendaylight/northbound/jolokia/pom.xml index 62af41ab46..07e3a7d36b 100644 --- a/opendaylight/northbound/jolokia/pom.xml +++ b/opendaylight/northbound/jolokia/pom.xml @@ -5,12 +5,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight jolokia-bridge - 0.0.2-SNAPSHOT + 0.1.0-SNAPSHOT bundle Jolokia bridge web application diff --git a/opendaylight/northbound/networkconfiguration/bridgedomain/pom.xml b/opendaylight/northbound/networkconfiguration/bridgedomain/pom.xml index f112978080..8b552ba25a 100644 --- a/opendaylight/northbound/networkconfiguration/bridgedomain/pom.xml +++ b/opendaylight/northbound/networkconfiguration/bridgedomain/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../../commons/opendaylight networkconfig.bridgedomain.northbound - 0.0.3-SNAPSHOT + 0.1.0-SNAPSHOT bundle diff --git a/opendaylight/northbound/networkconfiguration/neutron/pom.xml b/opendaylight/northbound/networkconfiguration/neutron/pom.xml index 19bcfe44ec..8111e69c19 100644 --- a/opendaylight/northbound/networkconfiguration/neutron/pom.xml +++ b/opendaylight/northbound/networkconfiguration/neutron/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../../commons/opendaylight networkconfig.neutron.northbound - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/northbound/staticrouting/pom.xml b/opendaylight/northbound/staticrouting/pom.xml index 83f8191e02..761f1f08e9 100644 --- a/opendaylight/northbound/staticrouting/pom.xml +++ b/opendaylight/northbound/staticrouting/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight forwarding.staticrouting.northbound - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/northbound/statistics/pom.xml b/opendaylight/northbound/statistics/pom.xml index 7e2919bc44..4ae3d8746c 100644 --- a/opendaylight/northbound/statistics/pom.xml +++ b/opendaylight/northbound/statistics/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight statistics.northbound - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/northbound/subnets/pom.xml b/opendaylight/northbound/subnets/pom.xml index 630221fcc2..1efb974b51 100644 --- a/opendaylight/northbound/subnets/pom.xml +++ b/opendaylight/northbound/subnets/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight subnets.northbound - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/northbound/swagger-ui/pom.xml b/opendaylight/northbound/swagger-ui/pom.xml index 18eaed98ec..bbb80a7811 100644 --- a/opendaylight/northbound/swagger-ui/pom.xml +++ b/opendaylight/northbound/swagger-ui/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight swagger-ui - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT bundle diff --git a/opendaylight/northbound/switchmanager/pom.xml b/opendaylight/northbound/switchmanager/pom.xml index 614ec88476..1b876f4420 100644 --- a/opendaylight/northbound/switchmanager/pom.xml +++ b/opendaylight/northbound/switchmanager/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight switchmanager.northbound - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/northbound/topology/pom.xml b/opendaylight/northbound/topology/pom.xml index 3f1a770110..270148420c 100644 --- a/opendaylight/northbound/topology/pom.xml +++ b/opendaylight/northbound/topology/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight topology.northbound - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/northbound/usermanager/pom.xml b/opendaylight/northbound/usermanager/pom.xml index c7ab2fa712..fe32bcf5d3 100644 --- a/opendaylight/northbound/usermanager/pom.xml +++ b/opendaylight/northbound/usermanager/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight usermanager.northbound - 0.0.2-SNAPSHOT + 0.1.0-SNAPSHOT bundle diff --git a/opendaylight/northboundtest/unit_test_suite/pom.xml b/opendaylight/northboundtest/unit_test_suite/pom.xml index 5a0f5f3254..11c885db30 100644 --- a/opendaylight/northboundtest/unit_test_suite/pom.xml +++ b/opendaylight/northboundtest/unit_test_suite/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.0-SNAPSHOT + 1.5.0-SNAPSHOT ../../../opendaylight/commons/opendaylight @@ -16,7 +16,7 @@ org.opendaylight.controller northboundtest - 0.4.0-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/protocol_plugins/openflow/pom.xml b/opendaylight/protocol_plugins/openflow/pom.xml index a8fceec2bf..16fadee1cc 100644 --- a/opendaylight/protocol_plugins/openflow/pom.xml +++ b/opendaylight/protocol_plugins/openflow/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight protocol_plugins.openflow - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/protocol_plugins/stub/pom.xml b/opendaylight/protocol_plugins/stub/pom.xml index 540c9afb2c..4c7b8965fb 100644 --- a/opendaylight/protocol_plugins/stub/pom.xml +++ b/opendaylight/protocol_plugins/stub/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight protocol_plugins.stub - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/routing/dijkstra_implementation/pom.xml b/opendaylight/routing/dijkstra_implementation/pom.xml index b691308e97..b1b68b8cb7 100644 --- a/opendaylight/routing/dijkstra_implementation/pom.xml +++ b/opendaylight/routing/dijkstra_implementation/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight routing.dijkstra_implementation - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/sal/api/pom.xml b/opendaylight/sal/api/pom.xml index 3ee239a0f4..50ac61fccb 100644 --- a/opendaylight/sal/api/pom.xml +++ b/opendaylight/sal/api/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight sal - 0.8.1-SNAPSHOT + 0.9.0-SNAPSHOT bundle diff --git a/opendaylight/sal/connection/api/pom.xml b/opendaylight/sal/connection/api/pom.xml index b194f76a45..780631791d 100644 --- a/opendaylight/sal/connection/api/pom.xml +++ b/opendaylight/sal/connection/api/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../../commons/opendaylight sal.connection - 0.1.2-SNAPSHOT + 0.2.0-SNAPSHOT bundle diff --git a/opendaylight/sal/connection/implementation/pom.xml b/opendaylight/sal/connection/implementation/pom.xml index 7150683597..a7d5dfafb9 100644 --- a/opendaylight/sal/connection/implementation/pom.xml +++ b/opendaylight/sal/connection/implementation/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../../commons/opendaylight sal.connection.implementation - 0.1.2-SNAPSHOT + 0.2.0-SNAPSHOT bundle diff --git a/opendaylight/sal/implementation/pom.xml b/opendaylight/sal/implementation/pom.xml index 88986dcdd0..3f1aa86be8 100644 --- a/opendaylight/sal/implementation/pom.xml +++ b/opendaylight/sal/implementation/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight sal.implementation - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/sal/networkconfiguration/api/pom.xml b/opendaylight/sal/networkconfiguration/api/pom.xml index 5b2269ae6d..4b18349745 100644 --- a/opendaylight/sal/networkconfiguration/api/pom.xml +++ b/opendaylight/sal/networkconfiguration/api/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../../commons/opendaylight sal.networkconfiguration - 0.0.3-SNAPSHOT + 0.1.0-SNAPSHOT bundle diff --git a/opendaylight/sal/networkconfiguration/implementation/pom.xml b/opendaylight/sal/networkconfiguration/implementation/pom.xml index 508c9bd3f5..bf476a924a 100644 --- a/opendaylight/sal/networkconfiguration/implementation/pom.xml +++ b/opendaylight/sal/networkconfiguration/implementation/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../../commons/opendaylight sal.networkconfiguration.implementation - 0.0.3-SNAPSHOT + 0.1.0-SNAPSHOT bundle diff --git a/opendaylight/samples/clustersession/pom.xml b/opendaylight/samples/clustersession/pom.xml index f72e47b283..10ae20ca63 100644 --- a/opendaylight/samples/clustersession/pom.xml +++ b/opendaylight/samples/clustersession/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight org.opendaylight.controller clustersession - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT bundle @@ -43,7 +43,7 @@ org.opendaylight.controller clustering.services - 0.5.1-SNAPSHOT + 0.6.0-SNAPSHOT org.slf4j diff --git a/opendaylight/samples/loadbalancer/pom.xml b/opendaylight/samples/loadbalancer/pom.xml index 7939083891..a7b41096d7 100644 --- a/opendaylight/samples/loadbalancer/pom.xml +++ b/opendaylight/samples/loadbalancer/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight samples.loadbalancer - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT bundle diff --git a/opendaylight/samples/northbound/loadbalancer/pom.xml b/opendaylight/samples/northbound/loadbalancer/pom.xml index d39241757f..18aa4e1d62 100644 --- a/opendaylight/samples/northbound/loadbalancer/pom.xml +++ b/opendaylight/samples/northbound/loadbalancer/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../../commons/opendaylight samples.loadbalancer.northbound - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/samples/simpleforwarding/pom.xml b/opendaylight/samples/simpleforwarding/pom.xml index 1208506bd5..50410f85af 100644 --- a/opendaylight/samples/simpleforwarding/pom.xml +++ b/opendaylight/samples/simpleforwarding/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight samples.simpleforwarding - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/security/pom.xml b/opendaylight/security/pom.xml index 896e7184b2..49889de7f1 100644 --- a/opendaylight/security/pom.xml +++ b/opendaylight/security/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../commons/opendaylight security - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/statisticsmanager/api/pom.xml b/opendaylight/statisticsmanager/api/pom.xml index aa9b88e1b2..23edfa3991 100644 --- a/opendaylight/statisticsmanager/api/pom.xml +++ b/opendaylight/statisticsmanager/api/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight statisticsmanager - 0.5.1-SNAPSHOT + 0.6.0-SNAPSHOT bundle diff --git a/opendaylight/statisticsmanager/implementation/pom.xml b/opendaylight/statisticsmanager/implementation/pom.xml index 10abb3d251..08db43a0f0 100644 --- a/opendaylight/statisticsmanager/implementation/pom.xml +++ b/opendaylight/statisticsmanager/implementation/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight statisticsmanager.implementation - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/statisticsmanager/integrationtest/pom.xml b/opendaylight/statisticsmanager/integrationtest/pom.xml index 2946e698fe..22696b71e6 100644 --- a/opendaylight/statisticsmanager/integrationtest/pom.xml +++ b/opendaylight/statisticsmanager/integrationtest/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.integrationtest - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ../../commons/integrationtest statisticsmanager.integrationtest - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT ../implementation/target/jacoco-it.exec diff --git a/opendaylight/switchmanager/api/pom.xml b/opendaylight/switchmanager/api/pom.xml index 94ba0216cc..a29341ee6f 100644 --- a/opendaylight/switchmanager/api/pom.xml +++ b/opendaylight/switchmanager/api/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight switchmanager - 0.7.1-SNAPSHOT + 0.8.0-SNAPSHOT bundle diff --git a/opendaylight/switchmanager/implementation/pom.xml b/opendaylight/switchmanager/implementation/pom.xml index a0718db48a..fe7a0c0bcb 100644 --- a/opendaylight/switchmanager/implementation/pom.xml +++ b/opendaylight/switchmanager/implementation/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight switchmanager.implementation - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/switchmanager/integrationtest/pom.xml b/opendaylight/switchmanager/integrationtest/pom.xml index 4a8d93f3b3..708ac32763 100644 --- a/opendaylight/switchmanager/integrationtest/pom.xml +++ b/opendaylight/switchmanager/integrationtest/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.integrationtest - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ../../commons/integrationtest switchmanager.integrationtest - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT ../implementation/target/jacoco-it.exec diff --git a/opendaylight/topologymanager/implementation/pom.xml b/opendaylight/topologymanager/implementation/pom.xml index 746135891e..430dfca74d 100644 --- a/opendaylight/topologymanager/implementation/pom.xml +++ b/opendaylight/topologymanager/implementation/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight topologymanager - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/topologymanager/integrationtest/pom.xml b/opendaylight/topologymanager/integrationtest/pom.xml index e278ecffd9..ce6422c8c1 100644 --- a/opendaylight/topologymanager/integrationtest/pom.xml +++ b/opendaylight/topologymanager/integrationtest/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.integrationtest - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ../../commons/integrationtest topologymanager.integrationtest - 0.4.1-SNAPSHOT + 0.5.0-SNAPSHOT ../implementaiton/target/jacoco-it.exec diff --git a/opendaylight/topologymanager/shell/pom.xml b/opendaylight/topologymanager/shell/pom.xml index 078b55c596..2de8c5c26c 100644 --- a/opendaylight/topologymanager/shell/pom.xml +++ b/opendaylight/topologymanager/shell/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight topologymanager.shell diff --git a/opendaylight/usermanager/api/pom.xml b/opendaylight/usermanager/api/pom.xml index c932a7cb31..e21337242a 100644 --- a/opendaylight/usermanager/api/pom.xml +++ b/opendaylight/usermanager/api/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight usermanager - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/usermanager/implementation/pom.xml b/opendaylight/usermanager/implementation/pom.xml index 9567db0293..d973f670b2 100644 --- a/opendaylight/usermanager/implementation/pom.xml +++ b/opendaylight/usermanager/implementation/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight usermanager.implementation - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/web/brandfragment/pom.xml b/opendaylight/web/brandfragment/pom.xml index 541dbcadfd..25f62f059e 100644 --- a/opendaylight/web/brandfragment/pom.xml +++ b/opendaylight/web/brandfragment/pom.xml @@ -6,7 +6,7 @@ org.opendaylight.controller commons.opendaylight - 1.4.0-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight @@ -17,7 +17,7 @@ org.opendaylight.controller web.brandfragment - 0.4.0-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/web/devices/pom.xml b/opendaylight/web/devices/pom.xml index 8906946423..8e7c9248dd 100644 --- a/opendaylight/web/devices/pom.xml +++ b/opendaylight/web/devices/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight devices.web - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/web/flows/pom.xml b/opendaylight/web/flows/pom.xml index f62c6ac4d4..99238c6aad 100644 --- a/opendaylight/web/flows/pom.xml +++ b/opendaylight/web/flows/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight flows.web - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/web/osgi-brandfragment/pom.xml b/opendaylight/web/osgi-brandfragment/pom.xml index fc04088961..adea8ace62 100644 --- a/opendaylight/web/osgi-brandfragment/pom.xml +++ b/opendaylight/web/osgi-brandfragment/pom.xml @@ -5,12 +5,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight osgi-brandfragment.web - 0.0.2-SNAPSHOT + 0.1.0-SNAPSHOT bundle OSGi management web application brand fragment diff --git a/opendaylight/web/root/pom.xml b/opendaylight/web/root/pom.xml index 6f0a0989b8..cd82f8b07f 100644 --- a/opendaylight/web/root/pom.xml +++ b/opendaylight/web/root/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight web - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/web/topology/pom.xml b/opendaylight/web/topology/pom.xml index e65c19ff84..24b53db767 100644 --- a/opendaylight/web/topology/pom.xml +++ b/opendaylight/web/topology/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight topology.web - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/opendaylight/web/troubleshoot/pom.xml b/opendaylight/web/troubleshoot/pom.xml index b66889284d..14817bd186 100644 --- a/opendaylight/web/troubleshoot/pom.xml +++ b/opendaylight/web/troubleshoot/pom.xml @@ -4,12 +4,12 @@ org.opendaylight.controller commons.opendaylight - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT ../../commons/opendaylight troubleshoot.web - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle diff --git a/pom.xml b/pom.xml index 10c05e254f..bb8ad1dbeb 100644 --- a/pom.xml +++ b/pom.xml @@ -4,11 +4,11 @@ org.opendaylight.controller commons.parent - 1.0.2-SNAPSHOT + 1.1.0-SNAPSHOT opendaylight/commons/parent releasepom - 0.1.2-SNAPSHOT + 0.2.0-SNAPSHOT pom 3.0 diff --git a/third-party/commons/thirdparty/pom.xml b/third-party/commons/thirdparty/pom.xml index 3fc3a3bd6a..ad3c27523e 100644 --- a/third-party/commons/thirdparty/pom.xml +++ b/third-party/commons/thirdparty/pom.xml @@ -6,7 +6,7 @@ org.opendaylight.controller commons.thirdparty - 1.1.2-SNAPSHOT + 1.2.0-SNAPSHOT pom scm:git:ssh://git.opendaylight.org:29418/controller.git diff --git a/third-party/ganymed/pom.xml b/third-party/ganymed/pom.xml index f67828bdab..676e2a24f1 100644 --- a/third-party/ganymed/pom.xml +++ b/third-party/ganymed/pom.xml @@ -5,13 +5,13 @@ org.opendaylight.controller commons.thirdparty - 1.1.2-SNAPSHOT + 1.2.0-SNAPSHOT ../commons/thirdparty org.opendaylight.controller.thirdparty ganymed - 1.1-SNAPSHOT + 1.2.0-SNAPSHOT bundle diff --git a/third-party/jersey-servlet/pom.xml b/third-party/jersey-servlet/pom.xml index 7e944c15da..27d503e898 100644 --- a/third-party/jersey-servlet/pom.xml +++ b/third-party/jersey-servlet/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.thirdparty - 1.1.1-SNAPSHOT + 1.2.0-SNAPSHOT ../commons/thirdparty @@ -17,7 +17,7 @@ 4.0.0 org.opendaylight.controller.thirdparty com.sun.jersey.jersey-servlet - 1.18-SNAPSHOT + 1.19.0-SNAPSHOT bundle diff --git a/third-party/net.sf.jung2/pom.xml b/third-party/net.sf.jung2/pom.xml index fe15316023..63455dc8be 100644 --- a/third-party/net.sf.jung2/pom.xml +++ b/third-party/net.sf.jung2/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.thirdparty - 1.1.1-SNAPSHOT + 1.2.0-SNAPSHOT ../commons/thirdparty @@ -17,7 +17,7 @@ 4.0.0 org.opendaylight.controller.thirdparty net.sf.jung2 - 2.0.2-SNAPSHOT + 2.1.0-SNAPSHOT bundle diff --git a/third-party/openflowj/pom.xml b/third-party/openflowj/pom.xml index 8d8724dceb..9e04a70b83 100644 --- a/third-party/openflowj/pom.xml +++ b/third-party/openflowj/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.opendaylight.controller.thirdparty org.openflow.openflowj - 1.0.3-SNAPSHOT + 1.1.0-SNAPSHOT OpenFlow Java A Java implemention of the OpenFlow v1.0 protocol @@ -10,7 +10,7 @@ org.opendaylight.controller commons.thirdparty - 1.1.1-SNAPSHOT + 1.2.0-SNAPSHOT ../commons/thirdparty diff --git a/third-party/org.apache.catalina.filters.CorsFilter/pom.xml b/third-party/org.apache.catalina.filters.CorsFilter/pom.xml index 85e631686e..78996da2cb 100644 --- a/third-party/org.apache.catalina.filters.CorsFilter/pom.xml +++ b/third-party/org.apache.catalina.filters.CorsFilter/pom.xml @@ -4,7 +4,7 @@ org.opendaylight.controller commons.thirdparty - 1.1.1-SNAPSHOT + 1.2.0-SNAPSHOT ../commons/thirdparty @@ -16,7 +16,7 @@ 4.0.0 org.opendaylight.controller.thirdparty org.apache.catalina.filters.CorsFilter - 7.0.43-SNAPSHOT + 7.1.0-SNAPSHOT bundle