2 * Copyright (c) 2013 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 org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flowflag;
10 import java.math.BigInteger;
11 import org.junit.Assert;
12 import org.junit.Before;
13 import org.junit.Test;
14 import org.opendaylight.openflowplugin.api.OFConstants;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
19 * match conversion and injection test
21 public class FlowFlagReactorTest {
23 private FlowModFlags[] flowFlags;
30 flowFlags = new FlowModFlags[] {
31 new FlowModFlags(true, true, true, true, true),
32 new FlowModFlags(false, false, false, false, false),
33 new FlowModFlags(true, false, true, false, true)
38 * convert for OF-1.3, inject into {@link FlowModInputBuilder}
41 public void testMatchConvertorV13_flow() {
42 FlowModInputBuilder target = new FlowModInputBuilder();
43 for (FlowModFlags fFlag : flowFlags) {
44 target.setFlags(null);
45 FlowFlagReactor.getInstance().convert(fFlag,
46 OFConstants.OFP_VERSION_1_3, target,BigInteger.valueOf(1));
47 Assert.assertNotNull(target.getFlags());
52 * convert for OF-1.0, inject into {@link FlowModInputBuilder}
55 public void testMatchConvertorV10_flow() {
56 FlowModInputBuilder target = new FlowModInputBuilder();
57 for (FlowModFlags fFlag : flowFlags) {
58 target.setFlagsV10(null);
59 FlowFlagReactor.getInstance().convert(fFlag,
60 OFConstants.OFP_VERSION_1_0, target,BigInteger.valueOf(1));
61 Assert.assertNotNull(target.getFlagsV10());