X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fpacket%2FTCPTest.java;h=e56f41e5c1b301cf78eb8e1e5df3f29fcbe1e7e2;hp=3e18aedfdb38b7238ef9a72c9d49bff151aec685;hb=3ce420ccd45e7530c2c2158bd57462fd5859a879;hpb=7701de28ee54185d7151b4bd6d7dca3057c0028d diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/TCPTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/TCPTest.java index 3e18aedfdb..e56f41e5c1 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/TCPTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/TCPTest.java @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013-2014 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -12,6 +12,8 @@ package org.opendaylight.controller.sal.packet; import junit.framework.Assert; import org.junit.Test; +import org.opendaylight.controller.sal.match.Match; +import org.opendaylight.controller.sal.match.MatchType; public class TCPTest { @@ -113,4 +115,18 @@ public class TCPTest { short checksum = tcp.getChecksum(); Assert.assertTrue(checksum == 200); } + + @Test + public void testGetMatch() throws Exception { + TCP tcp = new TCP(); + short sport = (short) 52012; + short dport = (short) 40345; + tcp.setSourcePort(sport); + tcp.setDestinationPort(dport); + + Match match = tcp.getMatch(); + + Assert.assertEquals(sport, (short) match.getField(MatchType.TP_SRC).getValue()); + Assert.assertEquals(dport, (short) match.getField(MatchType.TP_DST).getValue()); + } }