- Added OSGI cmd to display TLS configuration
[controller.git] / opendaylight / protocol_plugins / openflow / src / main / java / org / opendaylight / controller / protocol_plugin / openflow / core / internal / Controller.java
index f3004acaba5a3cb6c9ffb287bd968599283f1001..32cdeaa614e55264e397085c1e9ff05174fd6aff 100644 (file)
@@ -9,6 +9,7 @@
 
 package org.opendaylight.controller.protocol_plugin.openflow.core.internal;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
@@ -338,6 +339,28 @@ public class Controller implements IController, CommandProvider {
         }
     }
 
+    public void _controllerShowConnConfig(CommandInterpreter ci) {
+       String str = System.getProperty("secureChannelEnabled");
+        if ((str != null) && (str.trim().equalsIgnoreCase("true"))) { 
+            ci.print("The Controller and Switch should communicate through TLS connetion.\n");         
+
+               String keyStoreFile = System.getProperty("controllerKeyStore");
+               String trustStoreFile = System.getProperty("controllerTrustStore");
+               if ((keyStoreFile == null) || keyStoreFile.trim().isEmpty()) {          
+                ci.print("controllerKeyStore not specified in ./configuration/config.ini\n");                                  
+               } else {
+                ci.print("controllerKeyStore=" + keyStoreFile + "\n");         
+               }
+               if ((trustStoreFile == null) || trustStoreFile.trim().isEmpty()) {      
+                ci.print("controllerTrustStore not specified in ./configuration/config.ini\n");                                                                
+               } else {
+                ci.print("controllerTrustStore=" + trustStoreFile + "\n");             
+               }
+        } else {
+            ci.print("The Controller and Switch should communicate through TCP connetion.\n");         
+        }
+    }
+
     private void registerWithOSGIConsole() {
         BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass())
                 .getBundleContext();
@@ -351,6 +374,7 @@ public class Controller implements IController, CommandProvider {
         help.append("--Open Flow Controller --\n");
         help.append("\tcontrollerShowSwitches\n");
         help.append("\tcontrollerReset\n");
+        help.append("\tcontrollerShowConnConfig\n");
         return help.toString();
     }
 }