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.flow.flowflag;
10 import org.junit.Assert;
11 import org.junit.Before;
12 import org.junit.Test;
13 import org.opendaylight.openflowplugin.api.OFConstants;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
18 * match conversion and injection test
20 public class FlowFlagReactorTest {
22 private FlowModFlags[] flowFlags;
29 flowFlags = new FlowModFlags[] {
30 new FlowModFlags(true, true, true, true, true),
31 new FlowModFlags(false, false, false, false, false),
32 new FlowModFlags(true, false, true, false, true)
37 * convert for OF-1.3, inject into {@link FlowModInputBuilder}
40 public void testMatchConvertorV13_flow() {
41 FlowModInputBuilder target = new FlowModInputBuilder();
42 for (FlowModFlags fFlag : flowFlags) {
43 target.setFlags(null);
44 FlowFlagReactor.getInstance().convert(fFlag,
45 OFConstants.OFP_VERSION_1_3, target);
46 Assert.assertNotNull(target.getFlags());
51 * convert for OF-1.0, inject into {@link FlowModInputBuilder}
54 public void testMatchConvertorV10_flow() {
55 FlowModInputBuilder target = new FlowModInputBuilder();
56 for (FlowModFlags fFlag : flowFlags) {
57 target.setFlagsV10(null);
58 FlowFlagReactor.getInstance().convert(fFlag,
59 OFConstants.OFP_VERSION_1_0, target);
60 Assert.assertNotNull(target.getFlagsV10());