Grep not working for Karaf commands 85/85285/4
authorgobinath <gobinath@ericsson.com>
Tue, 4 Sep 2018 06:45:45 +0000 (12:15 +0530)
committerShweta Chaturvedi <shweta.chaturvedi@ericsson.com>
Mon, 18 Nov 2019 06:58:06 +0000 (12:28 +0530)
SupressWarnings is used to suppress checkstyle warnings thrown upon
using System.out

This covers the changes for "southbound-cli" in openflowplugin

Change-Id: I3491068d5cb14cfac8afe42f648445fcd7f0cdc1
Signed-off-by: gobinath <gobinath@ericsson.com>
applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/cli/GetAllNodesCommandProvider.java
applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/cli/Reconciliation.java
applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/cli/ReconciliationCount.java
applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/cli/ShowNodeCommandProvider.java

index 2e42c6edaab0f598cc622b9ae7b9c1c8ea2911e4..196887453cf76d247419f25726ddfced23885ceb 100644 (file)
@@ -34,19 +34,20 @@ public class GetAllNodesCommandProvider extends OsgiCommandSupport {
         this.nodeListener = nodeListener;
     }
 
+    @SuppressWarnings("checkstyle:RegexpSinglelineJava")
     @Override
     protected Object doExecute() throws Exception {
         List<OFNode> ofNodeList = ShellUtil.getAllNodes(nodeListener);
         if (ofNodeList.isEmpty()) {
-            session.getConsole().println("No node is connected yet");
+            System.out.println("No node is connected yet");
         } else {
             StringBuilder stringBuilder = new StringBuilder();
             Formatter formatter = new Formatter(stringBuilder);
-            session.getConsole().println("Number of nodes: " + ofNodeList.size());
-            session.getConsole().println(getAllLocalNodesHeaderOutput());
-            session.getConsole().println("--------------------------------------------------------------------------");
+            System.out.println("Number of nodes: " + ofNodeList.size());
+            System.out.println(getAllLocalNodesHeaderOutput());
+            System.out.println("--------------------------------------------------------------------------");
             for (OFNode ofNode : ofNodeList) {
-                session.getConsole().println(formatter.format("%-15s %3s %-15s %n",
+                System.out.println(formatter.format("%-15s %3s %-15s %n",
                         ofNode.getNodeId(), "", ofNode.getNodeName()).toString());
                 stringBuilder.setLength(0);
             }
@@ -61,4 +62,4 @@ public class GetAllNodesCommandProvider extends OsgiCommandSupport {
         formatter.close();
         return header;
     }
-}
+}
\ No newline at end of file
index 22680290019a75dcb0647d9a4c6727a99496e149..b1dee8a8df33188380a2730e18ee52210f5666a3 100644 (file)
@@ -43,6 +43,7 @@ public class Reconciliation extends OsgiCommandSupport {
     @Option(name = "-all", description = "Reconcile all operative NODEs")
     boolean reconcileAllNodes;
 
+    @SuppressWarnings("checkstyle:RegexpSinglelineJava")
     @Override
     protected Object doExecute() throws Exception {
         List<Uint64> nodes = nodeIds == null
@@ -55,10 +56,10 @@ public class Reconciliation extends OsgiCommandSupport {
         try {
             RpcResult<ReconcileOutput> rpcResult = rpcOutput.get();
             if (rpcResult.isSuccessful()) {
-                session.getConsole().println("Reconciliation triggered for the node(s)");
+                System.out.println("Reconciliation triggered for the node(s)");
                 printInProgressNodes(rpcResult.getResult());
             } else {
-                session.getConsole().println(rpcResult.getErrors().stream().findFirst().get().getMessage());
+                System.out.println(rpcResult.getErrors().stream().findFirst().get().getMessage());
             }
         } catch (ExecutionException e) {
             LOG.error("Error occurred while invoking reconcile RPC for node {}", nodes, e);
@@ -66,15 +67,16 @@ public class Reconciliation extends OsgiCommandSupport {
         return null;
     }
 
+    @SuppressWarnings("checkstyle:RegexpSinglelineJava")
     private void printInProgressNodes(ReconcileOutput reconcileOutput) {
         List<Uint64> inprogressNodes = reconcileOutput.getInprogressNodes();
         if (inprogressNodes.size() > 0) {
             StringBuilder stringBuilder = new StringBuilder();
             final Formatter formatter = new Formatter(stringBuilder);
-            session.getConsole().println(getReconcileHeaderOutput());
-            session.getConsole().println("----------------------------------------------------");
+            System.out.println(getReconcileHeaderOutput());
+            System.out.println("----------------------------------------------------");
             for (Uint64 node : inprogressNodes) {
-                session.getConsole().println(formatter.format("%-15s %n", node).toString());
+                System.out.println(formatter.format("%-15s %n",node).toString());
                 stringBuilder.setLength(0);
             }
         }
index 7d2f254788e03d186bee43cd8c2b16867b8026ef..d2b783d8aa85de134e4516450374d0a752d1fd66 100644 (file)
@@ -26,19 +26,20 @@ public class ReconciliationCount extends OsgiCommandSupport {
         this.dataBroker = dataBroker;
     }
 
+    @SuppressWarnings("checkstyle:RegexpSinglelineJava")
     @Override
     protected Object doExecute() {
         List<ReconcileCounter> result = ShellUtil.getReconcileCount(dataBroker);
         if (result.isEmpty()) {
-            session.getConsole().println("Reconciliation count not yet available for openflow nodes.");
+            System.out.println("Reconciliation count not yet available for openflow nodes.");
         } else {
             StringBuilder stringBuilder = new StringBuilder();
             final Formatter formatter = new Formatter(stringBuilder);
-            session.getConsole().println(getReconcileCountHeaderOutput());
-            session.getConsole().println("--------------------------------------------------------------------------"
+            System.out.println(getReconcileCountHeaderOutput());
+            System.out.println("--------------------------------------------------------------------------"
                     + "---------------------------");
             for (ReconcileCounter reconcile : result) {
-                session.getConsole().println(formatter.format("%-15s %3s %-15s %9s %-20s %4s %-20s %n",
+                System.out.println(formatter.format("%-15s %3s %-15s %9s %-20s %4s %-20s %n",
                         reconcile.getNodeId(), "", reconcile.getSuccessCount(), "", reconcile.getFailureCount(), "",
                         reconcile.getLastRequestTime().getValue()).toString());
                 stringBuilder.setLength(0);
index 5519f71e4018a62c50c85c2d14eb729927522131..77825dd7b503c8f83dd54e71b4f1c0eb4e379c15 100644 (file)
@@ -31,10 +31,11 @@ public class ShowNodeCommandProvider extends OsgiCommandSupport {
         this.dataBroker = dataBroker;
     }
 
+    @SuppressWarnings("checkstyle:RegexpSinglelineJava")
     @Override
     protected Object doExecute() {
         if (nodeId == null) {
-            session.getConsole().println("NodeID not specified");
+            System.out.println("NodeID not specified");
             return null;
         }
         OFNode node = ShellUtil.getNode(Long.parseLong(nodeId), dataBroker);
@@ -43,20 +44,22 @@ public class ShowNodeCommandProvider extends OsgiCommandSupport {
             printHeaderSeparator();
             printNodeOutput(node);
         } else {
-            session.getConsole().println("No node available for this NodeID");
+            System.out.println("No node available for this NodeID");
         }
         return null;
     }
 
+    @SuppressWarnings("checkstyle:RegexpSinglelineJava")
     private void printNodeHeaderOutput() {
         Formatter formatter = new Formatter();
         String header = formatter.format(OUTPUT_FORMAT, "NodeId", "Name", "Ports").toString();
         formatter.close();
-        session.getConsole().println(header);
+        System.out.println(header);
     }
 
+    @SuppressWarnings("checkstyle:RegexpSinglelineJava")
     private void printHeaderSeparator() {
-        session.getConsole().println(HEADER_SEPARATOR);
+        System.out.println(HEADER_SEPARATOR);
     }
 
     @SuppressWarnings("checkstyle:RegexpSinglelineJava")