Sho SHIMIZU | 15ed4fd | 2014-08-05 14:40:42 -0700 | [diff] [blame] | 1 | package net.onrc.onos.api.newintent; |
| 2 | |
| 3 | import net.onrc.onos.core.util.LinkTuple; |
| 4 | import net.onrc.onos.core.util.SwitchPort; |
| 5 | import org.junit.Test; |
| 6 | |
| 7 | import java.util.Arrays; |
| 8 | import java.util.List; |
| 9 | |
| 10 | import static org.junit.Assert.assertEquals; |
| 11 | |
| 12 | public class PathIntentTest extends ConnectivityIntentTest { |
| 13 | public static final SwitchPort P1_2 = new SwitchPort(111, (short) 0x11); |
| 14 | public static final SwitchPort P2_2 = new SwitchPort(222, (short) 0x22); |
| 15 | public static final SwitchPort P3_2 = new SwitchPort(333, (short) 0x33); |
| 16 | |
| 17 | private static final List<LinkTuple> PATH1 = Arrays.asList( |
| 18 | new LinkTuple(P1_2, P2_2) |
| 19 | ); |
| 20 | private static final List<LinkTuple> PATH2 = Arrays.asList( |
| 21 | new LinkTuple(P1_2, P3_2) |
| 22 | ); |
| 23 | |
| 24 | @Test |
| 25 | public void basics() { |
| 26 | PathIntent intent = createOne(); |
| 27 | assertEquals("incorrect id", IID, intent.getId()); |
| 28 | assertEquals("incorrect match", MATCH, intent.getMatch()); |
| 29 | assertEquals("incorrect action", NOP, intent.getAction()); |
| 30 | assertEquals("incorrect ingress", P1, intent.getIngressPort()); |
| 31 | assertEquals("incorrect egress", P2, intent.getEgressPort()); |
| 32 | assertEquals("incorrect path", PATH1, intent.getPath()); |
| 33 | } |
| 34 | |
| 35 | @Override |
| 36 | protected PathIntent createOne() { |
| 37 | return new PathIntent(IID, MATCH, NOP, P1, P2, PATH1); |
| 38 | } |
| 39 | |
| 40 | @Override |
| 41 | protected PathIntent createAnother() { |
| 42 | return new PathIntent(IID, MATCH, NOP, P1, P3, PATH2); |
| 43 | } |
| 44 | } |