BUG-2637: migration consequence - fix unit test
[controller.git] / opendaylight / md-sal / statistics-manager / src / test / java / test / mock / util / FlowMockGenerator.java
1 package test.mock.util;
2
3 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
4 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
5 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
6 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
7 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
8
9 import java.math.BigInteger;
10 import java.util.Random;
11
12 public class FlowMockGenerator {
13     private static final Random rnd = new Random();
14     private static final FlowBuilder flowBuilder = new FlowBuilder();
15
16     public static Flow getRandomFlow() {
17         flowBuilder.setKey(new FlowKey(new FlowId("flow." + rnd.nextInt(1000))));
18         flowBuilder.setOutGroup(TestUtils.nextLong(0, 4294967296L));
19         flowBuilder.setTableId((short) rnd.nextInt(256));
20         flowBuilder.setOutPort(BigInteger.valueOf(TestUtils.nextLong(0, Long.MAX_VALUE)));
21         flowBuilder.setStrict(rnd.nextBoolean());
22         flowBuilder.setContainerName("container." + rnd.nextInt(1000));
23         flowBuilder.setBarrier(rnd.nextBoolean());
24         flowBuilder.setMatch(MatchMockGenerator.getRandomMatch());
25         flowBuilder.setPriority(rnd.nextInt(65535));
26         flowBuilder.setCookie(new FlowCookie(BigInteger.valueOf(TestUtils.nextLong(0, Long.MAX_VALUE))));
27         flowBuilder.setCookieMask(flowBuilder.getCookie());
28         return flowBuilder.build();
29     }
30 }