Adding Set Next Hop action
[controller.git] / opendaylight / sal / api / src / test / java / org / opendaylight / controller / sal / action / ActionTest.java
index 6858494283a2ec6cf0ee0e56e57d88d5a3ce5960..4fd59790034d413034f7c4209e473c357f2aefa7 100644 (file)
@@ -156,7 +156,7 @@ public class ActionTest {
         try {
             ip = InetAddress.getByName("2001:420:281:1003:f2de:f1ff:fe71:728d");
         } catch (UnknownHostException e) {
-            logger.error("",e);
+            logger.error("", e);
         }
         action = new SetNwSrc(ip);
         Assert.assertTrue(action.isValid());
@@ -172,7 +172,7 @@ public class ActionTest {
 
         action = new SetNwTos(0x40);
         Assert.assertFalse(action.isValid());
-        
+
         action = new SetNwTos(0xff1);
         Assert.assertFalse(action.isValid());
 
@@ -206,6 +206,29 @@ public class ActionTest {
         Assert.assertFalse(action.isValid());
     }
 
+    @Test
+    public void testNextHopActionCreation() {
+        SetNextHop action = null;
+
+        InetAddress ip = null;
+        try {
+            ip = InetAddress.getByName("171.71.9.52");
+        } catch (UnknownHostException e) {
+            logger.error("", e);
+        }
+
+        action = new SetNextHop(ip);
+        Assert.assertTrue(action.getAddress().equals(ip));
+
+        try {
+            ip = InetAddress.getByName("2001:420:281:1003:f2de:f1ff:fe71:728d");
+        } catch (UnknownHostException e) {
+            logger.error("", e);
+        }
+        action = new SetNextHop(ip);
+        Assert.assertTrue(action.getAddress().equals(ip));
+    }
+
     @Test
     public void testActionList() {
         List<Action> actions = new ArrayList<Action>();