2 * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
9 package org.opendaylight.openflowjava.protocol.impl.util;
\r
11 import org.junit.Assert;
\r
12 import org.junit.Test;
\r
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10;
\r
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10;
\r
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10;
\r
18 * @author michal.polkorab
\r
21 public class OpenflowUtilsTest {
\r
24 * Tests {@link OpenflowUtils#createPortState(long)}
\r
27 public void testPortState() {
\r
28 PortStateV10 state = OpenflowUtils.createPortState(512L);
\r
29 Assert.assertEquals("Wrong port state",
\r
30 new PortStateV10(false, false, false, false, true, false, true, false), state);
\r
32 state = OpenflowUtils.createPortState(1793L);
\r
33 Assert.assertEquals("Wrong port state",
\r
34 new PortStateV10(false, true, false, true, true, true, false, true), state);
\r
36 state = OpenflowUtils.createPortState(1L);
\r
37 Assert.assertEquals("Wrong port state",
\r
38 new PortStateV10(false, true, false, false, false, false, true, false), state);
\r
42 * Tests {@link OpenflowUtils#createPortConfig(long)}
\r
45 public void testPortConfig() {
\r
46 PortConfigV10 config = OpenflowUtils.createPortConfig(127L);
\r
47 Assert.assertEquals("Wrong port config",
\r
48 new PortConfigV10(true, true, true, true, true, true, true), config);
\r
50 config = OpenflowUtils.createPortConfig(0L);
\r
51 Assert.assertEquals("Wrong port config",
\r
52 new PortConfigV10(false, false, false, false, false, false, false), config);
\r
56 * Tests {@link OpenflowUtils#createPortFeatures(long)}
\r
59 public void testPortFeatures() {
\r
60 PortFeaturesV10 features = OpenflowUtils.createPortFeatures(4095L);
\r
61 Assert.assertEquals("Wrong port features", new PortFeaturesV10(true, true, true, true, true, true, true,
\r
62 true, true, true, true, true), features);
\r
64 features = OpenflowUtils.createPortFeatures(0L);
\r
65 Assert.assertEquals("Wrong port features", new PortFeaturesV10(false, false, false, false, false, false,
\r
66 false, false, false, false, false, false), features);
\r