2 * Copyright (c) 2014 Pantheon Technologies s.r.o. 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
9 package org.opendaylight.openflowjava.protocol.impl.util;
11 import org.junit.Assert;
12 import org.junit.Test;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10;
18 * @author michal.polkorab
21 public class OpenflowUtilsTest {
24 * Tests {@link OpenflowUtils#createPortState(long)}
27 public void testPortState() {
28 PortStateV10 state = OpenflowUtils.createPortState(512L);
29 Assert.assertEquals("Wrong port state",
30 new PortStateV10(false, false, false, false, true, false, true, false), state);
32 state = OpenflowUtils.createPortState(1793L);
33 Assert.assertEquals("Wrong port state",
34 new PortStateV10(false, true, false, true, true, true, false, true), state);
36 state = OpenflowUtils.createPortState(1L);
37 Assert.assertEquals("Wrong port state",
38 new PortStateV10(false, true, false, false, false, false, true, false), state);
42 * Tests {@link OpenflowUtils#createPortConfig(long)}
45 public void testPortConfig() {
46 PortConfigV10 config = OpenflowUtils.createPortConfig(127L);
47 Assert.assertEquals("Wrong port config",
48 new PortConfigV10(true, true, true, true, true, true, true), config);
50 config = OpenflowUtils.createPortConfig(0L);
51 Assert.assertEquals("Wrong port config",
52 new PortConfigV10(false, false, false, false, false, false, false), config);
56 * Tests {@link OpenflowUtils#createPortFeatures(long)}
59 public void testPortFeatures() {
60 PortFeaturesV10 features = OpenflowUtils.createPortFeatures(4095L);
61 Assert.assertEquals("Wrong port features", new PortFeaturesV10(true, true, true, true, true, true, true,
62 true, true, true, true, true), features);
64 features = OpenflowUtils.createPortFeatures(0L);
65 Assert.assertEquals("Wrong port features", new PortFeaturesV10(false, false, false, false, false, false,
66 false, false, false, false, false, false), features);