Toshio Koide | 80db184 | 2014-08-11 17:08:32 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.matchaction; |
| 2 | |
| 3 | import static org.junit.Assert.assertEquals; |
| 4 | |
| 5 | import java.util.LinkedList; |
| 6 | import java.util.List; |
| 7 | |
| 8 | import net.floodlightcontroller.util.MACAddress; |
| 9 | import net.onrc.onos.core.matchaction.action.Action; |
| 10 | import net.onrc.onos.core.matchaction.action.ModifyDstMacAction; |
| 11 | import net.onrc.onos.core.matchaction.match.PacketMatchBuilder; |
| 12 | import net.onrc.onos.core.util.SwitchPort; |
| 13 | |
| 14 | import org.junit.Test; |
| 15 | |
| 16 | public 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 Milkey | 9ed4b96 | 2014-08-20 15:43:40 -0700 | [diff] [blame] | 25 | MatchAction ma = new MatchAction(new MatchActionId(1L), port, builder.build(), actions); |
Toshio Koide | 80db184 | 2014-08-11 17:08:32 -0700 | [diff] [blame] | 26 | |
| 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 | } |