Revert "Checkstyle enforcer"
[controller.git] / opendaylight / samples / loadbalancer / src / main / java / org / opendaylight / controller / samples / loadbalancer / LBUtil.java
index aa195a34e9ceb9487291e4e9f020f8b1acec7244..c320250084150ddaac6f4337430b33eea8c9940f 100644 (file)
@@ -19,36 +19,36 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Class defines utilty methods that will be used by different components
- * of the load balancer service
+ * Class defines utilty methods that will be used by different components 
+ * of the load balancer service 
  *
  */
 public class LBUtil {
-
+    
     private static final Logger lbuLogger = LoggerFactory.getLogger(LBUtil.class);
-
+    
     public LBUtil(){}
-
+    
     /**
-     * Extract the details of the source machine that sent this packet 'inPkt'
-     * @param inPkt Packet that is received by the controller
-     * @return  Details of the source machine in Client object.
+     * Extract the details of the source machine that sent this packet 'inPkt'  
+     * @param inPkt    Packet that is received by the controller
+     * @return Details of the source machine in Client object.
      */
     public Client getClientFromPacket(IPv4 inPkt){
         lbuLogger.info("Find client information from packet : {}",inPkt.toString());
-
+        
         String ip = NetUtils.getInetAddress(inPkt.getSourceAddress()).getHostAddress();
-
+        
         String protocol = IPProtocols.getProtocolName(inPkt.getProtocol());
-
+        
         lbuLogger.info("client ip {} and protocl {}",ip,protocol);
-
+        
         Packet tpFrame= inPkt.getPayload();
-
+        
         lbuLogger.info("Get protocol layer {}",tpFrame.toString());
-
+        
         short port = 0;
-
+        
         if(protocol.equals(IPProtocols.TCP.toString())){
             TCP tcpFrame = (TCP)tpFrame;
             port = tcpFrame.getSourcePort();
@@ -56,47 +56,47 @@ public class LBUtil {
             UDP udpFrame = (UDP)tpFrame;
             port = udpFrame.getSourcePort();
         }
-
+        
         lbuLogger.info("Found port {}",port);
-
+        
         Client source = new Client(ip, protocol,port);
-
+        
         lbuLogger.info("Client information : {}",source.toString());
-
+        
         return source;
     }
-
+    
     /**
      * Extract the details of the destination machine where this packet 'inPkt' need
      * to be delivered
      * @param inPkt Packet that is received by controller for forwarding
-     * @return  Details of the destination machine packet in VIP
+     * @return Details of the destination machine packet in VIP
      */
     public VIP getVIPFromPacket(IPv4 inPkt){
-
+        
         lbuLogger.info("Find VIP information from packet : {}",inPkt.toString());
-
+        
         String ip = NetUtils.getInetAddress(inPkt.getDestinationAddress()).getHostAddress();
-
+        
         String protocol = IPProtocols.getProtocolName(inPkt.getProtocol());
-
+        
         Packet tpFrame= inPkt.getPayload();
-
+        
         short port = 0;
-
+        
         if(protocol.equals(IPProtocols.TCP.toString())){
             TCP tcpFrame = (TCP)tpFrame;
             port = tcpFrame.getDestinationPort();
         }else{
-
+            
             UDP udpFrame = (UDP)tpFrame;
             port = udpFrame.getDestinationPort();
         }
-
+        
         VIP dest = new VIP(null,ip, protocol,port,null);
-
+        
         lbuLogger.info("VIP information : {}",dest.toString());
-
+        
         return dest;
     }
 }
\ No newline at end of file