2 * Copyright (c) 2014, 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package test.mock.util;
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.QueueBuilder;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.QueueKey;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId;
15 import java.util.Random;
17 public class QueueMockGenerator {
18 private static final Random rnd = new Random();
19 private static final QueueBuilder queueBuilder = new QueueBuilder();
21 public static Queue getRandomQueue() {
22 queueBuilder.setKey(new QueueKey(new QueueId(TestUtils.nextLong(0, 4294967295L))));
23 queueBuilder.setPort(TestUtils.nextLong(0, 4294967295L));
24 queueBuilder.setProperty(rnd.nextInt(65535));
25 return queueBuilder.build();
28 public static Queue getRandomQueueWithPortNum(long portNum) {
29 queueBuilder.setKey(new QueueKey(new QueueId(TestUtils.nextLong(0, 4294967295L))));
30 queueBuilder.setPort(portNum);
31 queueBuilder.setProperty(rnd.nextInt(65535));
32 return queueBuilder.build();