/*
- * 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,
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 {
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());
+ }
}