Sho SHIMIZU | 7226e01 | 2014-08-14 14:21:30 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.newintent; |
| 2 | |
| 3 | import net.onrc.onos.api.flowmanager.FlowId; |
| 4 | import net.onrc.onos.api.flowmanager.PacketPathFlow; |
| 5 | import net.onrc.onos.api.flowmanager.Path; |
| 6 | import net.onrc.onos.api.newintent.IntentId; |
| 7 | import net.onrc.onos.api.newintent.IntentTest; |
| 8 | import net.onrc.onos.core.matchaction.action.Action; |
| 9 | import net.onrc.onos.core.matchaction.match.PacketMatch; |
| 10 | import net.onrc.onos.core.matchaction.match.PacketMatchBuilder; |
| 11 | import net.onrc.onos.core.util.PortNumber; |
| 12 | |
| 13 | import java.util.Collections; |
| 14 | |
| 15 | /** |
| 16 | * Suite of tests of {@link PathFlowIntent}. |
| 17 | */ |
| 18 | public class PathFlowIntentTest extends IntentTest { |
| 19 | |
| 20 | private final IntentId intentId1 = new IntentId(123); |
| 21 | private final IntentId intentId2 = new IntentId(456); |
Toshio Koide | 515ba84 | 2014-08-20 11:53:37 -0700 | [diff] [blame] | 22 | private final FlowId flowId1 = new FlowId(1L); |
Sho SHIMIZU | 7226e01 | 2014-08-14 14:21:30 -0700 | [diff] [blame] | 23 | private final PacketMatch match = new PacketMatchBuilder().build(); |
| 24 | private final PortNumber port = new PortNumber((short) 1); |
| 25 | |
| 26 | /** |
| 27 | * Creates a PathFlowIntent. |
| 28 | * |
| 29 | * @return PathFlowIntent |
| 30 | */ |
| 31 | @Override |
| 32 | protected PathFlowIntent createOne() { |
| 33 | return new PathFlowIntent( |
| 34 | intentId1, |
| 35 | new PacketPathFlow(flowId1, match, port, |
| 36 | new Path(), Collections.<Action>emptyList(), 0, 0) |
| 37 | ); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Creates another PathFlowIntent, which is different from the intent created by {@link #createOne()}. |
| 42 | * |
| 43 | * @return another PathFlowIntent |
| 44 | */ |
| 45 | @Override |
| 46 | protected PathFlowIntent createAnother() { |
| 47 | return new PathFlowIntent( |
| 48 | intentId2, |
| 49 | new PacketPathFlow(flowId1, match, port, |
| 50 | new Path(), Collections.<Action>emptyList(), 0, 0) |
| 51 | ); |
| 52 | } |
| 53 | } |