Fix installInHw handling in FlowConfig 68/1568/1
authorAlessandro Boch <aboch@cisco.com>
Tue, 1 Oct 2013 02:25:08 +0000 (19:25 -0700)
committerAlessandro Boch <aboch@cisco.com>
Tue, 1 Oct 2013 02:27:37 +0000 (19:27 -0700)
Change-Id: I1a78614e04c0d2b1c345c7d4538003aa790ea8ec
Signed-off-by: Alessandro Boch <aboch@cisco.com>
opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowConfig.java
opendaylight/forwardingrulesmanager/api/src/test/java/org/opendaylight/controller/forwardingrulesmanager/frmTest.java

index e0b8e9a..c57dca2 100644 (file)
@@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import org.opendaylight.controller.forwardingrulesmanager.FlowEntry;
 import org.opendaylight.controller.sal.action.Action;
 import org.opendaylight.controller.sal.action.ActionType;
 import org.opendaylight.controller.sal.action.Controller;
 import org.opendaylight.controller.sal.action.Action;
 import org.opendaylight.controller.sal.action.ActionType;
 import org.opendaylight.controller.sal.action.Controller;
@@ -188,13 +189,13 @@ public class FlowConfig implements Serializable {
     public boolean installInHw() {
         if (installInHw == null) {
             // backward compatibility
     public boolean installInHw() {
         if (installInHw == null) {
             // backward compatibility
-            installInHw = "true";
+            installInHw = Boolean.toString(true);
         }
         }
-        return installInHw.equals("true");
+        return Boolean.valueOf(installInHw);
     }
 
     public void setInstallInHw(boolean inHw) {
     }
 
     public void setInstallInHw(boolean inHw) {
-        installInHw = inHw ? "true" : "false";
+        installInHw = String.valueOf(inHw);
     }
 
     public String getInstallInHw() {
     }
 
     public String getInstallInHw() {
@@ -1072,7 +1073,7 @@ public class FlowConfig implements Serializable {
     }
 
     public void toggleInstallation() {
     }
 
     public void toggleInstallation() {
-        installInHw = (installInHw == null) ? "true" : (installInHw.equals("true")) ? "false" : "true";
+        installInHw = (installInHw == null) ? Boolean.toString(false) : Boolean.toString(!Boolean.valueOf(installInHw));
     }
 
     /*
     }
 
     /*
index a3e1ded..4069707 100644 (file)
@@ -469,13 +469,14 @@ public class frmTest {
 
     @Test
     public void testStatusToggle() throws UnknownHostException {
 
     @Test
     public void testStatusToggle() throws UnknownHostException {
+        // default is install in Hw
         FlowConfig fc = new FlowConfig();
         fc.toggleInstallation();
         FlowConfig fc = new FlowConfig();
         fc.toggleInstallation();
-        Assert.assertTrue(fc.installInHw());
-        fc.toggleInstallation();
         Assert.assertFalse(fc.installInHw());
         fc.toggleInstallation();
         Assert.assertTrue(fc.installInHw());
         Assert.assertFalse(fc.installInHw());
         fc.toggleInstallation();
         Assert.assertTrue(fc.installInHw());
+        fc.toggleInstallation();
+        Assert.assertFalse(fc.installInHw());
 
     }
 
 
     }