Merge changes Iae4ee2f2,I148c22c4,I1dab84ae
authorEd Warnicke <eaw@cisco.com>
Sat, 1 Feb 2014 16:07:41 +0000 (16:07 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Sat, 1 Feb 2014 16:07:41 +0000 (16:07 +0000)
* changes:
  Additional test for instance-identifier
  BUG 388: corrected media type in /operations resource
  BUG 312: Removed legacy RESTCONF draft 01 syntax

49 files changed:
opendaylight/archetypes/odl-model-project/src/main/resources/archetype-resources/pom.xml
opendaylight/commons/opendaylight/pom.xml
opendaylight/config/config-persister-directory-autodetect-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/directory/autodetect/AutodetectDirectoryPersisterTest.java
opendaylight/config/config-persister-directory-autodetect-adapter/src/test/resources/bad_controller.xml.config [new file with mode: 0644]
opendaylight/config/config-persister-file-xml-adapter/src/main/java/org/opendaylight/controller/config/persist/storage/file/xml/model/CapabilityHandler.java [deleted file]
opendaylight/config/config-persister-file-xml-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/file/xml/FileStorageAdapterTest.java
opendaylight/distribution/opendaylight/pom.xml
opendaylight/md-sal/clustered-data-store/implementation/pom.xml
opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-meter-types.yang
opendaylight/md-sal/pom.xml
opendaylight/md-sal/sal-binding-broker/pom.xml
opendaylight/md-sal/sal-binding-config/pom.xml
opendaylight/md-sal/sal-common-api/pom.xml
opendaylight/md-sal/sal-common-util/pom.xml
opendaylight/md-sal/sal-dom-api/pom.xml
opendaylight/md-sal/sal-dom-broker/pom.xml
opendaylight/md-sal/sal-netconf-connector/pom.xml
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModule.java
opendaylight/md-sal/sal-netconf-connector/src/main/yang/odl-sal-netconf-connector-cfg.yang
opendaylight/md-sal/sal-remoterpc-connector/implementation/pom.xml
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceImplTest.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPusher.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterActivator.java
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientDispatcher.java
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiator.java
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiatorFactory.java
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfSshClientDispatcher.java
opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SSHNetconfClientLiveTest.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiator.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiatorFactory.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfImplActivator.java
opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ConcurrentClientsTest.java
opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfDispatcherImplTest.java
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/AbstractNetconfConfigTest.java [new file with mode: 0644]
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITSecureTest.java
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfMonitoringITTest.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractNetconfSessionNegotiator.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageAggregator.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/osgi/NetconfConfigUtil.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SecureMessageReadWriteService.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowConverter.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Match.java
opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerServiceTest.java
opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6ExtensionTest.java
opendaylight/web/root/src/main/resources/js/lib.js
opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java
opendaylight/web/troubleshoot/src/main/resources/js/page.js

index 70742bd550db0fccb8ed3203987650e224c6c5e0..ebb9302b78487282f2e40c802429161809ea6c4b 100644 (file)
@@ -9,8 +9,8 @@
   <properties>\r
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\r
     <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>\r
-    <yang.version>0.6.1</yang.version>\r
-    <yang.codegen.version>0.6.1</yang.codegen.version>\r
+    <yang.version>0.6.2-SNAPSHOT</yang.version>\r
+    <yang.codegen.version>0.6.2-SNAPSHOT</yang.codegen.version>\r
     <bundle.plugin.version>2.3.7</bundle.plugin.version>\r
   </properties>\r
   <scm>\r
index 47b31fb8056dcd2d73993ff94118e14de8e5aab7..9d4f8389925551c4142c4555b33e296d4cc11ec9 100644 (file)
@@ -69,7 +69,7 @@
     <enforcer.version>1.3.1</enforcer.version>
     <bundle.plugin.version>2.3.7</bundle.plugin.version>
     <junit.version>4.8.1</junit.version>
-    <yangtools.version>0.6.1</yangtools.version>
+    <yangtools.version>0.6.2-SNAPSHOT</yangtools.version>
     <!--versions for bits of the controller -->
     <controller.version>0.4.2-SNAPSHOT</controller.version>
     <hosttracker.api.version>0.5.2-SNAPSHOT</hosttracker.api.version>
index f8334607669103203f03f5c273dbaa7cf75a4977..bcade93352670fcae086cf75f776242d0886276e 100644 (file)
@@ -8,12 +8,15 @@
 package org.opendaylight.controller.config.persist.storage.directory.autodetect;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.List;
 import junit.framework.Assert;
 import org.junit.Test;
 import org.junit.matchers.JUnitMatchers;
 import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
 import org.opendaylight.controller.config.persist.test.PropertiesProviderTest;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
 
 public class AutodetectDirectoryPersisterTest {
 
@@ -37,5 +40,52 @@ public class AutodetectDirectoryPersisterTest {
         String snapFromXml = configs.get(1).getConfigSnapshot();
         org.junit.Assert.assertThat(snapFromXml, JUnitMatchers.containsString("<config>xml</config>"));
 
-        Assert.assertEquals(configs.get(0).getCapabilities(), configs.get(1).getCapabilities());    }
+        Assert.assertEquals(configs.get(0).getCapabilities(), configs.get(1).getCapabilities());
+    }
+
+    @Test
+    public void testInvalidXml() throws Exception {
+        File resourcePath = FileTypeTest.getResourceAsFile("/bad_controller.xml.config");
+        File parentFile = resourcePath.getParentFile();
+
+        AutodetectDirectoryStorageAdapter adapter = new AutodetectDirectoryStorageAdapter();
+
+        PropertiesProviderTest pp = new PropertiesProviderTest();
+        pp.addProperty("directoryStorage",parentFile.getPath());
+        AutodetectDirectoryPersister persister = (AutodetectDirectoryPersister) adapter.instantiate(pp);
+        try {
+            List<ConfigSnapshotHolder> configs = persister.loadLastConfigs();
+            fail("An exception of type " + IllegalStateException.class + " was expected");
+        } catch (IllegalStateException ise){
+            String message = ise.getMessage();
+            assertThat(message, JUnitMatchers.containsString("Unable to restore configuration snapshot from "));
+        }
+
+    }
+
+    @Test
+    public void testPersistConfig() throws Exception {
+        File resourcePath = FileTypeTest.getResourceAsFile("/combined/1controller.txt.config");
+        File parentFile = resourcePath.getParentFile();
+
+        AutodetectDirectoryStorageAdapter adapter = new AutodetectDirectoryStorageAdapter();
+
+        PropertiesProviderTest pp = new PropertiesProviderTest();
+        pp.addProperty("directoryStorage",parentFile.getPath());
+        AutodetectDirectoryPersister persister = (AutodetectDirectoryPersister) adapter.instantiate(pp);
+        List<ConfigSnapshotHolder> configs = null;
+        try {
+            configs = persister.loadLastConfigs();
+        } catch (IOException e) {
+            fail("An exception of type " + UnsupportedOperationException.class + " was expected");
+        }
+        Assert.assertEquals(2, configs.size());
+        try {
+            persister.persistConfig(configs.get(0));
+        } catch (UnsupportedOperationException uoe){
+            String message = uoe.getMessage();
+            assertThat(message,JUnitMatchers.containsString("This adapter is read only. Please set readonly=true on class"));
+        }
+    }
+
 }
diff --git a/opendaylight/config/config-persister-directory-autodetect-adapter/src/test/resources/bad_controller.xml.config b/opendaylight/config/config-persister-directory-autodetect-adapter/src/test/resources/bad_controller.xml.config
new file mode 100644 (file)
index 0000000..3f6a337
--- /dev/null
@@ -0,0 +1,10 @@
+<snapshot>
+    <required-capabilities>
+        <capability
+        <capability>cap2</capability>
+        <capability>capa a</capability>
+    </required-capabilities>
+    <configuration>
+        <config>xml</config>
+    </configuration>
+</snapshot>
\ No newline at end of file
diff --git a/opendaylight/config/config-persister-file-xml-adapter/src/main/java/org/opendaylight/controller/config/persist/storage/file/xml/model/CapabilityHandler.java b/opendaylight/config/config-persister-file-xml-adapter/src/main/java/org/opendaylight/controller/config/persist/storage/file/xml/model/CapabilityHandler.java
deleted file mode 100644 (file)
index d384df6..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.config.persist.storage.file.xml.model;
-
-import javax.xml.bind.ValidationEventHandler;
-import javax.xml.bind.annotation.DomHandler;
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import java.io.StringReader;
-import java.io.StringWriter;
-
-class CapabilityHandler implements DomHandler<String, StreamResult> {
-
-    private static final String START_TAG = "<capability>";
-    private static final String END_TAG = "</capability>";
-
-    private StringWriter xmlWriter = new StringWriter();
-
-    public StreamResult createUnmarshaller(ValidationEventHandler errorHandler) {
-        xmlWriter.getBuffer().setLength(0);
-        return new StreamResult(xmlWriter);
-    }
-
-    public String getElement(StreamResult rt) {
-        String xml = rt.getWriter().toString();
-        int beginIndex = xml.indexOf(START_TAG) + START_TAG.length();
-        int endIndex = xml.indexOf(END_TAG);
-        return xml.substring(beginIndex, endIndex);
-    }
-
-    public Source marshal(String n, ValidationEventHandler errorHandler) {
-        try {
-            String xml = START_TAG + n.trim() + END_TAG;
-            StringReader xmlReader = new StringReader(xml);
-            return new StreamSource(xmlReader);
-        } catch(Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-}
index 0e4cce544f049dc361ccc0770d3161db46d5c482..5322f6357a01b0a3e01e1d58a8d943113b942562 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.controller.config.persist.storage.file.xml;
 
 import com.google.common.base.Charsets;
 import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.nio.file.Files;
 import java.util.List;
 import java.util.SortedSet;
@@ -29,6 +31,8 @@ public class FileStorageAdapterTest {
 
     private static int i;
     private File file;
+    private static final String NON_EXISTENT_DIRECTORY = "./nonExistentDir/";
+    private static final String NON_EXISTENT_FILE = "nonExistent.txt";
 
     @Before
     public void setUp() throws Exception {
@@ -39,6 +43,32 @@ public class FileStorageAdapterTest {
         i = 1;
     }
 
+    @Test
+    public void testNewFile() throws Exception {
+        XmlFileStorageAdapter storage = new XmlFileStorageAdapter();
+        PropertiesProviderTest pp = new PropertiesProviderTest();
+        pp.addProperty("fileStorage",NON_EXISTENT_DIRECTORY+NON_EXISTENT_FILE);
+        pp.addProperty("numberOfBackups",Integer.toString(Integer.MAX_VALUE));
+        storage.instantiate(pp);
+
+        final ConfigSnapshotHolder holder = new ConfigSnapshotHolder() {
+            @Override
+            public String getConfigSnapshot() {
+                return createConfig();
+            }
+
+            @Override
+            public SortedSet<String> getCapabilities() {
+                return createCaps();
+            }
+        };
+        storage.persistConfig(holder);
+
+        storage.persistConfig(holder);
+
+        Assert.assertEquals(storage.toString().replace("\\","/"),"XmlFileStorageAdapter [storage="+NON_EXISTENT_DIRECTORY+NON_EXISTENT_FILE+"]");
+        delete(new File(NON_EXISTENT_DIRECTORY));
+    }
     @Test
     public void testFileAdapter() throws Exception {
         XmlFileStorageAdapter storage = new XmlFileStorageAdapter();
@@ -191,4 +221,12 @@ public class FileStorageAdapterTest {
         return "<config>" + i++ + "</config>";
     }
 
+    private void delete(File f) throws IOException {
+        if (f.isDirectory()) {
+            for (File c : f.listFiles())
+                delete(c);
+        }
+        if (!f.delete())
+            throw new FileNotFoundException("Failed to delete file: " + f);
+    }
 }
index dca781e7ec403d2f9b4968eed59e4003b8d6b2ac..28637bcf46d1f2ae64f7c9cde5c4ab8026f18f30 100644 (file)
          <dependency>
           <groupId>org.opendaylight.yangtools</groupId>
           <artifactId>yang-binding</artifactId>
-          <version>0.6.1</version>
+          <version>${yangtools.version}</version>
          </dependency>
          <dependency>
           <groupId>org.opendaylight.yangtools</groupId>
           <artifactId>binding-type-provider</artifactId>
-          <version>0.6.1</version>
+          <version>${yangtools.version}</version>
          </dependency>
          <dependency>
           <groupId>org.opendaylight.yangtools</groupId>
index c1e2fecedd2ca3daf1e5dac2722ec7649442e3cd..e6cfee15e1501de716e43fa4a1ff80f0138e0434 100644 (file)
@@ -72,7 +72,7 @@
                     <dependency>
                         <groupId>org.opendaylight.yangtools</groupId>
                         <artifactId>maven-sal-api-gen-plugin</artifactId>
-                        <version>0.6.1</version>
+                        <version>${yangtools.version}</version>
                         <type>jar</type>
                     </dependency>
                 </dependencies>
index 1686cad3de0aacc365bcc195acc16314180cbb51..6d1405019c28c2fc116bd702fcdf94c562832c8e 100644 (file)
@@ -73,38 +73,46 @@ module opendaylight-meter-types {
         choice band-type {
             case drop {
                 leaf drop-rate {
+                    description "Rate for dropping packets";
                     type uint32;
                 }
                 
                 leaf drop-burst-size {
+                    description "Size of bursts";
                     type uint32;
                 }
             }
 
             case dscp-remark {
                 leaf dscp-remark-rate {
+                    description "Rate for remarking packets";
                     type uint32;
                 }
                 
                 leaf dscp-remark-burst-size {
+                    description "Size of bursts";
                     type uint32;
                 }
                 
                 leaf perc_level {
+                    description "Number of drop precedence level to add";
                     type uint8;
                 }
             }
             
             case experimenter {
                 leaf experimenter-rate {
+                    description "Rate for remarking packets";
                     type uint32;
                 }
                 
                 leaf experimenter-burst-size {
+                    description "Size of bursts";
                     type uint32;
                 }
                 
                 leaf experimenter {
+                    description "Experimenter id";
                     type uint32;
                 }
             }
@@ -118,22 +126,27 @@ module opendaylight-meter-types {
     grouping meter {
         
         leaf flags {
+           description "Meter configuration flags";
            type meter-flags;        
         }
         
         leaf meter-id {
+            description "Meter instance";
             type meter-id;
         }       
         
         leaf barrier {
+            description "If true, barrier message is sent";
             type boolean; 
         }
         
         leaf meter-name {
+            description "Name of meter instance";
             type string;
         }
         
         leaf container-name {
+            description "Name of container";
             type string; 
         }
         
@@ -141,20 +154,24 @@ module opendaylight-meter-types {
             list meter-band-header {
                 key "band-id";
                 leaf band-id {
+                    description "Meter band id";
                     type band-id;
                 }
                 
                 container meter-band-types {
                     leaf flags {
+                        description "Meter band flags";
                         type meter-band-type;
                     }
                 }
             
                 leaf band-rate {
+                    description "Rate for this band";
                     type uint32;
                 }
         
                 leaf band-burst-size {
+                    description "Size of bursts";
                     type uint32;
                 }
                 uses band-type;
index 521ec23859e0656ed15bb6db2e7095bbcafbf89c..674ea240ebc164af1ff77036264dbad5f35b70d3 100644 (file)
     </profiles>
 
     <properties>
-        <yangtools.version>0.6.1</yangtools.version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
         <!-- Java Versions -->
index ea50e943cad406cfcfd8fc7c7273473ad43bd6c2..e5a74e42a155fee7a587890fc91b0b9d3e4a9b12 100644 (file)
@@ -56,7 +56,7 @@
                     <dependency>
                         <groupId>org.opendaylight.yangtools</groupId>
                         <artifactId>maven-sal-api-gen-plugin</artifactId>
-                        <version>0.6.1</version>
+                       <version>${yangtools.version}</version>
                         <type>jar</type>
                     </dependency>
                 </dependencies>
index aec9fe4e332c9c8b843eb768c22454d953c2b44d..d87e272032e5f5d47f1b53e0c2cb24bc2c8153b7 100644 (file)
@@ -69,7 +69,7 @@
                     <dependency>
                         <groupId>org.opendaylight.yangtools</groupId>
                         <artifactId>maven-sal-api-gen-plugin</artifactId>
-                        <version>0.6.1</version>
+                       <version>${yangtools.version}</version>
                         <type>jar</type>
                     </dependency>
                 </dependencies>
index 437051e3468abc4ae96b5473f3304ed4846f8e99..5dd08d062d0159dfc18a7d4f11338c47505fb2a1 100644 (file)
@@ -26,7 +26,6 @@
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>concepts</artifactId>
-            <version>0.6.1</version>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
index 2ec66b57a3a0d1a661d20964a2c3b213ae83834a..3a9b00dce079994d1351142a3f288ffbacf631fc 100644 (file)
@@ -21,7 +21,6 @@
     <dependency>
       <groupId>org.opendaylight.yangtools</groupId>
       <artifactId>concepts</artifactId>
-      <version>0.6.1</version>
     </dependency>
     <dependency>
       <groupId>com.google.guava</groupId>
index 76d80d15f704558a0d4f61dabbe41e7320ad56e2..d7b0296ce1d2ac761a371b948273f903b2c45cf8 100644 (file)
@@ -59,7 +59,7 @@
                     <dependency>
                         <groupId>org.opendaylight.yangtools</groupId>
                         <artifactId>maven-sal-api-gen-plugin</artifactId>
-                        <version>0.6.1</version>
+                        <version>${yangtools.version}</version>
                         <type>jar</type>
                     </dependency>
                 </dependencies>
index 5b883d7c4270b0044abb8595ad1a74187d4af856..8b193e03aa4620bcbfe1b98602488b53a49d84b9 100644 (file)
                     <dependency>
                         <groupId>org.opendaylight.yangtools</groupId>
                         <artifactId>maven-sal-api-gen-plugin</artifactId>
-                        <version>0.6.1</version>
+                        <version>${yangtools.version}</version>
                         <type>jar</type>
                     </dependency>
                 </dependencies>
index f90c966ba3e5d938a1309bb568454c084b2ea99b..597b02ebb5d1f480e041146507075bfd61735a3b 100644 (file)
                     <dependency>
                         <groupId>org.opendaylight.yangtools</groupId>
                         <artifactId>maven-sal-api-gen-plugin</artifactId>
-                        <version>0.6.1</version>
+                       <version>${yangtools.version}</version>
                         <type>jar</type>
                     </dependency>
                 </dependencies>
index cedc0d4d8fa85e3d6e336276388457aee18e6884..a04baaa91298ccf218c74958d76596c89545b204 100644 (file)
@@ -7,18 +7,9 @@
  */
 package org.opendaylight.controller.config.yang.md.sal.connector.netconf;
 
+import com.google.common.net.InetAddresses;
 import io.netty.channel.EventLoopGroup;
 import io.netty.util.concurrent.GlobalEventExecutor;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import javax.net.ssl.SSLContext;
-
 import org.opendaylight.controller.netconf.client.NetconfClientDispatcher;
 import org.opendaylight.controller.netconf.client.NetconfSshClientDispatcher;
 import org.opendaylight.controller.netconf.util.handler.ssh.authentication.AuthenticationHandler;
@@ -31,17 +22,25 @@ import org.opendaylight.yangtools.yang.model.util.repo.FilesystemSchemaCachingPr
 import org.opendaylight.yangtools.yang.model.util.repo.SchemaSourceProvider;
 import org.opendaylight.yangtools.yang.model.util.repo.SchemaSourceProviders;
 import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-import static com.google.common.base.Preconditions.*;
+import java.io.File;
+import java.io.InputStream;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
-import com.google.common.base.Optional;
-import com.google.common.net.InetAddresses;
+import static org.opendaylight.controller.config.api.JmxAttributeValidationException.checkCondition;
+import static org.opendaylight.controller.config.api.JmxAttributeValidationException.checkNotNull;
 
 /**
 *
 */
 public final class NetconfConnectorModule extends org.opendaylight.controller.config.yang.md.sal.connector.netconf.AbstractNetconfConnectorModule
 {
+    private static final Logger logger = LoggerFactory.getLogger(NetconfConnectorModule.class);
 
     private static ExecutorService GLOBAL_PROCESSING_EXECUTOR = null;
     private static AbstractCachingSchemaSourceProvider<String, InputStream> GLOBAL_NETCONF_SOURCE_PROVIDER = null;
@@ -56,14 +55,20 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co
     }
 
     @Override
-    public void validate(){
-        super.validate();
-        checkState(getAddress() != null,"Address must be set.");
+    protected void customValidation() {
+        checkNotNull(getAddress(), addressJmxAttribute);
         //checkState(getAddress().getIpv4Address() != null || getAddress().getIpv6Address() != null,"Address must be set.");
-        checkState(getPort() != null,"Port must be set.");
-        checkState(getDomRegistry() != null,"Dom Registry must be provided.");
-    }
+        checkNotNull(getPort(), portJmxAttribute);
+        checkNotNull(getDomRegistry(), portJmxAttribute);
+        checkNotNull(getDomRegistry(), domRegistryJmxAttribute);
+
+        checkNotNull(getConnectionTimeoutMillis(), connectionTimeoutMillisJmxAttribute);
+        checkCondition(getConnectionTimeoutMillis() > 0, "must be > 0", connectionTimeoutMillisJmxAttribute);
 
+        checkNotNull(getBetweenAttemptsTimeoutMillis(), betweenAttemptsTimeoutMillisJmxAttribute);
+        checkCondition(getBetweenAttemptsTimeoutMillis() > 0, "must be > 0", betweenAttemptsTimeoutMillisJmxAttribute);
+
+    }
 
     @Override
     public java.lang.AutoCloseable createInstance() {
@@ -71,10 +76,15 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co
         getDomRegistryDependency();
         NetconfDevice device = new NetconfDevice(getIdentifier().getInstanceName());
         String addressValue = getAddress();
-        
-        
-        int attemptMsTimeout = 60*1000;
-        int connectionAttempts = 5;
+
+        Long connectionAttempts;
+        if (getMaxConnectionAttempts() != null && getMaxConnectionAttempts() > 0) {
+            connectionAttempts = getMaxConnectionAttempts();
+        } else {
+            logger.trace("Setting {} on {} to infinity", maxConnectionAttemptsJmxAttribute, this);
+            connectionAttempts = null;
+        }
+        long clientConnectionTimeoutMillis = getConnectionTimeoutMillis();
         /*
          * Uncomment after Switch to IP Address
         if(getAddress().getIpv4Address() != null) {
@@ -83,8 +93,12 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co
             addressValue = getAddress().getIpv6Address().getValue();
         }
         */
-        ReconnectStrategy strategy = new TimedReconnectStrategy(GlobalEventExecutor.INSTANCE, attemptMsTimeout, 1000, 1.0, null,
-                Long.valueOf(connectionAttempts), null);
+        double sleepFactor = 1.0;
+        int minSleep = 1000;
+        Long maxSleep = null;
+        Long deadline = null;
+        ReconnectStrategy strategy = new TimedReconnectStrategy(GlobalEventExecutor.INSTANCE, getBetweenAttemptsTimeoutMillis(),
+                minSleep, sleepFactor, maxSleep, connectionAttempts, deadline);
         
         device.setReconnectStrategy(strategy);
         
@@ -96,7 +110,7 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co
         
         device.setSocketAddress(socketAddress);
         device.setEventExecutor(getEventExecutorDependency());
-        device.setDispatcher(createDispatcher());
+        device.setDispatcher(createDispatcher(clientConnectionTimeoutMillis));
         device.setSchemaSourceProvider(getGlobalNetconfSchemaProvider(bundleContext));
         
         getDomRegistryDependency().registerProvider(device, bundleContext);
@@ -124,14 +138,14 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co
         return GLOBAL_NETCONF_SOURCE_PROVIDER;
     }
 
-    private NetconfClientDispatcher createDispatcher() {
+    private NetconfClientDispatcher createDispatcher(long clientConnectionTimeoutMillis) {
         EventLoopGroup bossGroup = getBossThreadGroupDependency();
         EventLoopGroup workerGroup = getWorkerThreadGroupDependency();
         if(getTcpOnly()) {
-            return new NetconfClientDispatcher( bossGroup, workerGroup);
+            return new NetconfClientDispatcher( bossGroup, workerGroup, clientConnectionTimeoutMillis);
         } else {
             AuthenticationHandler authHandler = new LoginPassword(getUsername(),getPassword());
-            return new NetconfSshClientDispatcher(authHandler , bossGroup, workerGroup);
+            return new NetconfSshClientDispatcher(authHandler , bossGroup, workerGroup, clientConnectionTimeoutMillis);
         }
     }
 
index 233151687797ce46e880f146d9f89e118e71f3ae..b28e72eb80251adb294d99f2e72d17c7edd7cbaf 100644 (file)
@@ -88,6 +88,25 @@ 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;
+            }
+
+            leaf max-connection-attempts {
+                description "Maximum number of connection retries. Non positive value or null is interpreted as infinity.";
+                type uint32;
+                default 0; // retry forever
+            }
+
+
+            leaf between-attempts-timeout-millis {
+                description "Timeout in milliseconds to wait between connection attempts.";
+                type uint16;
+                default 10000;
+            }
         }
     }
 }
\ No newline at end of file
index 619b42be054d1637f00877b54525719e244a416b..ae31c2382fa82b3a9901bdbc4cfdb9be07c3f815 100644 (file)
                     <dependency>
                         <groupId>org.opendaylight.yangtools</groupId>
                         <artifactId>maven-sal-api-gen-plugin</artifactId>
-                        <version>0.6.1</version>
+                       <version>${yangtools.version}</version>
                         <type>jar</type>
                     </dependency>
                 </dependencies>
index 53e14ba5fbe8e1d0d945ac957b98c9e45ba65ad8..13f8cad968460d97a2f5ca7073d31745bc4a428f 100644 (file)
@@ -67,7 +67,7 @@ public class NetconfOperationServiceImplTest {
         try {
             NetconfOperationServiceImpl.checkConsistencyBetweenYangStoreAndConfig(mockJmxClient("qname1"),
                     mockYangStoreSnapshot("qname2", "qname1"));
-            fail("An exception of type " + IllegalArgumentException.class + " was expected");
+            fail("An exception of type " + IllegalStateException.class + " was expected");
         } catch (IllegalStateException e) {
             String message = e.getMessage();
             Assert.assertThat(
index 0a844b69ab8a61d37d39bd11fa1a1f4bf2b37867..b1eb2fc720918eaedce9d0604175152116d16e41 100644 (file)
@@ -47,23 +47,21 @@ public class ConfigPusher {
     private final EventLoopGroup nettyThreadgroup;
 
     // Default timeout for netconf becoming stable
-    public static final long DEFAULT_TIMEOUT = TimeUnit.MINUTES.toNanos(2);
+    public static final long DEFAULT_TIMEOUT_NANOS = TimeUnit.MINUTES.toNanos(2);
+    private static final long DEFAULT_CONNECTION_TIMEOUT_MILLIS = 5000;
     private final int delayMillis = 5000;
     private final long timeoutNanos;
+    private final long connectionTimeoutMillis;
 
     public ConfigPusher(InetSocketAddress address, EventLoopGroup nettyThreadgroup) {
-        this(address, nettyThreadgroup, DEFAULT_TIMEOUT);
+        this(address, nettyThreadgroup, DEFAULT_TIMEOUT_NANOS, DEFAULT_CONNECTION_TIMEOUT_MILLIS);
     }
 
-    @Deprecated
-    public ConfigPusher(InetSocketAddress address, long timeoutMillis, EventLoopGroup nettyThreadgroup) {
-        this(address, nettyThreadgroup, TimeUnit.MILLISECONDS.toNanos(timeoutMillis));
-    }
-
-    public ConfigPusher(InetSocketAddress address, EventLoopGroup nettyThreadgroup, long timeoutNanos) {
+    public ConfigPusher(InetSocketAddress address, EventLoopGroup nettyThreadgroup, long timeoutNanos, long connectionTimeoutMillis) {
         this.address = address;
         this.nettyThreadgroup = nettyThreadgroup;
         this.timeoutNanos = timeoutNanos;
+        this.connectionTimeoutMillis = connectionTimeoutMillis;
     }
 
     public synchronized NetconfClient init(List<ConfigSnapshotHolder> configs) throws InterruptedException {
@@ -133,11 +131,11 @@ public class ConfigPusher {
         String additionalHeader = NetconfMessageAdditionalHeader.toString("unknown", address.getAddress().getHostAddress(),
                 Integer.toString(address.getPort()), "tcp", Optional.of("persister"));
 
-        Set<String> latestCapabilities = new HashSet<>();
+        Set<String> latestCapabilities = null;
         while (System.nanoTime() < deadline) {
             attempt++;
             NetconfClientDispatcher netconfClientDispatcher = new NetconfClientDispatcher(nettyThreadgroup,
-                    nettyThreadgroup, additionalHeader);
+                    nettyThreadgroup, additionalHeader, connectionTimeoutMillis);
             NetconfClient netconfClient;
             try {
                 netconfClient = new NetconfClient(this.toString(), address, delayMillis, netconfClientDispatcher);
@@ -157,6 +155,10 @@ public class ConfigPusher {
             Util.closeClientAndDispatcher(netconfClient);
             Thread.sleep(delayMillis);
         }
+        if (latestCapabilities == null) {
+            logger.error("Could not connect to the server in {} ms", timeoutNanos / 1000);
+            throw new RuntimeException("Could not connect to netconf server");
+        }
         Set<String> allNotFound = new HashSet<>(expectedCaps);
         allNotFound.removeAll(latestCapabilities);
         logger.error("Netconf server did not provide required capabilities. Expected but not found: {}, all expected {}, current {}",
index 179c9681fc4b21732286442251f5029e19e6958c..a09c75b940e2ef8eccc58cc9d803f31793dfa2c0 100644 (file)
@@ -64,7 +64,7 @@ public class ConfigPersisterActivator implements BundleActivator {
         }
 
         String timeoutProperty = propertiesProvider.getProperty(PUSH_TIMEOUT);
-        long timeout = timeoutProperty == null ? ConfigPusher.DEFAULT_TIMEOUT : TimeUnit.SECONDS.toNanos(Integer.valueOf(timeoutProperty));
+        long timeout = timeoutProperty == null ? ConfigPusher.DEFAULT_TIMEOUT_NANOS : TimeUnit.SECONDS.toNanos(Integer.valueOf(timeoutProperty));
 
         final Pattern ignoredMissingCapabilityRegex = Pattern.compile(regex);
         nettyThreadgroup = new NioEventLoopGroup();
index fc6f87db5d797748d622364b8db3dd5e9a65f58e..1228a84a8a71a07fb1be4438407c5c8e8e4af54f 100644 (file)
@@ -8,15 +8,12 @@
 
 package org.opendaylight.controller.netconf.client;
 
+import com.google.common.base.Optional;
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.socket.SocketChannel;
 import io.netty.util.HashedWheelTimer;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.Promise;
-
-import java.io.Closeable;
-import java.net.InetSocketAddress;
-
 import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.api.NetconfSession;
 import org.opendaylight.controller.netconf.api.NetconfTerminationReason;
@@ -28,7 +25,8 @@ import org.opendaylight.protocol.framework.SessionListenerFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Optional;
+import java.io.Closeable;
+import java.net.InetSocketAddress;
 
 public class NetconfClientDispatcher extends AbstractDispatcher<NetconfClientSession, NetconfClientSessionListener> implements Closeable {
 
@@ -37,16 +35,16 @@ public class NetconfClientDispatcher extends AbstractDispatcher<NetconfClientSes
     private final NetconfClientSessionNegotiatorFactory negotatorFactory;
     private final HashedWheelTimer timer;
 
-    public NetconfClientDispatcher(EventLoopGroup bossGroup, EventLoopGroup workerGroup) {
+    public NetconfClientDispatcher(EventLoopGroup bossGroup, EventLoopGroup workerGroup, long clientConnectionTimeoutMillis) {
         super(bossGroup, workerGroup);
         timer = new HashedWheelTimer();
-        this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer, Optional.<String>absent());
+        this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer, Optional.<String>absent(), clientConnectionTimeoutMillis);
     }
 
-    public NetconfClientDispatcher(EventLoopGroup bossGroup, EventLoopGroup workerGroup, String additionalHeader) {
+    public NetconfClientDispatcher(EventLoopGroup bossGroup, EventLoopGroup workerGroup, String additionalHeader, long connectionTimeoutMillis) {
         super(bossGroup, workerGroup);
         timer = new HashedWheelTimer();
-        this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer, Optional.of(additionalHeader));
+        this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer, Optional.of(additionalHeader), connectionTimeoutMillis);
     }
 
     public Future<NetconfClientSession> createClient(InetSocketAddress address,
index dd8e3c9664588bf5350ad48ec1c1bfdc2b480b60..100b98c15af18e1791dc4c43fcc460189ee4384e 100644 (file)
@@ -34,8 +34,9 @@ public class NetconfClientSessionNegotiator extends
         AbstractNetconfSessionNegotiator<NetconfSessionPreferences, NetconfClientSession> {
 
     protected NetconfClientSessionNegotiator(NetconfSessionPreferences sessionPreferences,
-            Promise<NetconfClientSession> promise, Channel channel, Timer timer, SessionListener sessionListener) {
-        super(sessionPreferences, promise, channel, timer, sessionListener);
+            Promise<NetconfClientSession> promise, Channel channel, Timer timer, SessionListener sessionListener,
+            long connectionTimeoutMillis) {
+        super(sessionPreferences, promise, channel, timer, sessionListener, connectionTimeoutMillis);
     }
 
     private static Collection<String> getCapabilities(Document doc) {
index abfbdd526c5f7bb6796c7c0273060e7b91aa8933..db6c024e5afe24e35d336ce2c5322340814289eb 100644 (file)
@@ -8,13 +8,11 @@
 
 package org.opendaylight.controller.netconf.client;
 
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
 import io.netty.channel.Channel;
 import io.netty.util.Timer;
 import io.netty.util.concurrent.Promise;
-
-import java.io.IOException;
-import java.io.InputStream;
-
 import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.api.NetconfSessionPreferences;
 import org.opendaylight.controller.netconf.util.xml.XmlUtil;
@@ -23,18 +21,20 @@ import org.opendaylight.protocol.framework.SessionNegotiator;
 import org.opendaylight.protocol.framework.SessionNegotiatorFactory;
 import org.xml.sax.SAXException;
 
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
+import java.io.IOException;
+import java.io.InputStream;
 
 public class NetconfClientSessionNegotiatorFactory implements SessionNegotiatorFactory {
 
     private final Timer timer;
 
     private final Optional<String> additionalHeader;
+    private final long connectionTimeoutMillis;
 
-    public NetconfClientSessionNegotiatorFactory(Timer timer, Optional<String> additionalHeader) {
+    public NetconfClientSessionNegotiatorFactory(Timer timer, Optional<String> additionalHeader, long connectionTimeoutMillis) {
         this.timer = timer;
         this.additionalHeader = additionalHeader;
+        this.connectionTimeoutMillis = connectionTimeoutMillis;
     }
 
     private static NetconfMessage loadHelloMessageTemplate() {
@@ -57,7 +57,7 @@ public class NetconfClientSessionNegotiatorFactory implements SessionNegotiatorF
         }
         NetconfSessionPreferences proposal = new NetconfSessionPreferences(helloMessage);
         return new NetconfClientSessionNegotiator(proposal, promise, channel, timer,
-                sessionListenerFactory.getSessionListener());
+                sessionListenerFactory.getSessionListener(), connectionTimeoutMillis);
     }
 
 }
index ee07b3949d6dd2f040da183a46dde263abe6d9af..06239b2bfd4ef000345229c6c12c5791429751d0 100644 (file)
@@ -8,16 +8,13 @@
 
 package org.opendaylight.controller.netconf.client;
 
+import com.google.common.base.Optional;
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.socket.SocketChannel;
 import io.netty.util.HashedWheelTimer;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.Promise;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-
 import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.api.NetconfSession;
 import org.opendaylight.controller.netconf.api.NetconfTerminationReason;
@@ -33,7 +30,8 @@ import org.opendaylight.protocol.framework.ReconnectStrategy;
 import org.opendaylight.protocol.framework.SessionListener;
 import org.opendaylight.protocol.framework.SessionListenerFactory;
 
-import com.google.common.base.Optional;
+import java.io.IOException;
+import java.net.InetSocketAddress;
 
 public class NetconfSshClientDispatcher extends NetconfClientDispatcher {
 
@@ -42,19 +40,19 @@ public class NetconfSshClientDispatcher extends NetconfClientDispatcher {
     private NetconfClientSessionNegotiatorFactory negotatorFactory;
 
     public NetconfSshClientDispatcher(AuthenticationHandler authHandler, EventLoopGroup bossGroup,
-            EventLoopGroup workerGroup) {
-        super(bossGroup, workerGroup);
+            EventLoopGroup workerGroup, long connectionTimeoutMillis) {
+        super(bossGroup, workerGroup, connectionTimeoutMillis);
         this.authHandler = authHandler;
         this.timer = new HashedWheelTimer();
-        this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer, Optional.<String>absent());
+        this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer, Optional.<String>absent(), connectionTimeoutMillis);
     }
 
     public NetconfSshClientDispatcher(AuthenticationHandler authHandler, EventLoopGroup bossGroup,
-            EventLoopGroup workerGroup, String additionalHeader) {
-        super(bossGroup, workerGroup, additionalHeader);
+            EventLoopGroup workerGroup, String additionalHeader, long socketTimeoutMillis) {
+        super(bossGroup, workerGroup, additionalHeader, socketTimeoutMillis);
         this.authHandler = authHandler;
         this.timer = new HashedWheelTimer();
-        this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer, Optional.of(additionalHeader));
+        this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer, Optional.of(additionalHeader), socketTimeoutMillis);
     }
 
     public Future<NetconfClientSession> createClient(InetSocketAddress address,
index 7f1d289c5be88fbec6c30b444fd282617efec158..a3cc10417e389123169abe940d05cddf7f98b85b 100644 (file)
@@ -29,7 +29,7 @@ public class SSHNetconfClientLiveTest {
         nettyThreadgroup = new NioEventLoopGroup();
         netconfClientDispatcher = new NetconfSshClientDispatcher(new LoginPassword(
                 System.getProperty("username"), System.getProperty("password")),
-                nettyThreadgroup, nettyThreadgroup);
+                nettyThreadgroup, nettyThreadgroup, 5000);
     }
 
     @Test
index 8ba4cdc052057333df0154162153adf9ee663e2f..91555861dc4aaaa51fdfd69dd24ae9bb834f02e7 100644 (file)
@@ -8,12 +8,10 @@
 
 package org.opendaylight.controller.netconf.impl;
 
+import com.google.common.base.Optional;
 import io.netty.channel.Channel;
 import io.netty.util.Timer;
 import io.netty.util.concurrent.Promise;
-
-import java.net.InetSocketAddress;
-
 import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.api.NetconfServerSessionPreferences;
 import org.opendaylight.controller.netconf.impl.util.AdditionalHeaderUtil;
@@ -22,7 +20,7 @@ import org.opendaylight.protocol.framework.SessionListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Optional;
+import java.net.InetSocketAddress;
 
 public class NetconfServerSessionNegotiator extends
         AbstractNetconfSessionNegotiator<NetconfServerSessionPreferences, NetconfServerSession> {
@@ -30,8 +28,9 @@ public class NetconfServerSessionNegotiator extends
     static final Logger logger = LoggerFactory.getLogger(NetconfServerSessionNegotiator.class);
 
     protected NetconfServerSessionNegotiator(NetconfServerSessionPreferences sessionPreferences,
-            Promise<NetconfServerSession> promise, Channel channel, Timer timer, SessionListener sessionListener) {
-        super(sessionPreferences, promise, channel, timer, sessionListener);
+            Promise<NetconfServerSession> promise, Channel channel, Timer timer, SessionListener sessionListener,
+            long connectionTimeoutMillis) {
+        super(sessionPreferences, promise, channel, timer, sessionListener, connectionTimeoutMillis);
     }
 
     @Override
index 3c14d5124f395f54182ce125e1a9bed4ccf03d93..98462b8025ce965b596cfd323484164eaa7c97d1 100644 (file)
@@ -40,12 +40,14 @@ public class NetconfServerSessionNegotiatorFactory implements SessionNegotiatorF
     private static final Document helloMessageTemplate = loadHelloMessageTemplate();
     private final SessionIdProvider idProvider;
     private final NetconfOperationServiceFactoryListener factoriesListener;
+    private final long connectionTimeoutMillis;
 
     public NetconfServerSessionNegotiatorFactory(Timer timer, NetconfOperationServiceFactoryListener factoriesListener,
-            SessionIdProvider idProvider) {
+            SessionIdProvider idProvider, long connectionTimeoutMillis) {
         this.timer = timer;
         this.factoriesListener = factoriesListener;
         this.idProvider = idProvider;
+        this.connectionTimeoutMillis = connectionTimeoutMillis;
     }
 
     private static Document loadHelloMessageTemplate() {
@@ -64,7 +66,7 @@ public class NetconfServerSessionNegotiatorFactory implements SessionNegotiatorF
         NetconfServerSessionPreferences proposal = new NetconfServerSessionPreferences(createHelloMessage(sessionId),
                 sessionId);
         return new NetconfServerSessionNegotiator(proposal, promise, channel, timer,
-                sessionListenerFactory.getSessionListener());
+                sessionListenerFactory.getSessionListener(), connectionTimeoutMillis);
     }
 
     private static final XPathExpression sessionIdXPath = XMLNetconfUtil
index abebacf974d0527b72d6479fb2e83796e18aedd4..95f7353600fcfb67a5626a496d76642613c4bb5a 100644 (file)
@@ -48,8 +48,9 @@ public class NetconfImplActivator implements BundleActivator {
 
         SessionIdProvider idProvider = new SessionIdProvider();
         timer = new HashedWheelTimer();
+        long connectionTimeoutMillis = NetconfConfigUtil.extractTimeoutMillis(context);
         NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory(
-                timer, factoriesListener, idProvider);
+                timer, factoriesListener, idProvider, connectionTimeoutMillis);
 
         commitNot = new DefaultCommitNotificationProducer(ManagementFactory.getPlatformMBeanServer());
 
index 958ac4239842c535b9597f21270883d5c5b8b864..0ef2c285e407ac65b9eb62e0bbfc2d14b555c242 100644 (file)
@@ -8,34 +8,14 @@
 
 package org.opendaylight.controller.netconf.impl;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
+import com.google.common.base.Optional;
+import com.google.common.collect.Sets;
 import io.netty.channel.ChannelFuture;
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.util.HashedWheelTimer;
-
-import java.io.DataOutputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.management.ManagementFactory;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import javax.management.ObjectName;
-
 import org.apache.commons.io.IOUtils;
 import org.junit.After;
-import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
@@ -63,15 +43,30 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 
-import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
+import javax.management.ObjectName;
+import java.io.DataOutputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.management.ManagementFactory;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
 
 public class ConcurrentClientsTest {
 
     private static final int CONCURRENCY = 16;
-    private static EventLoopGroup nettyGroup = new NioEventLoopGroup();
-    public static final NetconfClientDispatcher NETCONF_CLIENT_DISPATCHER =
-            new NetconfClientDispatcher( nettyGroup, nettyGroup);
+    private EventLoopGroup nettyGroup;
+    private NetconfClientDispatcher netconfClientDispatcher;
 
     @Mock
     private YangStoreService yangStoreService;
@@ -88,6 +83,8 @@ public class ConcurrentClientsTest {
     @Mock
     private SessionMonitoringService monitoring;
 
+    HashedWheelTimer hashedWheelTimer;
+
     @Before
     public void setUp() throws Exception {
         { // init mocks
@@ -102,12 +99,16 @@ public class ConcurrentClientsTest {
             doReturn(Collections.emptySet()).when(jmxClient).lookupConfigBeans();
         }
 
+        nettyGroup = new NioEventLoopGroup();
+        netconfClientDispatcher = new NetconfClientDispatcher( nettyGroup, nettyGroup, 5000);
+
         NetconfOperationServiceFactoryListenerImpl factoriesListener = new NetconfOperationServiceFactoryListenerImpl();
         factoriesListener.onAddNetconfOperationServiceFactory(mockOpF());
 
         SessionIdProvider idProvider = new SessionIdProvider();
+        hashedWheelTimer = new HashedWheelTimer();
         NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory(
-                new HashedWheelTimer(5000, TimeUnit.MILLISECONDS), factoriesListener, idProvider);
+                hashedWheelTimer, factoriesListener, idProvider, 5000);
 
         commitNot = new DefaultCommitNotificationProducer(ManagementFactory.getPlatformMBeanServer());
 
@@ -123,8 +124,9 @@ public class ConcurrentClientsTest {
         s.await();
     }
 
-    @AfterClass
-    public static void tearDownStatic() {
+    @After
+    public void tearDown(){
+        hashedWheelTimer.stop();
         nettyGroup.shutdownGracefully();
     }
 
@@ -285,7 +287,7 @@ public class ConcurrentClientsTest {
         @Override
         public void run() {
             try {
-                final NetconfClient netconfClient = new NetconfClient(clientId, netconfAddress, NETCONF_CLIENT_DISPATCHER);
+                final NetconfClient netconfClient = new NetconfClient(clientId, netconfAddress, netconfClientDispatcher);
                 long sessionId = netconfClient.getSessionId();
                 logger.info("Client with sessionid {} hello exchanged", sessionId);
 
index 0ecc1cb38324ede5b3443706a071a68a3d21a9dc..9835c2393ba489e7dcf7ead4ceca119beef7f63b 100644 (file)
@@ -26,6 +26,7 @@ public class NetconfDispatcherImplTest {
     private EventLoopGroup nettyGroup;
     private NetconfServerDispatcher dispatch;
     private DefaultCommitNotificationProducer commitNot;
+    private HashedWheelTimer hashedWheelTimer;
 
     @Before
     public void setUp() throws Exception {
@@ -36,8 +37,9 @@ public class NetconfDispatcherImplTest {
         NetconfOperationServiceFactoryListener factoriesListener = new NetconfOperationServiceFactoryListenerImpl();
 
         SessionIdProvider idProvider = new SessionIdProvider();
+        hashedWheelTimer = new HashedWheelTimer();
         NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory(
-                new HashedWheelTimer(), factoriesListener, idProvider);
+                hashedWheelTimer, factoriesListener, idProvider, 5000);
 
         NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory(
                 factoriesListener, commitNot, idProvider, null);
@@ -49,6 +51,7 @@ public class NetconfDispatcherImplTest {
 
     @After
     public void tearDown() throws Exception {
+        hashedWheelTimer.stop();
         commitNot.close();
         nettyGroup.shutdownGracefully();
     }
diff --git a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/AbstractNetconfConfigTest.java b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/AbstractNetconfConfigTest.java
new file mode 100644 (file)
index 0000000..b261218
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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.netconf.it;
+
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.util.HashedWheelTimer;
+import org.junit.After;
+import org.junit.Before;
+import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
+import org.opendaylight.controller.netconf.impl.DefaultCommitNotificationProducer;
+import org.opendaylight.controller.netconf.impl.NetconfServerDispatcher;
+import org.opendaylight.controller.netconf.impl.NetconfServerSessionListenerFactory;
+import org.opendaylight.controller.netconf.impl.NetconfServerSessionNegotiatorFactory;
+import org.opendaylight.controller.netconf.impl.SessionIdProvider;
+import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListenerImpl;
+import org.opendaylight.controller.netconf.impl.osgi.SessionMonitoringService;
+
+public class AbstractNetconfConfigTest extends AbstractConfigTest {
+
+    protected EventLoopGroup nettyThreadgroup;
+    private HashedWheelTimer hashedWheelTimer;
+
+    @Before
+    public void setUpAbstractNetconfConfigTest() {
+        nettyThreadgroup = new NioEventLoopGroup();
+        hashedWheelTimer = new HashedWheelTimer();
+    }
+
+
+    protected NetconfServerDispatcher createDispatcher(
+            NetconfOperationServiceFactoryListenerImpl factoriesListener, SessionMonitoringService sessionMonitoringService,
+            DefaultCommitNotificationProducer commitNotifier) {
+        SessionIdProvider idProvider = new SessionIdProvider();
+
+        NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory(
+                hashedWheelTimer, factoriesListener, idProvider, 5000);
+
+        NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory(
+                factoriesListener, commitNotifier, idProvider,
+                sessionMonitoringService);
+
+        NetconfServerDispatcher.ServerChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerChannelInitializer(
+                serverNegotiatorFactory, listenerFactory);
+        return new NetconfServerDispatcher(serverChannelInitializer, nettyThreadgroup, nettyThreadgroup);
+    }
+
+
+    @After
+    public void cleanUpTimer() {
+        hashedWheelTimer.stop();
+        nettyThreadgroup.shutdownGracefully();
+    }
+
+}
index 14f70d398c6874f5922488fbb802540d5d97bc95..8bfa0a5846b705d40c8d6e329fbd43adaaf9895e 100644 (file)
@@ -10,17 +10,14 @@ package org.opendaylight.controller.netconf.it;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import io.netty.channel.ChannelFuture;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.util.HashedWheelTimer;
 import org.apache.commons.lang3.StringUtils;
+import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.matchers.JUnitMatchers;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
 import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
 import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
 import org.opendaylight.controller.config.persist.api.Persister;
@@ -35,9 +32,6 @@ import org.opendaylight.controller.netconf.client.NetconfClientDispatcher;
 import org.opendaylight.controller.netconf.confignetconfconnector.osgi.NetconfOperationServiceFactoryImpl;
 import org.opendaylight.controller.netconf.impl.DefaultCommitNotificationProducer;
 import org.opendaylight.controller.netconf.impl.NetconfServerDispatcher;
-import org.opendaylight.controller.netconf.impl.NetconfServerSessionListenerFactory;
-import org.opendaylight.controller.netconf.impl.NetconfServerSessionNegotiatorFactory;
-import org.opendaylight.controller.netconf.impl.SessionIdProvider;
 import org.opendaylight.controller.netconf.impl.osgi.NetconfMonitoringServiceImpl;
 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListener;
 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListenerImpl;
@@ -63,7 +57,6 @@ import java.net.InetSocketAddress;
 import java.util.Collection;
 import java.util.List;
 import java.util.Set;
-import java.util.concurrent.TimeUnit;
 import java.util.regex.Pattern;
 
 import static junit.framework.Assert.assertEquals;
@@ -74,16 +67,18 @@ import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 
-public class NetconfConfigPersisterITTest extends AbstractConfigTest {
+public class NetconfConfigPersisterITTest extends AbstractNetconfConfigTest {
 
     private static final Logger logger =  LoggerFactory.getLogger(NetconfConfigPersisterITTest.class);
 
     private static final InetSocketAddress tcpAddress = new InetSocketAddress("127.0.0.1", 12023);
 
-    private EventLoopGroup nettyThreadgroup;
+
 
     private NetconfClientDispatcher clientDispatcher;
 
+    DefaultCommitNotificationProducer commitNotifier;
+
     @Before
     public void setUp() throws Exception {
         super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(NetconfITTest.getModuleFactoriesS().toArray(
@@ -97,13 +92,18 @@ public class NetconfConfigPersisterITTest extends AbstractConfigTest {
                 .onAddNetconfOperationServiceFactory(new NetconfMonitoringActivator.NetconfMonitoringOperationServiceFactory(
                         new NetconfMonitoringOperationService(monitoringService)));
 
-        nettyThreadgroup = new NioEventLoopGroup();
 
-        NetconfServerDispatcher dispatch = createDispatcher(factoriesListener);
+        commitNotifier = new DefaultCommitNotificationProducer(platformMBeanServer);
+        NetconfServerDispatcher dispatch = createDispatcher(factoriesListener, mockSessionMonitoringService(), commitNotifier);
         ChannelFuture s = dispatch.createServer(tcpAddress);
         s.await();
 
-        clientDispatcher = new NetconfClientDispatcher(nettyThreadgroup, nettyThreadgroup);
+        clientDispatcher = new NetconfClientDispatcher(nettyThreadgroup, nettyThreadgroup, 5000);
+    }
+
+    @After
+    public void cleanUp(){
+        commitNotifier.close();
     }
 
     private HardcodedYangStoreService getYangStore() throws YangStoreException, IOException {
@@ -111,27 +111,16 @@ public class NetconfConfigPersisterITTest extends AbstractConfigTest {
         return new HardcodedYangStoreService(yangDependencies);
     }
 
-    private NetconfServerDispatcher createDispatcher(
-                                                     NetconfOperationServiceFactoryListenerImpl factoriesListener) {
-        SessionIdProvider idProvider = new SessionIdProvider();
-        NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory(
-                new HashedWheelTimer(5000, TimeUnit.MILLISECONDS), factoriesListener, idProvider);
-
-        NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory(
-                factoriesListener, new DefaultCommitNotificationProducer(platformMBeanServer), idProvider, mockSessionMonitoringService());
 
-        NetconfServerDispatcher.ServerChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerChannelInitializer(
-                serverNegotiatorFactory, listenerFactory);
-        return new NetconfServerDispatcher(serverChannelInitializer, nettyThreadgroup, nettyThreadgroup);
-    }
-
-    private SessionMonitoringService mockSessionMonitoringService() {
+    protected SessionMonitoringService mockSessionMonitoringService() {
         SessionMonitoringService mockedSessionMonitor = mock(SessionMonitoringService.class);
         doNothing().when(mockedSessionMonitor).onSessionUp(any(NetconfManagementSession.class));
         doNothing().when(mockedSessionMonitor).onSessionDown(any(NetconfManagementSession.class));
         return mockedSessionMonitor;
     }
 
+
+
     @Test
     public void testNetconfCommitNotifications() throws Exception {
 
index 793a756d540ecf7fee82499121db0bdb6b0f167f..44775fdf9316fdc582b5df3a3f5313f9b0b94b55 100644 (file)
@@ -9,27 +9,9 @@
 package org.opendaylight.controller.netconf.it;
 
 import io.netty.channel.ChannelFuture;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.util.HashedWheelTimer;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.management.ManagementFactory;
-import java.net.InetSocketAddress;
-import java.security.KeyManagementException;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.UnrecoverableKeyException;
-import java.security.cert.CertificateException;
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLContext;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
 import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
 import org.opendaylight.controller.config.spi.ModuleFactory;
 import org.opendaylight.controller.config.yang.store.api.YangStoreException;
@@ -39,18 +21,28 @@ import org.opendaylight.controller.netconf.client.NetconfClientDispatcher;
 import org.opendaylight.controller.netconf.confignetconfconnector.osgi.NetconfOperationServiceFactoryImpl;
 import org.opendaylight.controller.netconf.impl.DefaultCommitNotificationProducer;
 import org.opendaylight.controller.netconf.impl.NetconfServerDispatcher;
-import org.opendaylight.controller.netconf.impl.NetconfServerSessionListenerFactory;
-import org.opendaylight.controller.netconf.impl.NetconfServerSessionNegotiatorFactory;
-import org.opendaylight.controller.netconf.impl.SessionIdProvider;
 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListenerImpl;
 
-public class NetconfITSecureTest extends AbstractConfigTest {
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.management.ManagementFactory;
+import java.net.InetSocketAddress;
+import java.security.KeyManagementException;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
+import java.util.Collection;
+import java.util.List;
+
+public class NetconfITSecureTest extends AbstractNetconfConfigTest {
 
     private static final InetSocketAddress tlsAddress = new InetSocketAddress("127.0.0.1", 12024);
 
     private DefaultCommitNotificationProducer commitNot;
     private NetconfServerDispatcher dispatchS;
-    private EventLoopGroup nettyThreadgroup;
 
 
     @Before
@@ -63,7 +55,6 @@ public class NetconfITSecureTest extends AbstractConfigTest {
 
         commitNot = new DefaultCommitNotificationProducer(ManagementFactory.getPlatformMBeanServer());
 
-        nettyThreadgroup = new NioEventLoopGroup();
 
         dispatchS = createDispatcher(factoriesListener);
         ChannelFuture s = dispatchS.createServer(tlsAddress);
@@ -71,22 +62,12 @@ public class NetconfITSecureTest extends AbstractConfigTest {
     }
 
     private NetconfServerDispatcher createDispatcher(NetconfOperationServiceFactoryListenerImpl factoriesListener) {
-        SessionIdProvider idProvider = new SessionIdProvider();
-        NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory(
-                new HashedWheelTimer(5000, TimeUnit.MILLISECONDS), factoriesListener, idProvider);
-
-        NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory(
-                factoriesListener, commitNot, idProvider, NetconfITTest.getNetconfMonitoringListenerService());
-
-        NetconfServerDispatcher.ServerChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerChannelInitializer(
-                serverNegotiatorFactory, listenerFactory);
-        return new NetconfServerDispatcher(serverChannelInitializer, nettyThreadgroup, nettyThreadgroup);
+        return super.createDispatcher(factoriesListener, NetconfITTest.getNetconfMonitoringListenerService(), commitNot);
     }
 
     @After
     public void tearDown() throws Exception {
         commitNot.close();
-        nettyThreadgroup.shutdownGracefully();
     }
 
     private SSLContext getSslContext() throws KeyStoreException, NoSuchAlgorithmException, CertificateException,
@@ -110,7 +91,7 @@ public class NetconfITSecureTest extends AbstractConfigTest {
 
     @Test
     public void testSecure() throws Exception {
-        NetconfClientDispatcher dispatch = new NetconfClientDispatcher(nettyThreadgroup, nettyThreadgroup);
+        NetconfClientDispatcher dispatch = new NetconfClientDispatcher(nettyThreadgroup, nettyThreadgroup, 5000);
         try (NetconfClient netconfClient = new NetconfClient("tls-client", tlsAddress, 4000, dispatch))  {
 
         }
index 5f4bcecff05ed6e75e8725082a618ce517ffad16..954da5f4874a03c10f772822a163750d451f0e6b 100644 (file)
@@ -13,15 +13,11 @@ import ch.ethz.ssh2.Session;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import io.netty.channel.ChannelFuture;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.util.HashedWheelTimer;
 import junit.framework.Assert;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
 import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
 import org.opendaylight.controller.config.spi.ModuleFactory;
 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
@@ -38,9 +34,6 @@ import org.opendaylight.controller.netconf.client.NetconfClientDispatcher;
 import org.opendaylight.controller.netconf.confignetconfconnector.osgi.NetconfOperationServiceFactoryImpl;
 import org.opendaylight.controller.netconf.impl.DefaultCommitNotificationProducer;
 import org.opendaylight.controller.netconf.impl.NetconfServerDispatcher;
-import org.opendaylight.controller.netconf.impl.NetconfServerSessionListenerFactory;
-import org.opendaylight.controller.netconf.impl.NetconfServerSessionNegotiatorFactory;
-import org.opendaylight.controller.netconf.impl.SessionIdProvider;
 import org.opendaylight.controller.netconf.impl.osgi.NetconfMonitoringServiceImpl;
 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListener;
 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListenerImpl;
@@ -71,7 +64,6 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
-import java.util.concurrent.TimeUnit;
 
 import static java.util.Collections.emptyList;
 import static junit.framework.Assert.assertEquals;
@@ -81,7 +73,7 @@ import static org.mockito.Matchers.anyLong;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 
-public class NetconfITTest extends AbstractConfigTest {
+public class NetconfITTest extends AbstractNetconfConfigTest {
 
     // TODO refactor, pull common code up to AbstractNetconfITTest
 
@@ -96,7 +88,6 @@ public class NetconfITTest extends AbstractConfigTest {
             closeSession, startExi, stopExi;
     private DefaultCommitNotificationProducer commitNot;
     private NetconfServerDispatcher dispatch;
-    private EventLoopGroup nettyThreadgroup;
 
     private NetconfClientDispatcher clientDispatcher;
 
@@ -110,7 +101,6 @@ public class NetconfITTest extends AbstractConfigTest {
         NetconfOperationServiceFactoryListenerImpl factoriesListener = new NetconfOperationServiceFactoryListenerImpl();
         factoriesListener.onAddNetconfOperationServiceFactory(new NetconfOperationServiceFactoryImpl(getYangStore()));
 
-        nettyThreadgroup = new NioEventLoopGroup();
 
         commitNot = new DefaultCommitNotificationProducer(ManagementFactory.getPlatformMBeanServer());
 
@@ -118,20 +108,11 @@ public class NetconfITTest extends AbstractConfigTest {
         ChannelFuture s = dispatch.createServer(tcpAddress);
         s.await();
 
-        clientDispatcher = new NetconfClientDispatcher( nettyThreadgroup, nettyThreadgroup);
+        clientDispatcher = new NetconfClientDispatcher( nettyThreadgroup, nettyThreadgroup, 5000);
     }
 
     private NetconfServerDispatcher createDispatcher(NetconfOperationServiceFactoryListenerImpl factoriesListener) {
-        SessionIdProvider idProvider = new SessionIdProvider();
-        NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory(
-                new HashedWheelTimer(5000, TimeUnit.MILLISECONDS), factoriesListener, idProvider);
-
-        NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory(
-                factoriesListener, commitNot, idProvider, getNetconfMonitoringListenerService());
-
-        NetconfServerDispatcher.ServerChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerChannelInitializer(
-                serverNegotiatorFactory, listenerFactory);
-        return new NetconfServerDispatcher(serverChannelInitializer, nettyThreadgroup, nettyThreadgroup);
+        return super.createDispatcher(factoriesListener, getNetconfMonitoringListenerService(), commitNot);
     }
 
     static NetconfMonitoringServiceImpl getNetconfMonitoringListenerService() {
@@ -145,7 +126,6 @@ public class NetconfITTest extends AbstractConfigTest {
     @After
     public void tearDown() throws Exception {
         commitNot.close();
-        nettyThreadgroup.shutdownGracefully();
         clientDispatcher.close();
     }
 
index b0821799b0b57ad94682fe6ec58cba61ac0dee97..be2c32e34fd8816b28ed1a844437b5d0c133ea56 100644 (file)
@@ -11,15 +11,11 @@ import com.google.common.base.Charsets;
 import com.google.common.base.Optional;
 import com.google.common.collect.Sets;
 import io.netty.channel.ChannelFuture;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.util.HashedWheelTimer;
 import junit.framework.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.matchers.JUnitMatchers;
 import org.mockito.Mock;
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
 import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
 import org.opendaylight.controller.config.spi.ModuleFactory;
 import org.opendaylight.controller.config.yang.store.api.YangStoreException;
@@ -31,9 +27,6 @@ import org.opendaylight.controller.netconf.client.NetconfClientDispatcher;
 import org.opendaylight.controller.netconf.confignetconfconnector.osgi.NetconfOperationServiceFactoryImpl;
 import org.opendaylight.controller.netconf.impl.DefaultCommitNotificationProducer;
 import org.opendaylight.controller.netconf.impl.NetconfServerDispatcher;
-import org.opendaylight.controller.netconf.impl.NetconfServerSessionListenerFactory;
-import org.opendaylight.controller.netconf.impl.NetconfServerSessionNegotiatorFactory;
-import org.opendaylight.controller.netconf.impl.SessionIdProvider;
 import org.opendaylight.controller.netconf.impl.osgi.NetconfMonitoringServiceImpl;
 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListener;
 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListenerImpl;
@@ -57,13 +50,12 @@ import java.net.Socket;
 import java.util.Collection;
 import java.util.List;
 import java.util.Set;
-import java.util.concurrent.TimeUnit;
 
 import static org.mockito.Matchers.anyLong;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 
-public class NetconfMonitoringITTest extends AbstractConfigTest {
+public class NetconfMonitoringITTest extends AbstractNetconfConfigTest {
 
     private static final Logger logger =  LoggerFactory.getLogger(NetconfITTest.class);
 
@@ -72,7 +64,6 @@ public class NetconfMonitoringITTest extends AbstractConfigTest {
     @Mock
     private DefaultCommitNotificationProducer commitNot;
     private NetconfServerDispatcher dispatch;
-    private EventLoopGroup nettyThreadgroup;
 
     private NetconfClientDispatcher clientDispatcher;
 
@@ -91,13 +82,12 @@ public class NetconfMonitoringITTest extends AbstractConfigTest {
                 .onAddNetconfOperationServiceFactory(new NetconfMonitoringActivator.NetconfMonitoringOperationServiceFactory(
                         new NetconfMonitoringOperationService(monitoringService)));
 
-        nettyThreadgroup = new NioEventLoopGroup();
 
         dispatch = createDispatcher(factoriesListener);
         ChannelFuture s = dispatch.createServer(tcpAddress);
         s.await();
 
-        clientDispatcher = new NetconfClientDispatcher(nettyThreadgroup, nettyThreadgroup);
+        clientDispatcher = new NetconfClientDispatcher(nettyThreadgroup, nettyThreadgroup, 5000);
     }
 
     private HardcodedYangStoreService getYangStore() throws YangStoreException, IOException {
@@ -107,16 +97,7 @@ public class NetconfMonitoringITTest extends AbstractConfigTest {
 
     private NetconfServerDispatcher createDispatcher(
                                                      NetconfOperationServiceFactoryListenerImpl factoriesListener) {
-        SessionIdProvider idProvider = new SessionIdProvider();
-        NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory(
-                new HashedWheelTimer(5000, TimeUnit.MILLISECONDS), factoriesListener, idProvider);
-
-        NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory(
-                factoriesListener, commitNot, idProvider, getNetconfMonitoringListenerService(logger, monitoringService));
-
-        NetconfServerDispatcher.ServerChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerChannelInitializer(
-                serverNegotiatorFactory, listenerFactory);
-        return new NetconfServerDispatcher(serverChannelInitializer, nettyThreadgroup, nettyThreadgroup);
+        return super.createDispatcher(factoriesListener, getNetconfMonitoringListenerService(logger, monitoringService), commitNot);
     }
 
     static SessionMonitoringService getNetconfMonitoringListenerService(final Logger logger, final NetconfMonitoringServiceImpl monitor) {
index 26ea7ceb79d4b78d98ecf42af34d7be87364ffcb..8cfd177fceff03dad3cd1609d11152f30e55811a 100644 (file)
@@ -42,9 +42,6 @@ import java.util.concurrent.TimeUnit;
 public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionPreferences, S extends NetconfSession>
         extends AbstractSessionNegotiator<NetconfMessage, S> {
 
-    // TODO Adjust wait time for negotiation, now is 1 minute ?
-    private static final long INITIAL_HOLDTIMER = 1;
-
     private static final Logger logger = LoggerFactory.getLogger(AbstractNetconfSessionNegotiator.class);
     public static final String NAME_OF_EXCEPTION_HANDLER = "lastExceptionHandler";
 
@@ -62,13 +59,15 @@ public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionP
 
     private State state = State.IDLE;
     private final Timer timer;
+    private final long connectionTimeoutMillis;
 
     protected AbstractNetconfSessionNegotiator(P sessionPreferences, Promise<S> promise, Channel channel, Timer timer,
-            SessionListener sessionListener) {
+            SessionListener sessionListener, long connectionTimeoutMillis) {
         super(promise, channel);
         this.sessionPreferences = sessionPreferences;
         this.timer = timer;
         this.sessionListener = sessionListener;
+        this.connectionTimeoutMillis = connectionTimeoutMillis;
     }
 
     @Override
@@ -120,6 +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);
                         final IllegalStateException cause = new IllegalStateException(
                                 "Session was not established after " + timeout);
                         negotiationFailed(cause);
@@ -129,7 +129,7 @@ public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionP
                     }
                 }
             }
-        }, INITIAL_HOLDTIMER, TimeUnit.MINUTES);
+        }, connectionTimeoutMillis, TimeUnit.MILLISECONDS);
 
         sendMessage(helloMessage);
         changeState(State.OPEN_WAIT);
index b67f48f5fcf3014b06f701c18a956bfed0a78e5b..a2486050f9368e7ff37314a1e65e38e7134406ed 100644 (file)
@@ -8,17 +8,17 @@
 
 package org.opendaylight.controller.netconf.util.handler;
 
+import com.google.common.base.Charsets;
 import io.netty.buffer.ByteBuf;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.handler.codec.ByteToMessageDecoder;
-
-import java.util.List;
-
 import org.opendaylight.controller.netconf.util.messages.FramingMechanism;
 import org.opendaylight.controller.netconf.util.messages.NetconfMessageConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.List;
+
 public class NetconfMessageAggregator extends ByteToMessageDecoder {
 
     private final static Logger logger = LoggerFactory.getLogger(NetconfMessageAggregator.class);
@@ -36,6 +36,10 @@ public class NetconfMessageAggregator extends ByteToMessageDecoder {
         int index = indexOfSequence(in, eom);
         if (index == -1) {
             logger.debug("Message is not complete, read again.");
+            if (logger.isTraceEnabled()) {
+                String str = in.toString(Charsets.UTF_8);
+                logger.trace("Message read so far: {}", str);
+            }
             ctx.read();
         } else {
             ByteBuf msg = in.readBytes(index);
index 55ed7e074423968dd7e7626e45a181893cdfd4a1..f2f0419b9d87392324fcd4444d741e464f50f074 100644 (file)
@@ -8,14 +8,22 @@
 
 package org.opendaylight.controller.netconf.util.osgi;
 
-        import com.google.common.base.Optional;
-        import java.net.InetSocketAddress;
-        import org.osgi.framework.BundleContext;
-        import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.base.Optional;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.InetSocketAddress;
+
+import static com.google.common.base.Preconditions.checkNotNull;
 
 public class NetconfConfigUtil {
+    private static final Logger logger = LoggerFactory.getLogger(NetconfConfigUtil.class);
+
     private static final String PREFIX_PROP = "netconf.";
 
+
+
     private enum InfixProp {
         tcp, ssh
     }
@@ -25,6 +33,23 @@ public class NetconfConfigUtil {
     private static final String CLIENT_PROP = ".client";
     private static final String PRIVATE_KEY_PATH_PROP = ".pk.path";
 
+    private static final String CONNECTION_TIMEOUT_MILLIS_PROP = "connectionTimeoutMillis";
+    private static final long DEFAULT_TIMEOUT_MILLIS = 5000;
+
+    public static long extractTimeoutMillis(BundleContext bundleContext) {
+        String key = PREFIX_PROP + CONNECTION_TIMEOUT_MILLIS_PROP;
+        String timeoutString = bundleContext.getProperty(key);
+        if (timeoutString == null || timeoutString.length() == 0) {
+            return DEFAULT_TIMEOUT_MILLIS;
+        }
+        try {
+            return Long.parseLong(timeoutString);
+        }catch(NumberFormatException e) {
+            logger.warn("Cannot parse {} property: {}, using defaults", key, timeoutString, e);
+            return DEFAULT_TIMEOUT_MILLIS;
+        }
+    }
+
     public static InetSocketAddress extractTCPNetconfAddress(BundleContext context, String exceptionMessageIfNotFound, boolean forClient) {
 
         Optional<InetSocketAddress> inetSocketAddressOptional = extractSomeNetconfAddress(context, InfixProp.tcp, exceptionMessageIfNotFound, forClient);
index 90b47cf26421e6ff6a05c0e6ef21451c52173ac9..d60bcab8b32fdf299d68505c348fe5b4fc5ec831 100644 (file)
@@ -407,9 +407,9 @@ public class SecureMessageReadWriteService implements IMessageReadWrite {
         this.myAppData = ByteBuffer
                 .allocate(session.getApplicationBufferSize());
         this.peerAppData = ByteBuffer.allocate(session
-                .getApplicationBufferSize());
+                .getApplicationBufferSize() * 2);
         this.myNetData = ByteBuffer.allocate(session.getPacketBufferSize());
-        this.peerNetData = ByteBuffer.allocate(session.getPacketBufferSize());
+        this.peerNetData = ByteBuffer.allocate(session.getPacketBufferSize() * 2);
     }
 
     @Override
index 78a2ea5120da60ad09053efb894e039533c52d68..6d1c563aa44729581b5eb46b5e61f8cb0543b47a 100644 (file)
@@ -539,7 +539,7 @@ public class FlowConverter {
                         salMatch.setField(new MatchField(MatchType.DL_VLAN,
                                 vlan));
                     }
-                    if (ofMatch.getDataLayerVirtualLanPriorityCodePoint() != 0) {
+                    if ((ofMatch.getWildcards() & OFMatch.OFPFW_DL_VLAN_PCP) == 0) {
                         salMatch.setField(MatchType.DL_VLAN_PR, ofMatch
                                 .getDataLayerVirtualLanPriorityCodePoint());
                     }
@@ -612,7 +612,7 @@ public class FlowConverter {
                         salMatch.setField(new MatchField(MatchType.DL_VLAN,
                                 vlan));
                     }
-                    if (v6Match.getDataLayerVirtualLanPriorityCodePoint() != 0) {
+                    if ((v6Match.getWildcards() & OFMatch.OFPFW_DL_VLAN_PCP) == 0) {
                         salMatch.setField(MatchType.DL_VLAN_PR, v6Match
                                 .getDataLayerVirtualLanPriorityCodePoint());
                     }
index 4daa591ba1e1811c9262b5c1a806d7fa7180a763..cfe20a1fa2a6f13e35804f2eb389787314a6a9b8 100644 (file)
@@ -216,7 +216,7 @@ public class V6Match extends OFMatch implements Cloneable {
             this.dlVlanIDState = MatchFieldState.MATCH_ABSENT;
         }
 
-        if (match.getDataLayerVirtualLanPriorityCodePoint() != 0) {
+        if ((match.getWildcards() & OFMatch.OFPFW_DL_VLAN_PCP) == 0) {
             this.setDataLayerVirtualLanPriorityCodePoint(
                     match.getDataLayerVirtualLanPriorityCodePoint(), (byte) 0);
         } else {
@@ -839,14 +839,12 @@ public class V6Match extends OFMatch implements Cloneable {
                     // extract the vlan id
                     super.setDataLayerVirtualLan(getVlanID(firstByte,
                             secondByte));
-                } else {
                     this.wildcards ^= (1 << 1); // Sync with 0F 1.0 Match
                 }
                 if ((this.dataLayerVirtualLanTCIMask & 0xe000) != 0) {
                     // else if its a vlan pcp mask
                     // extract the vlan pcp
                     super.setDataLayerVirtualLanPriorityCodePoint(getVlanPCP(firstByte));
-                } else {
                     this.wildcards ^= (1 << 20);
                 }
                 this.dlVlanTCIState = MatchFieldState.MATCH_FIELD_WITH_MASK;
@@ -864,6 +862,8 @@ public class V6Match extends OFMatch implements Cloneable {
                 super.setDataLayerVirtualLan(getVlanID(firstByte, secondByte));
                 this.dlVlanTCIState = MatchFieldState.MATCH_FIELD_ONLY;
                 this.match_len += 6;
+                this.wildcards ^= (1 << 1); // Sync with 0F 1.0 Match
+                this.wildcards ^= (1 << 20);
             }
         }
     }
@@ -1216,8 +1216,6 @@ public class V6Match extends OFMatch implements Cloneable {
                 // ipv4 dest processing
                 this.wildcards ^= (((1 << 5) - 1) << 14);
             }
-        } else {
-            this.wildcards = 0;
         }
     }
 
index a751948de7d5a73d22696f66a0bcefb15ca82b53..96f0d80022a5be59ea716d46b2cf8c5e26d20f1b 100644 (file)
@@ -18,9 +18,6 @@ import java.util.List;
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.controller.protocol_plugin.openflow.vendorextension.v6extension.V6Match;
-import org.openflow.protocol.OFMatch;
-import org.openflow.protocol.action.OFAction;
-
 import org.opendaylight.controller.sal.action.Action;
 import org.opendaylight.controller.sal.action.Flood;
 import org.opendaylight.controller.sal.action.FloodAll;
@@ -46,6 +43,9 @@ import org.opendaylight.controller.sal.utils.EtherTypes;
 import org.opendaylight.controller.sal.utils.IPProtocols;
 import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
 import org.opendaylight.controller.sal.utils.NodeCreator;
+import org.openflow.protocol.OFMatch;
+import org.openflow.protocol.action.OFAction;
+import org.openflow.util.U32;
 
 public class FlowProgrammerServiceTest {
 
@@ -298,6 +298,16 @@ public class FlowProgrammerServiceTest {
          */
         FlowConverter salToOF = new FlowConverter(aFlow);
         V6Match v6Match = (V6Match) salToOF.getOFMatch();
+        // need this hardcoding here to make the test pass.
+        // this should not be a problem in actual code.
+        // in the test the sal match is converted to a V6 match.
+        // we lose the wildcard info as the V6 match is used for nicira extensions
+        // and nicira deals with wildcards in a different way.
+        // converting the V6 match back to sal match is not going to preserve the wildcard info.
+        // and we need the wildcard info for reading the vlan pcp now.
+        // when creating a V6Match using the readFrom method
+        // we do convert the nicira extensions format correctly to populate the wildcard info.
+        v6Match.setWildcards(U32.t(Long.valueOf(~OFMatch.OFPFW_DL_VLAN_PCP)));
         List<OFAction> ofActions = salToOF.getOFActions();
 
         /*
index 7782aa9093762c1041775a6cf0f7bde1d0093e84..abbc43809db820b888827b47bcda908a3a05f2e5 100644 (file)
@@ -17,6 +17,7 @@ import java.util.Arrays;
 import org.junit.Assert;
 import org.junit.Test;
 import org.openflow.protocol.OFMatch;
+import org.openflow.util.U32;
 
 public class V6ExtensionTest {
 
@@ -52,20 +53,18 @@ public class V6ExtensionTest {
         match.fromString("input_port=1");
         match.fromString("dl_dst=20:A0:11:10:00:99");
         match.fromString("dl_src=00:10:08:22:12:75");
-
         match.fromString("ip_src=10.1.1.1");
         match.fromString("ip_dst=1.2.3.4");
         match.fromString("eth_type=0x800");
         match.fromString("dl_vlan=10");
-        match.fromString("dl_vpcp=1");
         match.fromString("nw_proto=6");
         match.fromString("nw_tos=100");
         match.fromString("tp_dst=8080");
         match.fromString("tp_src=60");
+        match.fromString("dl_vpcp=1");
 
         Assert.assertTrue(match.getInputPort() == 1);
         // Assert.assertTrue(match.getIPv6MatchLen()==6);
-
         ofm.setInputPort((short) 1);
         // V6Match is meant for IPv6, but if using OFMatch, it will be set to
         // IPv4 values, as OF1.0 doesn't support IPv6.
@@ -89,6 +88,13 @@ public class V6ExtensionTest {
         ofm.setTransportSource((short) 60);
         ofm.setTransportDestination((short) 8080);
 
+        // this v6match ctor now looks at the wildcard field to
+        // determine if vlan pcp has been set
+        // so set the wildcards appropriately to reflect that vlan pcp
+        // has been set.
+        int wildcards = OFMatch.OFPFW_ALL;
+        wildcards &= ~OFMatch.OFPFW_DL_VLAN_PCP;
+        ofm.setWildcards(U32.t(Long.valueOf(wildcards)));
         V6Match match3 = new V6Match(ofm);
 
         Assert.assertTrue(match.getInputPort() == match3.getInputPort());
index 00eacdfce6b9eba6fed4b472a95f4a265748877b..c265760b97d28ff95210822e7bb0bf02293af925 100644 (file)
@@ -373,11 +373,11 @@ one.lib.nav = {
 
 one.lib.helper = {
     parseInt : function(value) {
-        return (value !== null && value !== '') ?
+        return (value != null && value.trim() !== '') ?
             parseInt(value) : ''
     },
     parseFloat : function(value) {
-        return (value !== null && value !== '') ?
+        return (value != null && value.trim() !== '') ?
             parseFloat(value) : ''
     }
 }
index 6d79f3cb05cc7faf2469e3144fb6be44d9d21e81..36b5043dd94ebf6956c499da4ad4909864a9c936 100644 (file)
@@ -62,7 +62,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 public class Troubleshoot implements IDaylightWeb {
     private static final UserLevel AUTH_LEVEL = UserLevel.CONTAINERUSER;
     private static final List<String> flowStatsColumnNames = Arrays.asList("Node", "In Port",
-            "DL Src", "DL Dst", "DL Type", "DL Vlan", "NW Src", "NW Dst","ToS Bits",
+            "DL Src", "DL Dst", "DL Type", "DL Vlan","Vlan Priority", "NW Src", "NW Dst","ToS Bits",
             "NW Proto", "TP Src", "TP Dst", "Actions", "Bytes", "Packets",
             "Time (s)", "Timeout (s)",
             "Priority");
@@ -314,6 +314,19 @@ public class Troubleshoot implements IDaylightWeb {
         } else {
             row.put(MatchType.DL_VLAN.id(), "*");
         }
+        //Vlan Priority
+        if (match.isPresent(MatchType.DL_VLAN_PR)) {
+            if (((Byte) flow.getMatch().getField(MatchType.DL_VLAN_PR).getValue())
+                    .shortValue() < 0) {
+                row.put(MatchType.DL_VLAN_PR.id(), "0");
+            } else {
+                row.put(MatchType.DL_VLAN_PR.id(), ((Byte) flow.getMatch()
+                        .getField(MatchType.DL_VLAN_PR).getValue()).toString());
+            }
+        } else {
+            row.put(MatchType.DL_VLAN_PR.id(), "*");
+        }
+
         if (match.isPresent(MatchType.NW_SRC)) {
             row.put(MatchType.NW_SRC.id(), ((InetAddress) flow.getMatch()
                     .getField(MatchType.NW_SRC).getValue()).getHostAddress());
@@ -407,7 +420,7 @@ public class Troubleshoot implements IDaylightWeb {
         row.put("durationSeconds",
                 ((Integer) flowOnNode.getDurationSeconds()).toString());
         row.put("idleTimeout", ((Short) flow.getIdleTimeout()).toString());
-        row.put("priority", String.valueOf(flow.getPriority()));
+        row.put("priority", String.valueOf(NetUtils.getUnsignedShort(flow.getPriority())));
         return row;
     }
 
index 4b5e51a0718377e449c799dd807cc2cf798992ec..4bc4c76fc4c7edadf6f8e4994890a162044d76b7 100644 (file)
@@ -363,6 +363,11 @@ one.f.troubleshooting.existingNodes = {
                             label: 'DL Vlan',
                             sortable: true
                         },
+                        {
+                            property: 'dlVlanPriority',
+                            label: 'Vlan PCP',
+                            sortable: true
+                        },
                         {
                             property: 'nwSrc',
                             label: 'NW Src',