X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Faction%2FActionTest.java;h=4fd59790034d413034f7c4209e473c357f2aefa7;hb=20d6b967b3d425a4514000c7e77b2e5339763ba8;hp=eeddc0b9b0dc33df0424936535907ef651b13d4f;hpb=0462ef3bfb5ee79460e73e103e347ad8ec4a2e34;p=controller.git diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/action/ActionTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/action/ActionTest.java index eeddc0b9b0..4fd5979003 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/action/ActionTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/action/ActionTest.java @@ -35,8 +35,12 @@ import org.opendaylight.controller.sal.core.Node; import org.opendaylight.controller.sal.core.NodeConnector; import org.opendaylight.controller.sal.utils.EtherTypes; import org.opendaylight.controller.sal.utils.NodeConnectorCreator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ActionTest { + protected static final Logger logger = LoggerFactory + .getLogger(ActionTest.class); @Test public void tesActionCreationValidation() { Action action = new PopVlan(); @@ -140,7 +144,7 @@ public class ActionTest { try { ip = InetAddress.getByName("171.71.9.52"); } catch (UnknownHostException e) { - e.printStackTrace(); + logger.error("",e); } action = new SetNwSrc(ip); @@ -152,7 +156,7 @@ public class ActionTest { try { ip = InetAddress.getByName("2001:420:281:1003:f2de:f1ff:fe71:728d"); } catch (UnknownHostException e) { - e.printStackTrace(); + logger.error("", e); } action = new SetNwSrc(ip); Assert.assertTrue(action.isValid()); @@ -163,9 +167,12 @@ public class ActionTest { action = new SetNwTos(0xf); Assert.assertTrue(action.isValid()); - action = new SetNwTos(0xff); + action = new SetNwTos(0x3f); Assert.assertTrue(action.isValid()); + action = new SetNwTos(0x40); + Assert.assertFalse(action.isValid()); + action = new SetNwTos(0xff1); Assert.assertFalse(action.isValid()); @@ -199,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 actions = new ArrayList(); @@ -219,7 +249,7 @@ public class ActionTest { try { ip = InetAddress.getByName("1.1.1.1"); } catch (UnknownHostException e) { - e.printStackTrace(); + logger.error("",e); } actions.add(new SetDlSrc(mac));