Merge "Adding clustering Test App"
authorMoiz Raja <moraja@cisco.com>
Fri, 29 Aug 2014 00:31:18 +0000 (00:31 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 29 Aug 2014 00:31:18 +0000 (00:31 +0000)
14 files changed:
test/tools/odl-mdsal-clustering-tests/clustering-test-app/configuration/20-clustering-test-app.xml [new file with mode: 0644]
test/tools/odl-mdsal-clustering-tests/clustering-test-app/model/pom.xml [new file with mode: 0644]
test/tools/odl-mdsal-clustering-tests/clustering-test-app/model/src/main/yang/car-people.yang [new file with mode: 0644]
test/tools/odl-mdsal-clustering-tests/clustering-test-app/model/src/main/yang/car-purchase.yang [new file with mode: 0644]
test/tools/odl-mdsal-clustering-tests/clustering-test-app/model/src/main/yang/car.yang [new file with mode: 0644]
test/tools/odl-mdsal-clustering-tests/clustering-test-app/model/src/main/yang/people.yang [new file with mode: 0644]
test/tools/odl-mdsal-clustering-tests/clustering-test-app/pom.xml [new file with mode: 0644]
test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/pom.xml [new file with mode: 0644]
test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/listener/PeopleCarListener.java [new file with mode: 0644]
test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PeopleProvider.java [new file with mode: 0644]
test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PurchaseCarProvider.java [new file with mode: 0644]
test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/java/org/opendaylight/controller/config/yang/config/clustering_it_provider/ClusteringItProviderModule.java [new file with mode: 0644]
test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/java/org/opendaylight/controller/config/yang/config/clustering_it_provider/ClusteringItProviderModuleFactory.java [new file with mode: 0644]
test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/yang/clustering-it-provider.yang [new file with mode: 0644]

diff --git a/test/tools/odl-mdsal-clustering-tests/clustering-test-app/configuration/20-clustering-test-app.xml b/test/tools/odl-mdsal-clustering-tests/clustering-test-app/configuration/20-clustering-test-app.xml
new file mode 100644 (file)
index 0000000..f019709
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2013 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
+-->
+<snapshot>
+    <configuration>
+        <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+            <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+                <module>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:clustering-it-provider">
+                        prefix:clustering-it-provider
+                    </type>
+                    <name>clustering-it-provider</name>
+
+                    <rpc-registry>
+                        <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
+                        <name>binding-rpc-broker</name>
+                    </rpc-registry>
+                    <data-broker>
+                        <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
+                        <name>binding-data-broker</name>
+                    </data-broker>
+                    <notification-service>
+                        <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
+                            binding:binding-notification-service
+                        </type>
+                        <name>binding-notification-broker</name>
+                    </notification-service>
+                </module>
+            </modules>
+        </data>
+
+    </configuration>
+
+    <required-capabilities>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:config:clustering-it-provider?module=clustering-it-provider&amp;revision=2014-08-19</capability>
+
+    </required-capabilities>
+
+</snapshot>
+
diff --git a/test/tools/odl-mdsal-clustering-tests/clustering-test-app/model/pom.xml b/test/tools/odl-mdsal-clustering-tests/clustering-test-app/model/pom.xml
new file mode 100644 (file)
index 0000000..7e9f5c1
--- /dev/null
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>clustering-it</artifactId>
+        <groupId>org.opendaylight.controller</groupId>
+        <version>1.1-SNAPSHOT</version>
+    </parent>
+    <artifactId>clustering-it-model</artifactId>
+    <packaging>bundle</packaging>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>${bundle.plugin.version}</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-Name>org.opendaylight.controller.sal-clustering-it-model</Bundle-Name>
+                        <Import-Package>*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-maven-plugin</artifactId>
+                <version>${yangtools.version}</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>generate-sources</goal>
+                        </goals>
+                        <configuration>
+                            <yangFilesRootDir>src/main/yang</yangFilesRootDir>
+                            <codeGenerators>
+                                <generator>
+                                    <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
+                                    <outputBaseDir>target/generated-sources/sal</outputBaseDir>
+                                </generator>
+                            </codeGenerators>
+                            <inspectDependencies>true</inspectDependencies>
+                        </configuration>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.opendaylight.yangtools</groupId>
+                        <artifactId>maven-sal-api-gen-plugin</artifactId>
+                        <version>${yangtools.version}</version>
+                        <type>jar</type>
+                    </dependency>
+                </dependencies>
+            </plugin>
+        </plugins>
+        <pluginManagement>
+            <plugins>
+                <!--This plugin's configuration is used to store Eclipse
+                    m2e settings only. It has no influence on the Maven build itself. -->
+                <plugin>
+                    <groupId>org.eclipse.m2e</groupId>
+                    <artifactId>lifecycle-mapping</artifactId>
+                    <version>1.0.0</version>
+                    <configuration>
+                        <lifecycleMappingMetadata>
+                            <pluginExecutions>
+                                <pluginExecution>
+                                    <pluginExecutionFilter>
+                                        <groupId>org.opendaylight.yangtools</groupId>
+                                        <artifactId>yang-maven-plugin</artifactId>
+                                        <versionRange>[0.5,)</versionRange>
+                                        <goals>
+                                            <goal>generate-sources</goal>
+                                        </goals>
+                                    </pluginExecutionFilter>
+                                    <action>
+                                        <ignore />
+                                    </action>
+                                </pluginExecution>
+                            </pluginExecutions>
+                        </lifecycleMappingMetadata>
+                    </configuration>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-binding</artifactId>
+            <version>${yangtools.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-common</artifactId>
+            <version>${yangtools.version}</version>
+        </dependency>
+        <dependency>
+       <groupId>org.opendaylight.yangtools.model</groupId>
+       <artifactId>ietf-inet-types</artifactId>
+       <version>${ietf-inet-types.version}</version>
+      </dependency>
+      <dependency>
+       <groupId>org.opendaylight.yangtools.model</groupId>
+       <artifactId>ietf-yang-types</artifactId>
+       <version>${ietf-yang-types.version}</version>
+      </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools.model</groupId>
+            <artifactId>yang-ext</artifactId>
+            <version>${yang-ext.version}</version>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/test/tools/odl-mdsal-clustering-tests/clustering-test-app/model/src/main/yang/car-people.yang b/test/tools/odl-mdsal-clustering-tests/clustering-test-app/model/src/main/yang/car-people.yang
new file mode 100644 (file)
index 0000000..8997246
--- /dev/null
@@ -0,0 +1,42 @@
+module car-people {
+
+    yang-version 1;
+
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car-people";
+
+    prefix car;
+
+         import ietf-inet-types { prefix "inet"; revision-date 2010-09-24; }
+         import car { prefix "c"; revision-date 2014-08-18; }
+         import people { prefix "people"; revision-date 2014-08-18; }
+
+    organization "Netconf Central";
+
+    contact
+      "Harman Singh <harmasin@cisco.com>";
+
+    description
+      "YANG model for car for test application";
+
+    revision "2014-08-18" {
+      description
+        "Clustering sample app";
+    }
+
+    container car-people {
+      description
+       "Top-level container for all people car map";
+
+      list car-person {
+        key "car-id person-id";
+        description "A mapping of cars and people.";
+        leaf car-id {
+          type c:car-id;
+        }
+
+        leaf person-id {
+          type people:person-id;
+        }
+      }
+    }
+}
\ No newline at end of file
diff --git a/test/tools/odl-mdsal-clustering-tests/clustering-test-app/model/src/main/yang/car-purchase.yang b/test/tools/odl-mdsal-clustering-tests/clustering-test-app/model/src/main/yang/car-purchase.yang
new file mode 100644 (file)
index 0000000..f6a8797
--- /dev/null
@@ -0,0 +1,60 @@
+module car-purchase {
+
+    yang-version 1;
+
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car-purchase";
+
+    prefix cp;
+
+         import ietf-inet-types { prefix "inet"; revision-date 2010-09-24; }
+         import car { prefix "car"; revision-date 2014-08-18; }
+         import people { prefix "person"; revision-date 2014-08-18; }
+         import yang-ext {prefix "ext"; revision-date "2013-07-09";}
+
+    organization "Netconf Central";
+
+    contact
+      "Harman Singh <harmasin@cisco.com>";
+
+    description
+      "YANG model for car purchase for test application";
+
+    revision "2014-08-18" {
+      description
+        "Clustering sample app";
+    }
+
+    rpc buy-car {
+          description
+            "buy a new car";
+          input {
+            leaf person {
+              ext:context-reference "person:person-context";
+              type person:person-ref;
+              description "A reference to a particular person.";
+            }
+
+            leaf car-id {
+              type car:car-id;
+              description "identifier of car.";
+            }
+            leaf person-id {
+              type person:person-id;
+              description "identifier of person.";
+            }
+          }
+        }
+
+        notification carBought {
+          description
+            "Indicates that a person bought a car.";
+          leaf car-id {
+            type car:car-id;
+            description "identifier of car.";
+          }
+          leaf person-id {
+            type person:person-id;
+            description "identifier of person.";
+          }
+        }
+}
\ No newline at end of file
diff --git a/test/tools/odl-mdsal-clustering-tests/clustering-test-app/model/src/main/yang/car.yang b/test/tools/odl-mdsal-clustering-tests/clustering-test-app/model/src/main/yang/car.yang
new file mode 100644 (file)
index 0000000..d9cfb6b
--- /dev/null
@@ -0,0 +1,64 @@
+module car {
+
+    yang-version 1;
+
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car";
+
+    prefix car;
+
+       import ietf-inet-types { prefix "inet"; revision-date 2010-09-24; }
+       
+    organization "Netconf Central";
+
+    contact
+      "Harman Singh <harmasin@cisco.com>";
+
+    description
+      "YANG model for car for test application";
+
+    revision "2014-08-18" {
+      description
+        "Clustering sample app";
+    }
+    
+    typedef car-id {
+      type inet:uri;
+      description "An identifier for car entry.";
+    }
+
+    grouping car-entry {
+      description "Describes the contents of a car entry -
+                       Details of the car manufacturer, model etc";
+      leaf id {
+        type car-id;
+        description "identifier of single list of entries.";
+      }
+
+      leaf model {
+        type string;
+      }
+      leaf manufacturer {
+        type string;
+      }
+
+      leaf year {
+        type uint32;
+      }
+
+      leaf category {
+        type string;
+      }
+    }
+    
+    container cars {
+      description
+        "Top-level container for all car objects.";
+      list car-entry {
+       key "id";
+       description "A list of cars (as defined by the 'grouping car-entry').";
+       uses car-entry;
+      }
+    }
+
+    
+}
\ No newline at end of file
diff --git a/test/tools/odl-mdsal-clustering-tests/clustering-test-app/model/src/main/yang/people.yang b/test/tools/odl-mdsal-clustering-tests/clustering-test-app/model/src/main/yang/people.yang
new file mode 100644 (file)
index 0000000..6c8f247
--- /dev/null
@@ -0,0 +1,80 @@
+module people {
+
+    yang-version 1;
+
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:people";
+
+    prefix people;
+
+         import ietf-inet-types { prefix "inet"; revision-date 2010-09-24; }
+       
+    organization "Netconf Central";
+
+    contact
+      "Harman Singh <harmasin@cisco.com>";
+
+    description
+      "YANG model for person for test application";
+
+    revision "2014-08-18" {
+      description
+        "Clustering sample app";
+    }
+    
+    typedef person-id {
+      type inet:uri;
+      description "An identifier for person.";
+    }
+
+    typedef person-ref {
+      type instance-identifier;
+      description "A reference that points to an people:people/person in the data tree.";
+    }
+    identity person-context {
+        description "A person-context is a classifier for person elements which allows an RPC to provide a service on behalf of a particular element in the data tree.";
+    }
+
+    grouping person {
+      description "Describes the details of the person";
+
+      leaf id {
+        type person-id;
+        description "identifier of single list of entries.";
+      }
+
+      leaf gender {
+        type string;
+      }
+
+      leaf age {
+        type uint32;
+      }
+
+      leaf address {
+        type string;
+      }
+
+      leaf contactNo {
+        type string;
+      }
+    }
+    
+    container people {
+      description
+        "Top-level container for all people";
+
+      list person {
+       key "id";
+       description "A list of people (as defined by the 'grouping person').";
+       uses person;
+      }
+    }
+
+    rpc add-person {
+      description
+        "Add a person entry into database";
+      input {
+        uses person;
+      }
+    }
+}
\ No newline at end of file
diff --git a/test/tools/odl-mdsal-clustering-tests/clustering-test-app/pom.xml b/test/tools/odl-mdsal-clustering-tests/clustering-test-app/pom.xml
new file mode 100644 (file)
index 0000000..90aa183
--- /dev/null
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+    <groupId>org.opendaylight.controller</groupId>
+      <artifactId>clustering-it</artifactId>
+    <version>1.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  
+   <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
+    <yangtools.version>0.6.2-SNAPSHOT</yangtools.version>
+    <yang-ext.version>2013.09.07.4-SNAPSHOT</yang-ext.version>
+    <bundle.plugin.version>2.3.7</bundle.plugin.version>
+    <sitedeploy>dav:http://nexus.opendaylight.org/content/sites/site</sitedeploy>
+    <java.version.source>1.7</java.version.source>
+    <java.version.target>1.7</java.version.target>
+    <maven.compile.plugin.version>2.5.1</maven.compile.plugin.version>
+    <mdsal.version>1.1-SNAPSHOT</mdsal.version>
+    <equinox.osgi.version>3.8.1.v20120830-144521</equinox.osgi.version>
+    <ietf-inet-types.version>2010.09.24.4-SNAPSHOT</ietf-inet-types.version>
+       <ietf-yang-types.version>2010.09.24.4-SNAPSHOT</ietf-yang-types.version>
+    <spring.version>3.1.3.RELEASE</spring.version>
+       <jackson.version>1.9.10</jackson.version>
+    <jmxGeneratorPath>src/main/yang-gen-config</jmxGeneratorPath>
+    <salGeneratorPath>src/main/yang-gen-sal</salGeneratorPath>
+    <config.version>0.2.5-SNAPSHOT</config.version>
+    <ietf-yang-types.version>2010.09.24.4-SNAPSHOT</ietf-yang-types.version>
+  </properties>
+  
+  <scm>
+      <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
+      <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
+      <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
+      <tag>HEAD</tag>
+  </scm>
+  
+    <pluginRepositories>
+    <!-- OpenDayLight Repo Mirror -->
+    <pluginRepository>
+      <id>opendaylight-mirror</id>
+      <name>opendaylight-mirror</name>
+      <url>${nexusproxy}/groups/public/</url>
+      <snapshots>
+          <enabled>false</enabled>
+      </snapshots>
+      <releases>
+          <enabled>true</enabled>
+          <updatePolicy>never</updatePolicy>
+      </releases>
+    </pluginRepository>
+    <!-- OpenDayLight Snapshot artifact -->
+    <pluginRepository>
+      <id>opendaylight-snapshot</id>
+      <name>opendaylight-snapshot</name>
+      <url>${nexusproxy}/repositories/opendaylight.snapshot/</url>
+      <snapshots>
+          <enabled>true</enabled>
+      </snapshots>
+      <releases>
+          <enabled>false</enabled>
+      </releases>
+    </pluginRepository>
+  </pluginRepositories>
+
+  <repositories>
+    <!-- OpenDayLight Repo Mirror -->
+    <repository>
+      <id>opendaylight-mirror</id>
+      <name>opendaylight-mirror</name>
+      <url>${nexusproxy}/groups/public/</url>
+      <snapshots>
+          <enabled>false</enabled>
+      </snapshots>
+      <releases>
+          <enabled>true</enabled>
+          <updatePolicy>never</updatePolicy>
+      </releases>
+    </repository>
+    <!-- OpenDayLight Snapshot artifact -->
+    <repository>
+      <id>opendaylight-snapshot</id>
+      <name>opendaylight-snapshot</name>
+      <url>${nexusproxy}/repositories/opendaylight.snapshot/</url>
+      <snapshots>
+          <enabled>true</enabled>
+      </snapshots>
+      <releases>
+          <enabled>false</enabled>
+      </releases>
+    </repository>
+  </repositories>
+  
+  <distributionManagement>
+    <!-- OpenDayLight Released artifact -->
+    <repository>
+      <id>opendaylight-release</id>
+      <url>${nexusproxy}/repositories/opendaylight.release/</url>
+    </repository>
+    <!-- OpenDayLight Snapshot artifact -->
+    <snapshotRepository>
+      <id>opendaylight-snapshot</id>
+      <url>${nexusproxy}/repositories/opendaylight.snapshot/</url>
+    </snapshotRepository>
+    <!-- Site deployment -->
+    <site>
+      <id>website</id>
+      <url>${sitedeploy}</url>
+    </site>
+  </distributionManagement>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>${maven.compile.plugin.version}</version>
+          <configuration>
+            <source>${java.version.source}</source>
+            <target>${java.version.target}</target>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+  
+  <modules>
+    <module>model</module>
+    <module>provider</module>
+  </modules>
+</project>
diff --git a/test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/pom.xml b/test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/pom.xml
new file mode 100644 (file)
index 0000000..c0ae514
--- /dev/null
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>clustering-it</artifactId>
+        <groupId>org.opendaylight.controller</groupId>
+        <version>1.1-SNAPSHOT</version>
+    </parent>
+    <artifactId>clustering-it-provider</artifactId>
+    <packaging>bundle</packaging>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>${bundle.plugin.version}</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>org.opendaylight.controller.config.yang.config.clustering_it_provider</Export-Package>
+                        <Import-Package>*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-maven-plugin</artifactId>
+                <version>${yangtools.version}</version>
+                <executions>
+                    <execution>
+                        <id>config</id>
+                        <goals>
+                            <goal>generate-sources</goal>
+                        </goals>
+                        <configuration>
+                            <codeGenerators>
+                                <generator>
+                                    <codeGeneratorClass>org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator</codeGeneratorClass>
+                                    <outputBaseDir>${jmxGeneratorPath}</outputBaseDir>
+                                    <additionalConfiguration>
+                                        <namespaceToPackage1>urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang</namespaceToPackage1>
+                                    </additionalConfiguration>
+                                </generator>
+                                <generator>
+                                    <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
+                                    <outputBaseDir>${salGeneratorPath}</outputBaseDir>
+                                </generator>
+                            </codeGenerators>
+                            <inspectDependencies>true</inspectDependencies>
+                        </configuration>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.opendaylight.controller</groupId>
+                        <artifactId>yang-jmx-generator-plugin</artifactId>
+                        <version>${config.version}</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.opendaylight.yangtools</groupId>
+                        <artifactId>maven-sal-api-gen-plugin</artifactId>
+                        <version>${yangtools.version}</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-clustering-it-model</artifactId>
+            <version>1.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>config-api</artifactId>
+            <version>${config.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-binding-config</artifactId>
+            <version>${mdsal.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-binding-api</artifactId>
+            <version>${mdsal.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-common-util</artifactId>
+            <version>${mdsal.version}</version>
+        </dependency>
+        <dependency>
+          <groupId>equinoxSDK381</groupId>
+          <artifactId>org.eclipse.osgi</artifactId>
+          <version>3.8.1.v20120830-144521</version>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/listener/PeopleCarListener.java b/test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/listener/PeopleCarListener.java
new file mode 100644 (file)
index 0000000..4737d6e
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * 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.clustering.it.listener;
+
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.people.rev140818.CarPeople;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.people.rev140818.car.people.CarPerson;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.people.rev140818.car.people.CarPersonBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.people.rev140818.car.people.CarPersonKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.purchase.rev140818.CarBought;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.purchase.rev140818.CarPurchaseListener;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class PeopleCarListener implements CarPurchaseListener {
+
+  private static final Logger log = LoggerFactory.getLogger(PeopleCarListener.class);
+
+  private DataBroker dataProvider;
+
+
+
+  public void setDataProvider(final DataBroker salDataProvider) {
+    this.dataProvider = salDataProvider;
+  }
+
+  @Override
+  public void onCarBought(CarBought notification) {
+    log.info("onCarBought notification : Adding car person entry");
+
+    final CarPersonBuilder carPersonBuilder = new CarPersonBuilder();
+    carPersonBuilder.setCarId(notification.getCarId());
+    carPersonBuilder.setPersonId(notification.getPersonId());
+    CarPersonKey key = new CarPersonKey(notification.getCarId(), notification.getPersonId());
+    carPersonBuilder.setKey(key);
+    final CarPerson carPerson = carPersonBuilder.build();
+
+    InstanceIdentifier<CarPerson> carPersonIId =
+        InstanceIdentifier.<CarPeople>builder(CarPeople.class).child(CarPerson.class, carPerson.getKey()).build();
+
+
+    WriteTransaction tx = dataProvider.newWriteOnlyTransaction();
+    tx.put(LogicalDatastoreType.CONFIGURATION, carPersonIId, carPerson);
+
+    Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
+      @Override
+      public void onSuccess(final Void result) {
+        log.info("Car bought, entry added to map of people and car [{}]", carPerson);
+      }
+
+      @Override
+      public void onFailure(final Throwable t) {
+        log.info("Car bought, Failed entry addition to map of people and car [{}]", carPerson);
+      }
+    });
+
+  }
+}
diff --git a/test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PeopleProvider.java b/test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PeopleProvider.java
new file mode 100644 (file)
index 0000000..e0d3f75
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * 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.clustering.it.provider;
+
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.SettableFuture;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.purchase.rev140818.CarPurchaseService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.AddPersonInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.People;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.PeopleService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.PersonContext;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.people.Person;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.people.PersonBuilder;
+import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.Future;
+
+public class PeopleProvider implements PeopleService, AutoCloseable {
+
+  private static final Logger log = LoggerFactory.getLogger(PeopleProvider.class);
+
+  private DataBroker dataProvider;
+
+  private BindingAwareBroker.RoutedRpcRegistration<CarPurchaseService> rpcRegistration;
+
+  public void setDataProvider(final DataBroker salDataProvider) {
+    this.dataProvider = salDataProvider;
+  }
+
+
+  public void setRpcRegistration(BindingAwareBroker.RoutedRpcRegistration<CarPurchaseService> rpcRegistration) {
+    this.rpcRegistration = rpcRegistration;
+  }
+
+  @Override
+  public Future<RpcResult<Void>> addPerson(AddPersonInput input) {
+    log.info("RPC addPerson : adding person [{}]", input);
+
+    PersonBuilder builder = new PersonBuilder(input);
+    final Person person = builder.build();
+    final SettableFuture<RpcResult<Void>> futureResult = SettableFuture.create();
+
+    // Each entry will be identifiable by a unique key, we have to create that identifier
+    final InstanceIdentifier.InstanceIdentifierBuilder<Person> personIdBuilder =
+        InstanceIdentifier.<People>builder(People.class)
+            .child(Person.class, person.getKey());
+    final InstanceIdentifier personId = personIdBuilder.build();
+    // Place entry in data store tree
+    WriteTransaction tx = dataProvider.newWriteOnlyTransaction();
+    tx.put(LogicalDatastoreType.CONFIGURATION, personId, person);
+
+    Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
+      @Override
+      public void onSuccess(final Void result) {
+        log.info("RPC addPerson : person added successfully [{}]", person);
+        rpcRegistration.registerPath(PersonContext.class, personId);
+        log.info("RPC addPerson : routed rpc registered for instance ID [{}]", personId);
+        futureResult.set(RpcResultBuilder.<Void>success().build());
+      }
+
+      @Override
+      public void onFailure(final Throwable t) {
+        log.info("RPC addPerson : person addition failed [{}]", person);
+        futureResult.set(RpcResultBuilder.<Void>failed()
+            .withError(RpcError.ErrorType.APPLICATION, t.getMessage()).build());
+      }
+    });
+    return futureResult;
+  }
+
+  @Override
+  public void close() throws Exception {
+
+  }
+}
diff --git a/test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PurchaseCarProvider.java b/test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PurchaseCarProvider.java
new file mode 100644 (file)
index 0000000..74a0aa6
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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.clustering.it.provider;
+
+import com.google.common.util.concurrent.SettableFuture;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.purchase.rev140818.BuyCarInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.purchase.rev140818.CarBoughtBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.purchase.rev140818.CarPurchaseService;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.Future;
+
+
+public class PurchaseCarProvider implements CarPurchaseService, AutoCloseable{
+
+  private static final Logger log = LoggerFactory.getLogger(PurchaseCarProvider.class);
+
+  private NotificationProviderService notificationProvider;
+
+
+  public void setNotificationProvider(final NotificationProviderService salService) {
+    this.notificationProvider = salService;
+  }
+
+
+  @Override
+  public Future<RpcResult<Void>> buyCar(BuyCarInput input) {
+    log.info("Routed RPC buyCar : generating notification for buying car [{}]", input);
+    SettableFuture<RpcResult<Void>> futureResult = SettableFuture.create();
+    CarBoughtBuilder carBoughtBuilder = new CarBoughtBuilder();
+    carBoughtBuilder.setCarId(input.getCarId());
+    carBoughtBuilder.setPersonId(input.getPersonId());
+    notificationProvider.publish(carBoughtBuilder.build());
+    futureResult.set(RpcResultBuilder.<Void>success().build());
+    return futureResult;
+  }
+
+  @Override
+  public void close() throws Exception {
+
+  }
+}
diff --git a/test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/java/org/opendaylight/controller/config/yang/config/clustering_it_provider/ClusteringItProviderModule.java b/test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/java/org/opendaylight/controller/config/yang/config/clustering_it_provider/ClusteringItProviderModule.java
new file mode 100644 (file)
index 0000000..d91d40a
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * 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.config.yang.config.clustering_it_provider;
+
+
+import org.opendaylight.controller.clustering.it.listener.PeopleCarListener;
+import org.opendaylight.controller.clustering.it.provider.PeopleProvider;
+import org.opendaylight.controller.clustering.it.provider.PurchaseCarProvider;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.purchase.rev140818.CarPurchaseService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.PeopleService;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.NotificationListener;
+
+public class ClusteringItProviderModule extends org.opendaylight.controller.config.yang.config.clustering_it_provider.AbstractClusteringItProviderModule {
+    public ClusteringItProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public ClusteringItProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.clustering_it_provider.ClusteringItProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void customValidation() {
+        // add custom validation form module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+      DataBroker dataBrokerService = getDataBrokerDependency();
+      NotificationProviderService notificationProvider = getNotificationServiceDependency();
+
+      // Add routed RPC registration for car purchase
+      final PurchaseCarProvider purchaseCar = new PurchaseCarProvider();
+      purchaseCar.setNotificationProvider(notificationProvider);
+
+      final BindingAwareBroker.RoutedRpcRegistration<CarPurchaseService> purchaseCarRpc = getRpcRegistryDependency()
+          .addRoutedRpcImplementation(CarPurchaseService.class, purchaseCar);
+
+      // Add people provider registration
+      final PeopleProvider people = new PeopleProvider();
+      people.setDataProvider(dataBrokerService);
+
+      people.setRpcRegistration(purchaseCarRpc);
+
+      final BindingAwareBroker.RpcRegistration<PeopleService> peopleRpcReg = getRpcRegistryDependency()
+          .addRpcImplementation(PeopleService.class, people);
+
+
+
+      final PeopleCarListener peopleCarListener = new PeopleCarListener();
+      peopleCarListener.setDataProvider(dataBrokerService);
+
+      final ListenerRegistration<NotificationListener> listenerReg =
+          getNotificationServiceDependency().registerNotificationListener( peopleCarListener );
+
+      // Wrap toaster as AutoCloseable and close registrations to md-sal at
+      // close()
+      final class AutoCloseableToaster implements AutoCloseable {
+
+        @Override
+        public void close() throws Exception {
+          peopleRpcReg.close();
+          purchaseCarRpc.close();
+          people.close();
+          purchaseCar.close();
+          listenerReg.close();
+        }
+      }
+
+      AutoCloseable ret = new AutoCloseableToaster();
+      return ret;
+    }
+
+}
diff --git a/test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/java/org/opendaylight/controller/config/yang/config/clustering_it_provider/ClusteringItProviderModuleFactory.java b/test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/java/org/opendaylight/controller/config/yang/config/clustering_it_provider/ClusteringItProviderModuleFactory.java
new file mode 100644 (file)
index 0000000..642263c
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: clustering-it-provider yang module local name: clustering-it-provider
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Tue Aug 19 14:44:46 PDT 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.config.clustering_it_provider;
+public class ClusteringItProviderModuleFactory extends org.opendaylight.controller.config.yang.config.clustering_it_provider.AbstractClusteringItProviderModuleFactory {
+
+}
diff --git a/test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/yang/clustering-it-provider.yang b/test/tools/odl-mdsal-clustering-tests/clustering-test-app/provider/src/main/yang/clustering-it-provider.yang
new file mode 100644 (file)
index 0000000..ff3f9a8
--- /dev/null
@@ -0,0 +1,60 @@
+module clustering-it-provider {
+
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:clustering-it-provider";
+    prefix "clustering-it-provider";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+
+    description
+        "This module contains the base YANG definitions for
+        clustering-it-provider implementation.";
+
+    revision "2014-08-19" {
+        description
+            "Initial revision.";
+    }
+
+    // This is the definition of the service implementation as a module identity.
+    identity clustering-it-provider {
+            base config:module-type;
+
+            // Specifies the prefix for generated java classes.
+            config:java-name-prefix ClusteringItProvider;
+    }
+
+    // Augments the 'configuration' choice node under modules/module.
+    augment "/config:modules/config:module/config:configuration" {
+        case clustering-it-provider {
+            when "/config:modules/config:module/config:type = 'clustering-it-provider'";
+
+            container rpc-registry {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity mdsal:binding-rpc-registry;
+                    }
+                }
+            }
+
+            container notification-service {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity mdsal:binding-notification-service;
+                    }
+                }
+            }
+
+            container data-broker {
+                uses config:service-ref {
+                    refine type {
+                        mandatory false;
+                        config:required-identity mdsal:binding-async-data-broker;
+                    }
+                }
+            }
+        }
+    }
+}