blob: 2684f1999f1c7af2d24c4f98326a07df829e0e81 [file] [log] [blame]
Toshio Koide80db1842014-08-11 17:08:32 -07001package net.onrc.onos.core.matchaction;
2
3import static org.junit.Assert.assertEquals;
4
5import java.util.LinkedList;
6import java.util.List;
7
8import net.floodlightcontroller.util.MACAddress;
9import net.onrc.onos.core.matchaction.action.Action;
10import net.onrc.onos.core.matchaction.action.ModifyDstMacAction;
11import net.onrc.onos.core.matchaction.match.PacketMatchBuilder;
12import net.onrc.onos.core.util.SwitchPort;
13
14import org.junit.Test;
15
16public class MatchActionTest {
17
18 @Test
19 public void testConstructor() {
20 SwitchPort port = new SwitchPort(123L, (short) 55);
21 PacketMatchBuilder builder = new PacketMatchBuilder();
22 builder.setDstTcpPort((short) 80);
23 List<Action> actions = new LinkedList<Action>();
24 actions.add(new ModifyDstMacAction(MACAddress.valueOf("00:01:02:03:04:05")));
Ray Milkey9ed4b962014-08-20 15:43:40 -070025 MatchAction ma = new MatchAction(new MatchActionId(1L), port, builder.build(), actions);
Toshio Koide80db1842014-08-11 17:08:32 -070026
27 assertEquals(actions, ma.getActions());
28 assertEquals("1", ma.getId().toString());
29 assertEquals(builder.build(), ma.getMatch());
30 assertEquals(port, ma.getSwitchPort());
31 }
32
33}