Add missing license headers
[openflowplugin.git] / applications / statistics-manager / src / test / java / test / mock / util / PortMockGenerator.java
1 /*
2  * Copyright (c) 2014, 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package test.mock.util;
9
10
11 import java.util.Random;
12
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortKey;
18
19 public class PortMockGenerator {
20     private static final Random rnd = new Random();
21     private static final PortBuilder portBuilder = new PortBuilder();
22
23     public static Port getRandomPort() {
24         portBuilder.setKey(new PortKey(TestUtils.nextLong(0, 4294967295L)));
25         portBuilder.setBarrier(rnd.nextBoolean());
26         portBuilder.setPortNumber(new PortNumberUni(TestUtils.nextLong(0, 4294967295L)));
27         portBuilder.setConfiguration(new PortConfig(rnd.nextBoolean(), rnd.nextBoolean(), rnd.nextBoolean(), rnd.nextBoolean()));
28         return portBuilder.build();
29     }
30 }