Merge "Lower logger level in OF1.0 Discovery Service"
authorAndrew Kim <andrekim@cisco.com>
Fri, 7 Feb 2014 17:12:01 +0000 (17:12 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 7 Feb 2014 17:12:01 +0000 (17:12 +0000)
23 files changed:
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BindingIndependentMappingServiceTracker.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/AbstractConfigTest.java
opendaylight/config/config-module-archetype/pom.xml [new file with mode: 0644]
opendaylight/config/config-module-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml [new file with mode: 0644]
opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/pom.xml [new file with mode: 0644]
opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__-impl.yang [new file with mode: 0644]
opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__.yang [new file with mode: 0644]
opendaylight/config/pom.xml
opendaylight/config/yang-test/pom.xml
opendaylight/logging/bridge/pom.xml
opendaylight/logging/bridge/src/main/java/org/opendaylight/controller/logging/bridge/internal/LogListenerImpl.java
opendaylight/logging/bridge/src/test/java/org/opendaylight/controller/logging/bridge/internal/LogListenerImplTest.java [new file with mode: 0644]
opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-table-types.yang
opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/AbstractTest.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataBroker.xtend
opendaylight/md-sal/sal-netconf-connector/src/main/yang/odl-sal-netconf-connector-cfg.yang
opendaylight/md-sal/sal-remote/src/main/yang/opendaylight-md-sal-remote.yang
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/Notificator.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/iml/varioustests/VariousTest.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/websockets/client/WebSocketClient.java
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClient.java
opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SSHNetconfClientLiveTest.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractNetconfSessionNegotiator.java

index 06a582608610287fc543bdd4a4e362d3fc7d4bb3..16a0605cd4c39bc020a80a4da1f3870eb17109df 100644 (file)
@@ -15,11 +15,6 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/**
- * Every time factory is added or removed, blank transaction is triggered to handle
- * {@link org.opendaylight.controller.config.spi.ModuleFactory#getDefaultModules(org.opendaylight.controller.config.api.DependencyResolverFactory, org.osgi.framework.BundleContext)}
- * functionality.
- */
 public class BindingIndependentMappingServiceTracker implements ServiceTrackerCustomizer<BindingIndependentMappingService, BindingIndependentMappingService> {
     private static final Logger logger = LoggerFactory.getLogger(BindingIndependentMappingServiceTracker.class);
 
@@ -48,7 +43,7 @@ public class BindingIndependentMappingServiceTracker implements ServiceTrackerCu
         BindingIndependentMappingService service = ctx.getService(moduleFactoryServiceReference);
         this.service = service;
         CodecRegistry codecRegistry = service.getCodecRegistry();
-        logger.warn("Codec registry acquired {}", codecRegistry);
+        logger.debug("Codec registry acquired {}", codecRegistry);
         activator.initConfigManager(ctx, codecRegistry);
         return service;
     }
@@ -59,7 +54,7 @@ public class BindingIndependentMappingServiceTracker implements ServiceTrackerCu
     }
 
     @Override
-    public void removedService(ServiceReference<BindingIndependentMappingService> moduleFactoryServiceReference, BindingIndependentMappingService    o) {
+    public void removedService(ServiceReference<BindingIndependentMappingService> moduleFactoryServiceReference, BindingIndependentMappingService o) {
         // TODO crash
     }
 }
index d9bbeb4a2c9de5ab420eebbaaf702271e381b8a1..001af7525bb28a915e7b9ec0306bbd03046f24f1 100644 (file)
@@ -213,7 +213,6 @@ public abstract class AbstractConfigTest extends
         return mock(CodecRegistry.class);
     }
 
-
     public static interface BundleContextServiceRegistrationHandler {
 
        void handleServiceRegistration(Object serviceInstance);
diff --git a/opendaylight/config/config-module-archetype/pom.xml b/opendaylight/config/config-module-archetype/pom.xml
new file mode 100644 (file)
index 0000000..42c9105
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>config-subsystem</artifactId>
+    <version>0.2.4-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>config-module-archetype</artifactId>
+  <name>config-module-archetype</name>
+  <description>Archetype for new module managed by configuration subsystem</description>
+
+</project>
diff --git a/opendaylight/config/config-module-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/opendaylight/config/config-module-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644 (file)
index 0000000..fc30b4d
--- /dev/null
@@ -0,0 +1,46 @@
+<archetype>
+    <id>config-module-archetype</id>
+
+    <allowPartial>true</allowPartial>
+
+    <requiredProperties>
+        <requiredProperty key="module-name">
+        </requiredProperty>
+        <requiredProperty key="module-name-java-prefix">
+        </requiredProperty>
+        <requiredProperty key="module-implementation-name">
+            <defaultValue>impl</defaultValue>
+        </requiredProperty>
+        <requiredProperty key="config-api-yang-revision">
+            <defaultValue>2013-04-05</defaultValue>
+        </requiredProperty>
+        <requiredProperty key="config-api-version">
+            <defaultValue>0.2.4-SNAPSHOT</defaultValue>
+        </requiredProperty>
+        <requiredProperty key="yang-maven-plugin-version">
+            <defaultValue>0.6.2-SNAPSHOT</defaultValue>
+        </requiredProperty>
+        <requiredProperty key="revision">
+            <defaultValue>2014-01-31</defaultValue>
+        </requiredProperty>
+        <requiredProperty key="service-java-class">
+            <defaultValue>java.lang.AutoCloseable</defaultValue>
+        </requiredProperty>
+        <requiredProperty key="maven-bundle-plugin-version">
+            <defaultValue>2.4.0</defaultValue>
+        </requiredProperty>
+        <requiredProperty key="yang-namespace-mapping-from">
+            <defaultValue>urn:opendaylight:params:xml:ns:yang:controller</defaultValue>
+        </requiredProperty>
+        <requiredProperty key="yang-namespace-mapping-to">
+            <defaultValue>org.opendaylight.controller.config.yang</defaultValue>
+        </requiredProperty>
+
+    </requiredProperties>
+
+    <fileSets>
+        <fileSet filtered="true" encoding="UTF-8">
+            <directory>src/main/yang</directory>
+        </fileSet>
+    </fileSets>
+</archetype>
diff --git a/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/pom.xml b/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/pom.xml
new file mode 100644 (file)
index 0000000..d1c371d
--- /dev/null
@@ -0,0 +1,104 @@
+<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/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+  <packaging>bundle</packaging>
+
+    <properties>
+        <jmxGeneratorPath>${project.build.directory}/generated-sources/config</jmxGeneratorPath>
+        <config.version>${config-api-version}</config.version>
+        <maven.bundle.version>${maven-bundle-plugin-version}</maven.bundle.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>config-api</artifactId>
+            <version>${config.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-maven-plugin</artifactId>
+                <version>${yang-maven-plugin-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>
+                                            ${yang-namespace-mapping-from}==${yang-namespace-mapping-to}
+                                        </namespaceToPackage1>
+                                    </additionalConfiguration>
+                                </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>
+                </dependencies>
+            </plugin>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>1.8</version>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>${jmxGeneratorPath}</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>${maven.bundle.version}</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                        <Export-Package>
+                            ${yang-namespace-mapping-to}.${module-name},
+                        </Export-Package>
+                        <Import-Package>
+                            *
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+
+
+        </plugins>
+    </build>
+</project>
diff --git a/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__-impl.yang b/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__-impl.yang
new file mode 100644 (file)
index 0000000..8c1dab1
--- /dev/null
@@ -0,0 +1,54 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module ${module-name}-${module-implementation-name} {
+
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:${module-name}:${module-implementation-name}";
+    prefix "${module-name}-${module-implementation-name}";
+
+    import config { prefix config; revision-date ${config-api-yang-revision}; }
+    import ${module-name} { prefix ${module-name}; revision-date ${revision}; }
+
+    description
+        "This module contains the base YANG definitions for
+        ${module-name} ${module-implementation-name} implementation.";
+
+    revision "${revision}" {
+        description
+            "Initial revision.";
+    }
+
+    // This is the definition of a service implementation
+    identity ${module-name}-${module-implementation-name} {
+            base config:module-type;
+            config:provided-service ${module-name}:${module-name};
+            config:java-name-prefix ${module-name-java-prefix};
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case ${module-name}-${module-implementation-name} {
+            when "/config:modules/config:module/config:type = '${module-name}-${module-implementation-name}'";
+
+            leaf simple-attribute {
+                type uint32;
+            }
+
+            container dto-attribute {
+                leaf inner-attribute {
+                    type string;
+                }
+            }
+
+            // Dependency attribute demonstration, the config:required-identity points to a service type
+            // In this case it is the same service type as this implementation provides: ${module-name}
+            container dependency-attribute {
+                uses config:service-ref {
+                    refine type {
+                        mandatory false;
+                        config:required-identity ${module-name}:${module-name};
+                    }
+                }
+            }
+
+        }
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__.yang b/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__.yang
new file mode 100644 (file)
index 0000000..2afc91e
--- /dev/null
@@ -0,0 +1,27 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module ${module-name} {
+
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:${module-name}";
+    prefix "${module-name}";
+
+    import config { prefix config; revision-date ${config-api-yang-revision}; }
+
+    description
+        "This module contains the base YANG definitions for
+        ${module-name} services.";
+
+    revision "${revision}" {
+        description
+            "Initial revision.";
+    }
+
+    // This is the definition of a service
+    identity ${module-name} {
+
+        base "config:service-type";
+
+        // TODO modify the java class
+        config:java-class " ${service-java-class}";
+    }
+}
\ No newline at end of file
index dbf8654d6e6ea15a3349688b072ce649bc292a58..80621a4d449b0a2ccdee94ec865a8744f437735d 100644 (file)
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<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">
+<!-- vi: set et smarttab sw=4 tabstop=4: --><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>
@@ -44,6 +43,7 @@
         <module>yang-test-plugin</module>
         <module>shutdown-api</module>
         <module>shutdown-impl</module>
+        <module>config-module-archetype</module>
     </modules>
 
     <profiles>
                                         </goals>
                                     </pluginExecutionFilter>
                                     <action>
-                                        <ignore />
+                                        <ignore/>
                                     </action>
                                 </pluginExecution>
                             </pluginExecutions>
             </plugins>
         </pluginManagement>
     </build>
-</project>
+</project>
\ No newline at end of file
index 8e40260dbff1d5fc5eadbfbc5d665bb734132fc8..9c6e98e57115f4026e3901ee70b0cc5ae1d4083c 100644 (file)
         </dependency>
     </dependencies>
 
+
+
     <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.eclipse.m2e</groupId>
+                    <artifactId>lifecycle-mapping</artifactId>
+                    <version>1.0.0</version>
+                    <configuration>
+                        <lifecycleMappingMetadata>
+                            <pluginExecutions>
+                                <pluginExecution>
+                                    <pluginExecutionFilter>
+                                        <groupId>
+                                            org.opendaylight.controller
+                                        </groupId>
+                                        <artifactId>
+                                            yang-test-plugin
+                                        </artifactId>
+                                        <versionRange>
+                                            [0.2.3,)
+                                        </versionRange>
+                                        <goals>
+                                            <goal>
+                                                delete-sources
+                                            </goal>
+                                            <goal>
+                                                process-sources
+                                            </goal>
+                                        </goals>
+                                    </pluginExecutionFilter>
+                                    <action>
+                                        <ignore/>
+                                    </action>
+                                </pluginExecution>
+                            </pluginExecutions>
+                        </lifecycleMappingMetadata>
+                    </configuration>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+
         <plugins>
             <plugin>
                 <groupId>org.opendaylight.yangtools</groupId>
index 0fd26dbbe358ba49992214168e71bb05565b4335..3ceb5b181283468dea7500acd50b74ee90a6d431 100644 (file)
@@ -1,55 +1,71 @@
 <?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>
-    <groupId>org.opendaylight.controller</groupId>
-    <artifactId>commons.opendaylight</artifactId>
-    <version>1.4.2-SNAPSHOT</version>
-    <relativePath>../../commons/opendaylight</relativePath>
-  </parent>
-  <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:Main</url>
-    <tag>HEAD</tag>
-  </scm>
+<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>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>commons.opendaylight</artifactId>
+        <version>1.4.2-SNAPSHOT</version>
+        <relativePath>../../commons/opendaylight</relativePath>
+    </parent>
+    <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:Main</url>
+        <tag>HEAD</tag>
+    </scm>
 
-  <artifactId>logging.bridge</artifactId>
-  <version>0.4.2-SNAPSHOT</version>
-  <packaging>bundle</packaging>
+    <artifactId>logging.bridge</artifactId>
+    <version>0.4.2-SNAPSHOT</version>
+    <packaging>bundle</packaging>
 
-  <dependencies>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>equinoxSDK381</groupId>
-      <artifactId>org.eclipse.osgi</artifactId>
-    </dependency>
-  </dependencies>
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>equinoxSDK381</groupId>
+            <artifactId>org.eclipse.osgi</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>mockito-configuration</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
 
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <version>${bundle.plugin.version}</version>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Import-Package>
-              org.slf4j,
-              org.osgi.framework,
-              org.osgi.service.log
-            </Import-Package>
-            <Bundle-Activator>
-              org.opendaylight.controller.logging.bridge.internal.Activator
-            </Bundle-Activator>
-          </instructions>
-          <manifestLocation>${project.basedir}/META-INF</manifestLocation>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>${bundle.plugin.version}</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Import-Package>
+                            org.slf4j,
+                            org.osgi.framework,
+                            org.osgi.service.log
+                        </Import-Package>
+                        <Bundle-Activator>
+                            org.opendaylight.controller.logging.bridge.internal.Activator
+                        </Bundle-Activator>
+                    </instructions>
+                    <manifestLocation>${project.basedir}/META-INF</manifestLocation>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
index 03719d567f5ac17776dbb4cfaddf04168e83a1c7..2f45c6f91b54abc8faf1a424b223f7f66dda4d4d 100644 (file)
@@ -26,19 +26,19 @@ public class LogListenerImpl implements LogListener {
         if (this.logger != null) {
             switch (entry.getLevel()) {
             case LogService.LOG_DEBUG:
-                this.logger.debug("Bundle:{} Message:{} Exception:{}", entry.getBundle()
+                this.logger.debug("Bundle:{} Message:{}", entry.getBundle()
                         .getSymbolicName(), entry.getMessage(), entry.getException());
                 break;
             case LogService.LOG_INFO:
-                this.logger.info("Bundle:{} Message:{} Exception:{}", entry.getBundle()
+                this.logger.info("Bundle:{} Message:{}", entry.getBundle()
                         .getSymbolicName(), entry.getMessage(), entry.getException());
                 break;
             case LogService.LOG_WARNING:
-                this.logger.warn("Bundle:{} Message:{} Exception:{}", entry.getBundle()
+                this.logger.warn("Bundle:{} Message:{}", entry.getBundle()
                         .getSymbolicName(), entry.getMessage(), entry.getException());
                 break;
             case LogService.LOG_ERROR:
-                this.logger.error("Bundle:{} Message:{} Exception:{}", entry.getBundle()
+                this.logger.error("Bundle:{} Message:{}", entry.getBundle()
                         .getSymbolicName(), entry.getMessage(), entry.getException());
                 break;
             }
diff --git a/opendaylight/logging/bridge/src/test/java/org/opendaylight/controller/logging/bridge/internal/LogListenerImplTest.java b/opendaylight/logging/bridge/src/test/java/org/opendaylight/controller/logging/bridge/internal/LogListenerImplTest.java
new file mode 100644 (file)
index 0000000..2490c39
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * 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
+ */
+package org.opendaylight.controller.logging.bridge.internal;
+
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogEntry;
+import org.osgi.service.log.LogService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+
+public class LogListenerImplTest {
+    private static final Logger logger = LoggerFactory.getLogger(LogListenerImplTest.class);
+
+    @Test
+    public void test() {
+        LogListenerImpl tested = new LogListenerImpl(logger);
+        tested.logged(getEntry("m1", null));
+        tested.logged(getEntry("m2", new RuntimeException()));
+    }
+
+    private LogEntry getEntry(final String message, final Exception e) {
+        return new LogEntry() {
+            @Override
+            public Bundle getBundle() {
+                Bundle mock = mock(Bundle.class);
+                doReturn(null).when(mock).getSymbolicName();
+                return mock;
+            }
+
+            @Override
+            public ServiceReference getServiceReference() {
+                return null;
+            }
+
+            @Override
+            public int getLevel() {
+                return LogService.LOG_INFO;
+            }
+
+            @Override
+            public String getMessage() {
+                return message;
+            }
+
+            @Override
+            public Throwable getException() {
+                return e;
+            }
+
+            @Override
+            public long getTime() {
+                return 0;
+            }
+        };
+    }
+
+}
index 118db1af06fdbd809ec1f21217bbfe1a84c27cbe..e74b5483428fc1765e8bf29b763fb840c688fd25 100644 (file)
@@ -191,6 +191,7 @@ module opendaylight-table-types {
         
     grouping set-field-match {
         list set-field-match {
+           key "match-type";
             leaf match-type {
                 type identityref {
                     base match-field;
index cd4f8f158d46316f92a860249d2968874041bfd0..9ac94e7b8904a3148128ca0f01f6b7d6a72fa5d0 100644 (file)
@@ -7,21 +7,26 @@
  */
 package org.opendaylight.controller.test.sal.binding.it;
 
-import static org.ops4j.pax.exam.CoreOptions.*;
-import static org.opendaylight.controller.test.sal.binding.it.TestHelper.*;
-
-import javax.inject.Inject;
-
 import org.junit.runner.RunWith;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.options.DefaultCompositeOption;
 import org.ops4j.pax.exam.util.Filter;
-import org.ops4j.pax.exam.util.PathUtils;
 import org.osgi.framework.BundleContext;
 
+import javax.inject.Inject;
+
+import static org.opendaylight.controller.test.sal.binding.it.TestHelper.baseModelBundles;
+import static org.opendaylight.controller.test.sal.binding.it.TestHelper.bindingAwareSalBundles;
+import static org.opendaylight.controller.test.sal.binding.it.TestHelper.configMinumumBundles;
+import static org.opendaylight.controller.test.sal.binding.it.TestHelper.flowCapableModelBundles;
+import static org.opendaylight.controller.test.sal.binding.it.TestHelper.junitAndMockitoBundles;
+import static org.opendaylight.controller.test.sal.binding.it.TestHelper.mdSalCoreBundles;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+
 @RunWith(PaxExam.class)
 public abstract class AbstractTest {
 
@@ -32,7 +37,7 @@ public abstract class AbstractTest {
     public static final String YANGTOOLS_MODELS = "org.opendaylight.yangtools.model";
 
     @Inject
-    @Filter(timeout=60*1000)
+    @Filter(timeout=120*1000)
     BindingAwareBroker broker;
 
     @Inject
index 2c3b0188f48096d34ea45485fe34ec1a1711efe1..7c6f52f110fd1771650c9670c43a8136d8999a2b 100644 (file)
@@ -332,21 +332,23 @@ package class TwoPhaseCommit<P extends Path<P>, D, DCL extends DataChangeListene
     }\r
 \r
     def void publishDataChangeEvent(ImmutableList<ListenerStateCapture<P, D, DCL>> listeners) {\r
-        for (listenerSet : listeners) {\r
-            val updatedConfiguration = dataBroker.readConfigurationData(listenerSet.path);\r
-            val updatedOperational = dataBroker.readOperationalData(listenerSet.path);\r
-\r
-            val changeEvent = new DataChangeEventImpl(transaction, listenerSet.initialConfigurationState,\r
-                listenerSet.initialOperationalState, updatedOperational, updatedConfiguration);\r
-            for (listener : listenerSet.listeners) {\r
-                try {\r
-                    listener.instance.onDataChanged(changeEvent);\r
-\r
-                } catch (Exception e) {\r
-                    e.printStackTrace();\r
-                }\r
-            }\r
-        }\r
+        dataBroker.executor.submit [|\r
+            for (listenerSet : listeners) {
+                val updatedConfiguration = dataBroker.readConfigurationData(listenerSet.path);
+                val updatedOperational = dataBroker.readOperationalData(listenerSet.path);
+
+                val changeEvent = new DataChangeEventImpl(transaction, listenerSet.initialConfigurationState,
+                    listenerSet.initialOperationalState, updatedOperational, updatedConfiguration);
+                for (listener : listenerSet.listeners) {
+                    try {
+                        listener.instance.onDataChanged(changeEvent);
+
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            }        \r
+        ]\r
     }\r
 \r
     def rollback(List<DataCommitTransaction<P, D>> transactions, Exception e) {\r
index b28e72eb80251adb294d99f2e72d17c7edd7cbaf..f0fa452dc5c989138481a50ac89b120f02edb03c 100644 (file)
@@ -92,7 +92,7 @@ module odl-sal-netconf-connector-cfg {
             leaf connection-timeout-millis {
                 description "Specifies timeout in milliseconds after which connection must be established.";
                 type uint32;
-                default 5000;
+                default 20000;
             }
 
             leaf max-connection-attempts {
index cc77af57d6abf328adb553fe76e7ff2aa6fc373e..d12e252711de8834072c117831801e01f1e30865 100644 (file)
@@ -9,8 +9,8 @@ module sal-remote {
     contact "Martin Bobak <mbobak@cisco.com>";
 
     description
-          "This module contains the definition of types related to
-           Internet Assigned Numbers Authority.
+          "This module contains the definition of methods related to
+           sal remote model.
 
            Copyright (c)2013 Cisco Systems, Inc. All rights reserved.
 
@@ -48,8 +48,27 @@ module sal-remote {
 
     notification data-changed-notification {
         description "Data change notification.";
-        leaf data-change-event {
-            type instance-identifier;
+        list data-change-event {
+            key path;
+            leaf path {
+                type instance-identifier;
+            }
+            leaf store {
+                type enumeration {
+                    enum config;
+                    enum operation;
+                }
+            }
+            leaf operation {
+                type enumeration {
+                    enum created;
+                    enum updated;
+                    enum deleted;
+                }
+            }
+            anyxml data{
+                description "DataObject ";
+            }
          }
     }
 
index b0140ec83a178f6bc9f9bbaecf5a415ff812bb24..d1cb25861ae0496c299cc9f4c67ebf5314a871e4 100644 (file)
@@ -30,10 +30,13 @@ public class Notificator {
 
     public static ListenerAdapter createListener(InstanceIdentifier path, String streamName) {
         ListenerAdapter listener = new ListenerAdapter(path, streamName);
-        lock.lock();
-        listenersByInstanceIdentifier.put(path, listener);
-        listenersByStreamName.put(streamName, listener);
-        lock.unlock();
+        try {
+            lock.lock();
+            listenersByInstanceIdentifier.put(path, listener);
+            listenersByStreamName.put(streamName, listener);
+        } finally {
+            lock.unlock();
+        }
         return listener;
     }
 
@@ -63,10 +66,13 @@ public class Notificator {
             } catch (Exception e) {
             }
         }
-        lock.lock();
-        listenersByStreamName = new ConcurrentHashMap<>();
-        listenersByInstanceIdentifier = new ConcurrentHashMap<>();
-        lock.unlock();
+        try {
+            lock.lock();
+            listenersByStreamName = new ConcurrentHashMap<>();
+            listenersByInstanceIdentifier = new ConcurrentHashMap<>();
+        } finally {
+            lock.unlock();
+        }
     }
 
     public static void removeListenerIfNoSubscriberExists(ListenerAdapter listener) {
@@ -81,10 +87,13 @@ public class Notificator {
                 listener.close();
             } catch (Exception e) {
             }
-            lock.lock();
-            listenersByInstanceIdentifier.remove(listener.getPath());
-            listenersByStreamName.remove(listener).getStreamName();
-            lock.unlock();
+            try {
+                lock.lock();
+                listenersByInstanceIdentifier.remove(listener.getPath());
+                listenersByStreamName.remove(listener.getStreamName());
+            } finally {
+                lock.unlock();
+            }
         }
     }
 
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/iml/varioustests/VariousTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/iml/varioustests/VariousTest.java
deleted file mode 100644 (file)
index cdfed8e..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.restconf.iml.varioustests;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider;
-import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.w3c.dom.Document;
-
-
-public class VariousTest {
-
-    @Ignore
-    @Test
-    public void test() {
-        String[] split = "/something:dfsa/s:sda".split("/");
-        System.out.println(split.length);
-        for (String str : split) {
-            System.out.println(">"+str+"<");    
-        }        
-        
-    }
-    
-    @Test
-    public void loadXml() {
-        TestUtils.readInputToCnSn("/varioustest/xmldata.xml", XmlToCompositeNodeProvider.INSTANCE);
-//        TestUtils.normalizeCompositeNode(compositeNode, modules, schemaNodePath)
-    }
-    
-    @Test
-    public void buildXml() {
-//        Document doc;
-//        doc.createElementNS(namespaceURI, qualifiedName)
-    }
-    
-
-}
index bff63b88ad5ba71cadf5642f51cf16d0edb8a754..845d54ea1f568388ff6c7ba1400f0e76cac9ccf5 100644 (file)
@@ -24,6 +24,8 @@ import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
 import io.netty.handler.codec.http.websocketx.WebSocketClientHandshakerFactory;
 import io.netty.handler.codec.http.websocketx.WebSocketVersion;
 
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
 import java.net.URI;
 
 import org.slf4j.Logger;
@@ -81,8 +83,9 @@ public class WebSocketClient  {
         clientChannel.writeAndFlush(new PingWebSocketFrame(Unpooled.copiedBuffer(new byte[]{1, 2, 3, 4, 5, 6})));
     }
 
-    public void close() throws InterruptedException {
-        clientChannel.writeAndFlush(new CloseWebSocketFrame());
+    public void close(String reasonText) throws InterruptedException {
+        CloseWebSocketFrame closeWebSocketFrame = new CloseWebSocketFrame(1000,reasonText);
+        clientChannel.writeAndFlush(closeWebSocketFrame);
 
         // WebSocketClientHandler will close the connection when the server
         // responds to the CloseWebSocketFrame.
@@ -95,17 +98,32 @@ public class WebSocketClient  {
         if (args.length > 0) {
             uri = new URI(args[0]);
         } else {
-            uri = new URI("http://192.168.11.1:8181/opendaylight-inventory:nodes");
+            uri = new URI("http://192.168.1.101:8181/opendaylight-inventory:nodes");
         }
         IClientMessageCallback messageCallback = new ClientMessageCallback();
         WebSocketClient webSocketClient = new WebSocketClient(uri, messageCallback);
         webSocketClient.connect();
+
+        while (true) {
+            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+            String input = br.readLine();
+            if (input.equals("q")) {
+                System.out.print("Would you like to close stream? (Y = yes, empty = yes)\n");
+                input = br.readLine();
+                if (input.equals("yes") || input.isEmpty()) {
+                    webSocketClient.close("opendaylight-inventory:nodes");
+                    break;
+                }
+            }
+        }
     }
 
     private static class ClientMessageCallback implements IClientMessageCallback {
         @Override
         public void onMessageReceived(Object message) {
-            logger.info("received message {}", ((TextWebSocketFrame)message).text());
+            if (message instanceof TextWebSocketFrame) {
+                logger.info("received message {}"+ ((TextWebSocketFrame)message).text());
+            }
         }
     }
 
index 4fcad2cbd6afef217f32d23f71383f13f277414c..b8951a4789e1f1b4bc305cf6ed0c824a8e960ccf 100644 (file)
@@ -61,18 +61,18 @@ public class NetconfClient implements Closeable {
         try {
             return clientFuture.get();
         } catch (CancellationException e) {
-            throw new RuntimeException("Netconf client interrupted", e);
+            throw new RuntimeException("Cancelling " + this, e);
         } catch (ExecutionException e) {
-            throw new IllegalStateException("Unable to create netconf client", e);
+            throw new IllegalStateException("Unable to create " + this, e);
         }
     }
 
-    public static NetconfClient clientFor(String clientLabelForLogging, InetSocketAddress address, ReconnectStrategy strat, NetconfClientDispatcher netconfClientDispatcher) throws InterruptedException {
-        return new NetconfClient(clientLabelForLogging,address,strat,netconfClientDispatcher);
+    public static NetconfClient clientFor(String clientLabelForLogging, InetSocketAddress address, ReconnectStrategy strategy, NetconfClientDispatcher netconfClientDispatcher) throws InterruptedException {
+        return new NetconfClient(clientLabelForLogging,address,strategy,netconfClientDispatcher);
     }
 
-    public static NetconfClient clientFor(String clientLabelForLogging, InetSocketAddress address, ReconnectStrategy strat, NetconfClientDispatcher netconfClientDispatcher,NetconfClientSessionListener listener) throws InterruptedException {
-        return new NetconfClient(clientLabelForLogging,address,strat,netconfClientDispatcher,listener);
+    public static NetconfClient clientFor(String clientLabelForLogging, InetSocketAddress address, ReconnectStrategy strategy, NetconfClientDispatcher netconfClientDispatcher,NetconfClientSessionListener listener) throws InterruptedException {
+        return new NetconfClient(clientLabelForLogging,address,strategy,netconfClientDispatcher,listener);
     }
 
     public NetconfClient(String clientLabelForLogging, InetSocketAddress address, int connectTimeoutMs,
@@ -87,12 +87,12 @@ public class NetconfClient implements Closeable {
                 DEFAULT_CONNECT_TIMEOUT), netconfClientDispatcher);
     }
 
-    public NetconfClient(String clientLabelForLogging, InetSocketAddress address, ReconnectStrategy strat,
+    public NetconfClient(String clientLabelForLogging, InetSocketAddress address, ReconnectStrategy strategy,
             NetconfClientDispatcher netconfClientDispatcher, NetconfClientSessionListener listener) throws InterruptedException{
         this.label = clientLabelForLogging;
         dispatch = netconfClientDispatcher;
         sessionListener = listener;
-        Future<NetconfClientSession> clientFuture = dispatch.createClient(address, sessionListener, strat);
+        Future<NetconfClientSession> clientFuture = dispatch.createClient(address, sessionListener, strategy);
         this.address = address;
         clientSession = get(clientFuture);
         this.sessionId = clientSession.getSessionId();
index a3cc10417e389123169abe940d05cddf7f98b85b..1357201f5754d75ee6d7b4874aa78f6a6ceb48d7 100644 (file)
@@ -12,38 +12,78 @@ import io.netty.channel.nio.NioEventLoopGroup;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
-import org.opendaylight.controller.netconf.api.NetconfMessage;
-import org.opendaylight.controller.netconf.util.NetconfUtil;
 import org.opendaylight.controller.netconf.util.handler.ssh.authentication.LoginPassword;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
+import java.io.IOException;
 import java.net.InetSocketAddress;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
 
 @Ignore
 public class SSHNetconfClientLiveTest {
+    private static final Logger logger = LoggerFactory.getLogger(SSHNetconfClientLiveTest.class);
 
     NioEventLoopGroup nettyThreadgroup;
     NetconfSshClientDispatcher netconfClientDispatcher;
+    InetSocketAddress address;
+    final int connectionAttempts = 10, attemptMsTimeout = 1000;
+    final int connectionTimeoutMillis = 20000;
 
     @Before
     public void setUp() {
         nettyThreadgroup = new NioEventLoopGroup();
+
         netconfClientDispatcher = new NetconfSshClientDispatcher(new LoginPassword(
                 System.getProperty("username"), System.getProperty("password")),
-                nettyThreadgroup, nettyThreadgroup, 5000);
+                nettyThreadgroup, nettyThreadgroup, connectionTimeoutMillis);
+
+        address = new InetSocketAddress(System.getProperty("host"), Integer.parseInt(System.getProperty("port")));
     }
 
+    @Ignore
     @Test
     public void test() throws Exception {
-        InetSocketAddress address = new InetSocketAddress(System.getProperty("host"), 830);
-        int connectionAttempts = 10, attemptMsTimeout = 1000;
+        //runnable.run();
+    }
 
-        NetconfClient netconfClient = new NetconfClient("client", address, connectionAttempts,
-            attemptMsTimeout, netconfClientDispatcher);
+    @Test
+    public void testInExecutor() throws Exception {
+        int threads = 4;
+        ExecutorService executorService = Executors.newFixedThreadPool(threads);
+        try {
+            for (int i= 0;i< threads;i++) {
+                InetSocketAddress address = new InetSocketAddress(System.getProperty("host"),
+                        Integer.parseInt(System.getProperty("port")));
+                NetconfRunnable runnable = new NetconfRunnable(address);
+                executorService.execute(runnable);
+            }
+            executorService.shutdown();
+            executorService.awaitTermination(1, TimeUnit.MINUTES);
 
-        netconfClient.getCapabilities();
 
-        NetconfMessage netconfMessage = NetconfUtil.createMessage(getClass().getResourceAsStream("/get_schema.xml"));
-        NetconfMessage response = netconfClient.sendMessage(netconfMessage);
-        NetconfUtil.checkIsMessageOk(response);
+        } finally {
+            executorService.shutdownNow();
+        }
     }
+
+    class NetconfRunnable implements Runnable {
+        private final InetSocketAddress address;
+
+        NetconfRunnable(InetSocketAddress address) {
+            this.address = address;
+        }
+
+        @Override
+        public void run() {
+            try (NetconfClient netconfClient = new NetconfClient(address.toString(), address, connectionAttempts,
+                    attemptMsTimeout, netconfClientDispatcher);) {
+                logger.info("OK {}", address);
+            } catch (InterruptedException | IOException e) {
+                logger.error("Failed {}", address, e);
+            }
+        }
+    };
 }
index 8cfd177fceff03dad3cd1609d11152f30e55811a..a485a4ea9436391d7433e91370f37481734d4e7b 100644 (file)
@@ -119,7 +119,7 @@ public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionP
             public void run(final Timeout timeout) throws Exception {
                 synchronized (this) {
                     if (state != State.ESTABLISHED) {
-                        logger.debug("Connection timeout after {}", timeout);
+                        logger.debug("Connection timeout after {}, session is in state {}", timeout, state);
                         final IllegalStateException cause = new IllegalStateException(
                                 "Session was not established after " + timeout);
                         negotiationFailed(cause);
@@ -181,7 +181,7 @@ public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionP
         return true;
     }
 
-    private void changeState(final State newState) {
+    private synchronized void changeState(final State newState) {
         logger.debug("Changing state from : {} to : {}", state, newState);
         Preconditions.checkState(isStateChangePermitted(state, newState), "Cannot change state from %s to %s", state,
                 newState);
@@ -206,6 +206,7 @@ public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionP
         if (state == State.OPEN_WAIT && newState == State.FAILED)
             return true;
 
+        logger.debug("Transition from {} to {} is not allowed", state, newState);
         return false;
     }
 }