X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fmatch%2FMatchTest.java;h=ae78e1acc8af45f8ef879b0ad16477bf9040330a;hb=3e5c78a72ae6b2341240bee8f122b990427f1ee0;hp=55b5cabf11c30f11a54ba1e10769e864106441a2;hpb=a498db663d69f6331bd6081b7091de381be81677;p=controller.git diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java index 55b5cabf11..ae78e1acc8 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java @@ -137,6 +137,44 @@ public class MatchTest { Assert.assertTrue(o.equals(proto)); } + @Test + public void testSetTpSrc() { + // Minimum value validation. + Match match = new Match(); + short tp_src = 0; + match.setField(MatchType.TP_SRC, tp_src); + + Object o = match.getField(MatchType.TP_SRC).getValue(); + Assert.assertTrue(o.equals(tp_src)); + + // Maximum value validation. + match = new Match(); + tp_src = (short) 0xffff; + match.setField(MatchType.TP_SRC, tp_src); + + o = match.getField(MatchType.TP_SRC).getValue(); + Assert.assertTrue(o.equals(tp_src)); + } + + @Test + public void testSetTpDst() { + // Minimum value validation. + Match match = new Match(); + short tp_dst = 0; + match.setField(MatchType.TP_DST, tp_dst); + + Object o = match.getField(MatchType.TP_DST).getValue(); + Assert.assertTrue(o.equals(tp_dst)); + + // Maximum value validation. + match = new Match(); + tp_dst = (short) 0xffff; + match.setField(MatchType.TP_DST, tp_dst); + + o = match.getField(MatchType.TP_DST).getValue(); + Assert.assertTrue(o.equals(tp_dst)); + } + @Test public void testMatchMask() { Match x = new Match();