* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.openflow.md.core.extension;
import static org.junit.Assert.assertEquals;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
import org.opendaylight.yangtools.yang.binding.DataContainer;
+import org.opendaylight.yangtools.yang.common.Uint32;
/**
* Created by Martin Bobak mbobak@cisco.com on 9/17/14.
ExperimenterIdCaseBuilder experimenterIdCaseBuilder = new ExperimenterIdCaseBuilder();
ExperimenterBuilder experimenterBuilder = new ExperimenterBuilder();
- experimenterBuilder.setExperimenter(new ExperimenterId(42L));
+ experimenterBuilder.setExperimenter(new ExperimenterId(Uint32.valueOf(42)));
experimenterIdCaseBuilder.setExperimenter(experimenterBuilder.build());
actionBuilder.setActionChoice(experimenterIdCaseBuilder.build());
Action action = ActionExtensionHelper.processAlienAction(actionBuilder.build(), OpenflowVersion.OF13,
return MockAction.class;
}
}
-
}
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.ExperimenterActionSubType;
+import org.opendaylight.yangtools.yang.common.Uint32;
/**
* {@link ExtensionConverterManagerImpl} test.
@Before
public void setUp() {
manager = new ExtensionConverterManagerImpl();
- keyFromOFJava = new ExperimenterActionSerializerKey((short) 1, 42L, ExpSubType.class);
+ keyFromOFJava = new ExperimenterActionSerializerKey((short) 1, Uint32.valueOf(42), ExpSubType.class);
regFromOFJava = manager.registerActionConvertor(keyFromOFJava, extConvertorFromOFJava);
keyToOFJava = new TypeVersionKey<>(ActionExpCase.class, (short) 1);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList;
+import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
public class GroupConvertorTest {
private ConvertorManager convertorManager;
final AddGroupInputBuilder addGroupBuilder = new AddGroupInputBuilder();
- addGroupBuilder.setGroupId(new GroupId(10L));
+ addGroupBuilder.setGroupId(new GroupId(Uint32.TEN));
addGroupBuilder.setGroupType(GroupTypes.GroupAll);
final List<Bucket> bucketList = new ArrayList<>();
final BucketsBuilder bucketsB = new BucketsBuilder();
final BucketBuilder bucketB = new BucketBuilder();
- bucketB.setWeight(10);
- bucketB.setWatchPort(20L);
- bucketB.setWatchGroup(22L);
+ bucketB.setWeight(Uint16.TEN);
+ bucketB.setWatchPort(Uint32.valueOf(20));
+ bucketB.setWatchGroup(Uint32.valueOf(22));
bucketB.withKey(new BucketKey(new BucketId(Uint32.ZERO)));
bucketB.setAction(actionsList);
bucketList.add(bucket); // List of bucket
final BucketBuilder bucketB1 = new BucketBuilder();
- bucketB1.setWeight(50);
- bucketB1.setWatchPort(60L);
- bucketB1.setWatchGroup(70L);
+ bucketB1.setWeight(Uint16.valueOf(50));
+ bucketB1.setWatchPort(Uint32.valueOf(60));
+ bucketB1.setWatchGroup(Uint32.valueOf(70));
bucketB1.withKey(new BucketKey(new BucketId(Uint32.ONE)));
// Action1
// Action2:
final SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
- setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
+ setMplsTtlActionBuilder.setMplsTtl(Uint8.ONE);
final SetMplsTtlAction setMAction = setMplsTtlActionBuilder.build();
final ActionBuilder actionsB3 = new ActionBuilder();
assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action
.rev150203.actions.grouping.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping
- .action.choice.group._case.GroupActionBuilder().setGroupId(5L).build()).build()).build(),
+ .action.choice.group._case.GroupActionBuilder().setGroupId(Uint32.valueOf(5)).build())
+ .build()).build(),
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
- .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(5L).build()).build())
+ .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(Uint32.valueOf(5))
+ .build()).build())
.build()), outActionList);
assertEquals(50, outAddGroupInput.getBucketsList().get(1).getWeight().toJava());
assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action
.rev150203.actions.grouping.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping
- .action.choice.group._case.GroupActionBuilder().setGroupId(5L).build()).build()).build(),
+ .action.choice.group._case.GroupActionBuilder().setGroupId(Uint32.valueOf(5)).build()).build())
+ .build(),
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
- .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(5L).build()).build())
+ .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(Uint32.valueOf(5))
+ .build()).build())
.build()), outActionList1);
}
public void testGroupModConvertorNoBucket() {
final AddGroupInputBuilder addGroupBuilder = new AddGroupInputBuilder();
- addGroupBuilder.setGroupId(new GroupId(10L));
+ addGroupBuilder.setGroupId(new GroupId(Uint32.TEN));
addGroupBuilder.setGroupType(GroupTypes.GroupAll);
final AddGroupInputBuilder addGroupBuilder = new AddGroupInputBuilder();
- addGroupBuilder.setGroupId(new GroupId(10L));
+ addGroupBuilder.setGroupId(new GroupId(Uint32.TEN));
addGroupBuilder.setGroupType(GroupTypes.GroupFf);
final List<Bucket> bucketList = new ArrayList<>();
assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
.actions.grouping.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
- .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(5L).build()).build())
+ .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(Uint32.valueOf(5L))
+ .build()).build())
.build(),
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
- .action.grouping.action.choice.group._case.GroupActionBuilder().setGroupId(6L)
- .build()).build()).build()), outActionList);
+ .action.grouping.action.choice.group._case.GroupActionBuilder()
+ .setGroupId(Uint32.valueOf(6)).build()).build()).build()), outActionList);
final List<Action> outActionList1 = outAddGroupInput.getBucketsList().get(1).getAction();
assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
.ActionBuilder().setActionChoice(new SetMplsTtlCaseBuilder().setSetMplsTtlAction(
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
.action.grouping.action.choice.set.mpls.ttl._case.SetMplsTtlActionBuilder()
- .setMplsTtl((short) 1).build()).build()).build()), outActionList1);
+ .setMplsTtl(Uint8.ONE).build()).build()).build()), outActionList1);
}
/**
final ArrayList<Bucket> bucket = new ArrayList<>();
bucket.add(new BucketBuilder()
- .setBucketId(new BucketId((long) 4))
- .setWatchPort((long)2)
- .setWatchGroup((long) 1)
+ .setBucketId(new BucketId(Uint32.valueOf(4)))
+ .setWatchPort(Uint32.TWO)
+ .setWatchGroup(Uint32.ONE)
.setAction(ImmutableList.of(new ActionBuilder()
.setOrder(0)
.setAction(new OutputActionCaseBuilder()
.build());
bucket.add(new BucketBuilder()
- .setBucketId(new BucketId((long) 3))
- .setWatchPort((long)6)
- .setWatchGroup((long) 1)
+ .setBucketId(new BucketId(Uint32.valueOf(3)))
+ .setWatchPort(Uint32.valueOf(6))
+ .setWatchGroup(Uint32.ONE)
.setAction(ImmutableList.of(new ActionBuilder()
.setOrder(0)
.setAction(new OutputActionCaseBuilder()
.build());
bucket.add(new BucketBuilder()
- .setBucketId(new BucketId((long) 2))
- .setWatchPort((long)5)
- .setWatchGroup((long) 1)
+ .setBucketId(new BucketId(Uint32.TWO))
+ .setWatchPort(Uint32.valueOf(5))
+ .setWatchGroup(Uint32.ONE)
.setAction(ImmutableList.of(new ActionBuilder()
.setOrder(0)
.setAction(new OutputActionCaseBuilder()
.build());
bucket.add(new BucketBuilder()
- .setBucketId(new BucketId((long) 1))
- .setWatchPort((long)4)
- .setWatchGroup((long) 1)
+ .setBucketId(new BucketId(Uint32.ONE))
+ .setWatchPort(Uint32.valueOf(4))
+ .setWatchGroup(Uint32.ONE)
.setAction(ImmutableList.of(new ActionBuilder()
.setOrder(0)
.setAction(new OutputActionCaseBuilder()
.build());
bucket.add(new BucketBuilder()
- .setBucketId(new BucketId((long) 0))
- .setWatchPort((long)3)
- .setWatchGroup((long) 1)
+ .setBucketId(new BucketId(Uint32.ZERO))
+ .setWatchPort(Uint32.valueOf(3))
+ .setWatchGroup(Uint32.ONE)
.setAction(ImmutableList.of(new ActionBuilder()
.setOrder(0)
.setAction(new OutputActionCaseBuilder()
final AddGroupInput input = new AddGroupInputBuilder()
- .setGroupId(new GroupId((long) 1))
+ .setGroupId(new GroupId(Uint32.ONE))
.setGroupName("Foo")
.setGroupType(GroupTypes.GroupFf)
.setBuckets(new BucketsBuilder()
private static ActionBuilder assembleSetMplsTtlActionBuilder(final int actionOrder) {
final SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
- setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
+ setMplsTtlActionBuilder.setMplsTtl(Uint8.ONE);
final SetMplsTtlActionCaseBuilder setMplsTtlActionCaseBuilder = new SetMplsTtlActionCaseBuilder();
setMplsTtlActionCaseBuilder.setSetMplsTtlAction(setMplsTtlActionBuilder.build());
final ActionBuilder actionsB3 = new ActionBuilder();
final AddGroupInputBuilder addGroupBuilder = new AddGroupInputBuilder();
- addGroupBuilder.setGroupId(new GroupId(10L));
+ addGroupBuilder.setGroupId(new GroupId(Uint32.TEN));
addGroupBuilder.setGroupType(GroupTypes.GroupAll);
final List<Bucket> bucketList = new ArrayList<>();
assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
.actions.grouping.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
- .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(5L).build())
+ .grouping.action.choice.group._case.GroupActionBuilder()
+ .setGroupId(Uint32.valueOf(5)).build())
.build()).build(),
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
.action.grouping.action.choice.group._case.GroupActionBuilder()
- .setGroupId(6L).build()).build()).build()), outActionList);
+ .setGroupId(Uint32.valueOf(6)).build()).build()).build()), outActionList);
final List<Action> outActionList1 = outAddGroupInput.getBucketsList().get(1).getAction();
assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
.actions.grouping.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
- .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(5L).build())
+ .grouping.action.choice.group._case.GroupActionBuilder()
+ .setGroupId(Uint32.valueOf(5)).build())
.build()).build(),
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
.action.grouping.action.choice.group._case.GroupActionBuilder()
- .setGroupId(6L).build()).build()).build()), outActionList1);
+ .setGroupId(Uint32.valueOf(6)).build()).build()).build()), outActionList1);
}
private GroupModInputBuilder convert(final Group group, final VersionDatapathIdConvertorData data) {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsListBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.multipart.reply.group.desc.GroupDesc;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.multipart.reply.group.desc.GroupDescBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
/**
* Unit tests for GroupDescStats conversion.
public void testSingleGroupDescStat() {
GroupDescBuilder builder = new GroupDescBuilder();
builder.setType(GroupType.OFPGTALL);
- builder.setGroupId(new GroupId(42L));
+ builder.setGroupId(new GroupId(Uint32.valueOf(42)));
builder.setBucketsList(new ArrayList<>());
List<GroupDesc> groupDescStats = new ArrayList<>();
groupDescStats.add(builder.build());
// **********************************************
GroupDescBuilder builder = new GroupDescBuilder();
builder.setType(GroupType.OFPGTFF);
- builder.setGroupId(new GroupId(42L));
+ builder.setGroupId(new GroupId(Uint32.valueOf(42)));
// Buckets for first group desc
BucketsListBuilder bucketsBuilder = new BucketsListBuilder();
- bucketsBuilder.setWeight(16);
- bucketsBuilder.setWatchPort(new PortNumber(84L));
- bucketsBuilder.setWatchGroup(168L);
+ bucketsBuilder.setWeight(Uint16.valueOf(16));
+ bucketsBuilder.setWatchPort(new PortNumber(Uint32.valueOf(84)));
+ bucketsBuilder.setWatchGroup(Uint32.valueOf(168));
// Actions for buckets for first group desc
List<Action> actions = new ArrayList<>();
// **********************************************
builder = new GroupDescBuilder();
builder.setType(GroupType.OFPGTINDIRECT);
- builder.setGroupId(new GroupId(50L));
+ builder.setGroupId(new GroupId(Uint32.valueOf(50)));
// First buckets for second group desc
bucketsList = new ArrayList<>();
bucketsBuilder = new BucketsListBuilder();
- bucketsBuilder.setWeight(100);
- bucketsBuilder.setWatchPort(new PortNumber(200L));
- bucketsBuilder.setWatchGroup(400L);
+ bucketsBuilder.setWeight(Uint16.valueOf(100));
+ bucketsBuilder.setWatchPort(new PortNumber(Uint32.valueOf(200)));
+ bucketsBuilder.setWatchGroup(Uint32.valueOf(400));
// Actions for first buckets for second group desc
actions = new ArrayList<>();
// Second buckets for second group desc
bucketsBuilder = new BucketsListBuilder();
- bucketsBuilder.setWeight(5);
- bucketsBuilder.setWatchPort(new PortNumber(10L));
- bucketsBuilder.setWatchGroup(15L);
+ bucketsBuilder.setWeight(Uint16.valueOf(5));
+ bucketsBuilder.setWatchPort(new PortNumber(Uint32.TEN));
+ bucketsBuilder.setWatchGroup(Uint32.valueOf(15));
// Actions for second buckets for second group desc
actions = new ArrayList<>();
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
-import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.GroupStatsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.group.stats.BucketStats;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.group.stats.BucketStatsBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
/**
* Unit tests for GroupStats conversion.
@Test
public void testSingleGroupStat() {
GroupStatsBuilder statsBuilder = new GroupStatsBuilder();
- statsBuilder.setByteCount(new BigInteger("12345"));
- statsBuilder.setDurationNsec(1000000L);
- statsBuilder.setDurationSec(5000L);
- statsBuilder.setGroupId(new GroupId(42L));
- statsBuilder.setPacketCount(new BigInteger("54321"));
- statsBuilder.setRefCount(24L);
+ statsBuilder.setByteCount(Uint64.valueOf(12345));
+ statsBuilder.setDurationNsec(Uint32.valueOf(1000000));
+ statsBuilder.setDurationSec(Uint32.valueOf(5000));
+ statsBuilder.setGroupId(new GroupId(Uint32.valueOf(42)));
+ statsBuilder.setPacketCount(Uint64.valueOf(54321));
+ statsBuilder.setRefCount(Uint32.valueOf(24));
statsBuilder.setBucketStats(new ArrayList<BucketStats>());
List<GroupStats> groupStats = new ArrayList<>();
groupStats.add(statsBuilder.build());
@Test
public void testTwoGroupStats() {
GroupStatsBuilder statsBuilder = new GroupStatsBuilder();
- statsBuilder.setByteCount(new BigInteger("12345"));
- statsBuilder.setDurationNsec(1000000L);
- statsBuilder.setDurationSec(5000L);
- statsBuilder.setGroupId(new GroupId(42L));
- statsBuilder.setPacketCount(new BigInteger("54321"));
- statsBuilder.setRefCount(24L);
+ statsBuilder.setByteCount(Uint64.valueOf(12345));
+ statsBuilder.setDurationNsec(Uint32.valueOf(1000000));
+ statsBuilder.setDurationSec(Uint32.valueOf(5000));
+ statsBuilder.setGroupId(new GroupId(Uint32.valueOf(42)));
+ statsBuilder.setPacketCount(Uint64.valueOf(54321));
+ statsBuilder.setRefCount(Uint32.valueOf(24));
statsBuilder.setBucketStats(new ArrayList<BucketStats>());
List<GroupStats> groupStats = new ArrayList<>();
groupStats.add(statsBuilder.build());
statsBuilder = new GroupStatsBuilder();
- statsBuilder.setByteCount(new BigInteger("1"));
- statsBuilder.setDurationNsec(2L);
- statsBuilder.setDurationSec(3L);
- statsBuilder.setGroupId(new GroupId(4L));
- statsBuilder.setPacketCount(new BigInteger("5"));
- statsBuilder.setRefCount(6L);
- statsBuilder.setBucketStats(new ArrayList<BucketStats>());
+ statsBuilder.setByteCount(Uint64.ONE);
+ statsBuilder.setDurationNsec(Uint32.valueOf(2));
+ statsBuilder.setDurationSec(Uint32.valueOf(3));
+ statsBuilder.setGroupId(new GroupId(Uint32.valueOf(4)));
+ statsBuilder.setPacketCount(Uint64.valueOf(5));
+ statsBuilder.setRefCount(Uint32.valueOf(6));
+ statsBuilder.setBucketStats(new ArrayList<>());
groupStats.add(statsBuilder.build());
Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply
@Test
public void testGroupStatsWithBuckets() {
GroupStatsBuilder statsBuilder = new GroupStatsBuilder();
- statsBuilder.setByteCount(new BigInteger("12345"));
- statsBuilder.setDurationNsec(1000000L);
- statsBuilder.setDurationSec(5000L);
- statsBuilder.setGroupId(new GroupId(42L));
- statsBuilder.setPacketCount(new BigInteger("54321"));
- statsBuilder.setRefCount(24L);
+ statsBuilder.setByteCount(Uint64.valueOf(12345));
+ statsBuilder.setDurationNsec(Uint32.valueOf(1000000));
+ statsBuilder.setDurationSec(Uint32.valueOf(5000));
+ statsBuilder.setGroupId(new GroupId(Uint32.valueOf(42)));
+ statsBuilder.setPacketCount(Uint64.valueOf(54321));
+ statsBuilder.setRefCount(Uint32.valueOf(24));
List<BucketStats> bucketStats = new ArrayList<>();
BucketStatsBuilder bucketStatsBuilder = new BucketStatsBuilder();
- bucketStatsBuilder.setByteCount(new BigInteger("987"));
- bucketStatsBuilder.setPacketCount(new BigInteger("654"));
+ bucketStatsBuilder.setByteCount(Uint64.valueOf(987));
+ bucketStatsBuilder.setPacketCount(Uint64.valueOf(654));
bucketStats.add(bucketStatsBuilder.build());
bucketStatsBuilder = new BucketStatsBuilder();
- bucketStatsBuilder.setByteCount(new BigInteger("123"));
- bucketStatsBuilder.setPacketCount(new BigInteger("456"));
+ bucketStatsBuilder.setByteCount(Uint64.valueOf(123));
+ bucketStatsBuilder.setPacketCount(Uint64.valueOf(456));
bucketStats.add(bucketStatsBuilder.build());
statsBuilder.setBucketStats(bucketStats);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.config._case.multipart.reply.meter.config.meter.config.Bands;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.config._case.multipart.reply.meter.config.meter.config.BandsBuilder;
import org.opendaylight.yangtools.yang.binding.DataContainer;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class MeterConfigStatsResponseConvertorTest {
private static final int PRESET_COUNT = 7;
List<MeterConfig> meterConfigs = new ArrayList<>();
MeterConfigBuilder meterConfigBuilder = new MeterConfigBuilder();
for (int i = 0; i < PRESET_COUNT; i++) {
- meterConfigBuilder.setMeterId(new MeterId((long) i));
+ meterConfigBuilder.setMeterId(new MeterId(Uint32.valueOf(i)));
List<Bands> bandses = new ArrayList<>();
BandsBuilder bandsBuilder = new BandsBuilder();
// InstanceIdentifier.builder().node(Nodes.class).node(Node.class,
// key).build();
- addMeterFromSAL
- .setMeterId(new org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId(10L));
+ addMeterFromSAL.setMeterId(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId(Uint32.TEN));
MeterFlags flagV = new MeterFlags(true, true, true, true);
addMeterFromSAL.setFlags(flagV);
@Test
public void testMeterModCommandConvertorwithNoFlags() {
- long burstSize = 10L;
- long dropRate = 20L;
+ final Uint32 burstSize = Uint32.TEN;
+ final Uint32 dropRate = Uint32.valueOf(20);
// / DROP Band
MeterBandTypesBuilder meterBandTypesB = new MeterBandTypesBuilder();
final MeterBandHeader meterBH = meterBandHeaderBuilder.build();
// DSCP Mark
- final long dscpRemarkBurstSize = 11L;
- final long dscpRemarkRate = 21L;
- final short dscpPercLevel = 1;
+ final Uint32 dscpRemarkBurstSize = Uint32.valueOf(11);
+ final Uint32 dscpRemarkRate = Uint32.valueOf(21);
+ final Uint8 dscpPercLevel = Uint8.ONE;
MeterBandTypesBuilder meterBandTypesB1 = new MeterBandTypesBuilder();
MeterBandType bandFlag1 = new MeterBandType(false, true, false);
final MeterBandHeader meterBH1 = meterBandHeaderBuilder1.build();
// Experimental
- final long expBurstSize = 12L;
- final long expRate = 22L;
- final long expExperimenter = 23L;
+ final Uint32 expBurstSize = Uint32.valueOf(12);
+ final Uint32 expRate = Uint32.valueOf(22);
+ final Uint32 expExperimenter = Uint32.valueOf(23);
MeterBandTypesBuilder meterBandTypesB2 = new MeterBandTypesBuilder();
MeterBandType bandFlag2 = new MeterBandType(false, false, true);
// InstanceIdentifier.builder().node(Nodes.class).node(Node.class,
// key).build();
- addMeterFromSAL
- .setMeterId(new org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId(10L));
-
+ addMeterFromSAL.setMeterId(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId(Uint32.TEN));
AddMeterInput meterInputCommand = addMeterFromSAL.build();
MeterModInputBuilder outMeterModInput = convert(meterInputCommand, new VersionConvertorData((short) 0X4));
assertEquals(MeterModCommand.OFPMCADD, outMeterModInput.getCommand());
assertFalse(outMeterModInput.getFlags().isOFPMFBURST());
assertTrue(outMeterModInput.getFlags().isOFPMFPKTPS());
- assertEquals(Uint32.valueOf(10L), outMeterModInput.getMeterId().getValue());
+ assertEquals(Uint32.TEN, outMeterModInput.getMeterId().getValue());
// BandInformation starts here:
List<Bands> bands = outMeterModInput.getBands();
if (meterBand instanceof MeterBandDropCase) {
assertEquals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731
.MeterBandType.OFPMBTDROP, ((MeterBandDropCase) meterBand).getMeterBandDrop().getType());
- assertEquals(burstSize, ((MeterBandDropCase) meterBand).getMeterBandDrop().getBurstSize().toJava());
- assertEquals(dropRate, ((MeterBandDropCase) meterBand).getMeterBandDrop().getRate().toJava());
+ assertEquals(burstSize, ((MeterBandDropCase) meterBand).getMeterBandDrop().getBurstSize());
+ assertEquals(dropRate, ((MeterBandDropCase) meterBand).getMeterBandDrop().getRate());
}
if (meterBand instanceof MeterBandDscpRemarkCase) {
.MeterBandType.OFPMBTDSCPREMARK,
((MeterBandDscpRemarkCase) meterBand).getMeterBandDscpRemark().getType());
assertEquals(dscpRemarkBurstSize,
- ((MeterBandDscpRemarkCase) meterBand).getMeterBandDscpRemark().getBurstSize().toJava());
+ ((MeterBandDscpRemarkCase) meterBand).getMeterBandDscpRemark().getBurstSize());
assertEquals(dscpRemarkRate,
- ((MeterBandDscpRemarkCase) meterBand).getMeterBandDscpRemark().getRate().toJava());
+ ((MeterBandDscpRemarkCase) meterBand).getMeterBandDscpRemark().getRate());
assertEquals(dscpPercLevel,
- ((MeterBandDscpRemarkCase) meterBand).getMeterBandDscpRemark().getPrecLevel().toJava());
+ ((MeterBandDscpRemarkCase) meterBand).getMeterBandDscpRemark().getPrecLevel());
}
if (meterBand instanceof MeterBandExperimenterCase) {
.MeterBandType.OFPMBTEXPERIMENTER,
((MeterBandExperimenterCase) meterBand).getMeterBandExperimenter().getType());
assertEquals(expBurstSize,
- ((MeterBandExperimenterCase) meterBand).getMeterBandExperimenter().getBurstSize().toJava());
+ ((MeterBandExperimenterCase) meterBand).getMeterBandExperimenter().getBurstSize());
assertEquals(expRate,
- ((MeterBandExperimenterCase) meterBand).getMeterBandExperimenter().getRate().toJava());
+ ((MeterBandExperimenterCase) meterBand).getMeterBandExperimenter().getRate());
ExperimenterIdMeterBand expBand = ((MeterBandExperimenterCase) meterBand).getMeterBandExperimenter()
.augmentation(ExperimenterIdMeterBand.class);
- assertEquals(expExperimenter, expBand.getExperimenter().getValue().toJava());
+ assertEquals(expExperimenter, expBand.getExperimenter().getValue());
}
}
}
// InstanceIdentifier.builder().node(Nodes.class).node(Node.class,
// key).build();
- addMeterFromSAL
- .setMeterId(new org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId(10L));
+ addMeterFromSAL.setMeterId(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId(Uint32.TEN));
MeterFlags flagV = new MeterFlags(true, true, true, true);
addMeterFromSAL.setFlags(flagV);
meterBandTypesB1.setFlags(bandFlag1);
DscpRemarkBuilder dscp = new DscpRemarkBuilder();
- dscp.setDscpRemarkBurstSize(11L);
- dscp.setDscpRemarkRate(21L);
- dscp.setPrecLevel((short) 1);
+ dscp.setDscpRemarkBurstSize(Uint32.valueOf(11));
+ dscp.setDscpRemarkRate(Uint32.valueOf(21));
+ dscp.setPrecLevel(Uint8.ONE);
DscpRemark dscpRemark = dscp.build();
MeterBandHeaderBuilder meterBandHeaderBuilder1 = new MeterBandHeaderBuilder();
// Experimental
ExperimenterBuilder exp = new ExperimenterBuilder();
- exp.setExperimenterBurstSize(12L);
- exp.setExperimenterRate(22L);
- exp.setExperimenter(23L);
+ exp.setExperimenterBurstSize(Uint32.valueOf(12));
+ exp.setExperimenterRate(Uint32.valueOf(22));
+ exp.setExperimenter(Uint32.valueOf(23));
Experimenter experimenter = exp.build();
MeterBandHeaderBuilder meterBandHeaderBuilder2 = new MeterBandHeaderBuilder();
// InstanceIdentifier.builder().node(Nodes.class).node(Node.class,
// key).build();
- addMeterFromSAL
- .setMeterId(new org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId(10L));
+ addMeterFromSAL.setMeterId(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId(Uint32.TEN));
MeterFlags flagV = new MeterFlags(true, true, true, true);
addMeterFromSAL.setFlags(flagV);
import static org.junit.Assert.assertEquals;
-import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
allMeterStats = new ArrayList<>();
MeterStatsBuilder meterStatsBuilder = new MeterStatsBuilder();
for (int i = 0; i < PRESET_COUNT; i++) {
- meterStatsBuilder.setByteInCount(BigInteger.valueOf(i));
- meterStatsBuilder.setDurationNsec((long) 1000 * i);
- meterStatsBuilder.setDurationSec((long) 10 * i);
- meterStatsBuilder.setFlowCount((long) i);
+ meterStatsBuilder.setByteInCount(Uint64.valueOf(i));
+ meterStatsBuilder.setDurationNsec(Uint32.valueOf(1000 * i));
+ meterStatsBuilder.setDurationSec(Uint32.valueOf(10 * i));
+ meterStatsBuilder.setFlowCount(Uint32.valueOf(i));
MeterBandStatsBuilder meterBandStatsBuilder = new MeterBandStatsBuilder();
List<MeterBandStats> meterBandStatses = new ArrayList<>();
for (int j = 0; j < PRESET_COUNT; j++) {
- meterBandStatsBuilder.setByteBandCount(BigInteger.valueOf(j));
- meterBandStatsBuilder.setPacketBandCount(BigInteger.valueOf(j));
+ meterBandStatsBuilder.setByteBandCount(Uint64.valueOf(j));
+ meterBandStatsBuilder.setPacketBandCount(Uint64.valueOf(j));
meterBandStatses.add(meterBandStatsBuilder.build());
}
meterStatsBuilder.setMeterBandStats(meterBandStatses);
- meterStatsBuilder.setMeterId(new MeterId((long) i));
- meterStatsBuilder.setPacketInCount(BigInteger.valueOf(i));
+ meterStatsBuilder.setMeterId(new MeterId(Uint32.valueOf(i)));
+ meterStatsBuilder.setPacketInCount(Uint64.valueOf(i));
allMeterStats.add(meterStatsBuilder.build());
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
import java.math.BigInteger;
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInputBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint64;
import org.opendaylight.yangtools.yang.common.Uint8;
/**
* Created by Jakub Toth jatoth@cisco.com on 9/23/14.
*/
-
public class PacketOutConvertorTest {
private ConvertorManager convertorManager;
Assert.assertEquals(buildActionForNullTransmitPacketInputAction(nodeConnKey, version), message.getAction());
Assert.assertEquals(OFConstants.OFP_NO_BUFFER, message.getBufferId());
- Assert.assertEquals(new PortNumber(0xfffffffdL), message.getInPort());
+ Assert.assertEquals(new PortNumber(Uint32.valueOf(0xfffffffdL)), message.getInPort());
Assert.assertEquals(Uint8.valueOf(version), message.getVersion());
Assert.assertEquals(xid, message.getXid());
Assert.assertArrayEquals(transmitPacketInput.getPayload(), message.getData());
new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder();
OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(OFConstants.OFPCML_NO_BUFFER);
+ output.setMaxLength(Uint16.valueOf(OFConstants.OFPCML_NO_BUFFER));
Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
output.setOutputNodeConnector(value);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(
new ArrayList<>();
actionList.add(ab.build());
- Long bufferId = 0xfL;
+ final Uint32 bufferId = Uint32.valueOf(0xf);
- Long valueForCookie = 0xeL;
+ final Uint32 valueForCookie = Uint32.valueOf(0xe);
ConnectionCookie connCook = new ConnectionCookie(valueForCookie);
String nodeId = "node:1";
.action.choice.output.action._case.OutputActionBuilder();
outputActionBuilder.setPort(outPort);
- outputActionBuilder.setMaxLength(0xffff);
+ outputActionBuilder.setMaxLength(Uint16.MAX_VALUE);
outputActionCaseBuilder.setOutputAction(outputActionBuilder.build());
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setActionChoice(outputActionCaseBuilder.build());
portModInputBld.setConfig(config31);
portModInputBld.setMask(configMask31);
- portModInputBld.setPortNo(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber(42L));
+ portModInputBld.setPortNo(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731
+ .PortNumber(Uint32.valueOf(42)));
portModInputBld.setHwAddress(new MacAddress(DEFAULT_MAC_ADDRESS));
portModInputBld.setAdvertise(portf31);
portModInputBld.setAdvertiseV10(
new PortFeaturesV10(null, null, null, null, null, null, null, true, null, null, null, null));
- portModInputBld.setVersion((short) EncodeConstants.OF13_VERSION_ID);
+ portModInputBld.setVersion(EncodeConstants.OF_VERSION_1_3);
Assert.assertEquals(portModInputBld.build(), portOut);
}
portsB.setMaxSpeed((Uint32) null);
portsB.setName("foo");
portsB.setPeerFeatures(portf31);
- portsB.setPortNo(42L);
+ portsB.setPortNo(Uint32.valueOf(42));
portsB.setState(new PortState(false, false, false));
portsB.setSupportedFeatures(portf31);
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesKey;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
public class TableFeaturesConvertorTest {
private static final TablePropertiesBuilder TABLE_PROPERTIES_BUILDER = new TablePropertiesBuilder();
tableFeaturesBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table
.features.TableFeaturesBuilder();
for (int i = 0; i < 10; i++) {
- tableFeaturesBuilder.setTableId((short) i);
+ tableFeaturesBuilder.setTableId(Uint8.valueOf(i));
tableFeaturesBuilder.setName(String.format("table:%d", i));
- tableFeaturesBuilder.setMetadataMatch(BigInteger.ONE);
- tableFeaturesBuilder.setMetadataWrite(BigInteger.ONE);
- tableFeaturesBuilder.setMaxEntries((long) 1 + 10 * i);
+ tableFeaturesBuilder.setMetadataMatch(Uint64.ONE);
+ tableFeaturesBuilder.setMetadataWrite(Uint64.ONE);
+ tableFeaturesBuilder.setMaxEntries(Uint32.valueOf(1 + 10 * i));
tableFeaturesBuilder.setConfig(new TableConfig(false));
tableFeaturesBuilder.setTableProperties(getTableProperties());
tableFeaturesList.add(tableFeaturesBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfield;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMiss;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint64;
import org.opendaylight.yangtools.yang.common.Uint8;
@Test
public void testWithMPTableFeature() {
TableFeaturesBuilder featuresBuilder = new TableFeaturesBuilder();
- featuresBuilder.setTableId((short) 5);
+ featuresBuilder.setTableId(Uint8.valueOf(5));
featuresBuilder.setName("Aloha");
byte[] metaMatch = new byte[]{0, 1, 2, 3, 4, 5, 6, 7};
featuresBuilder.setMetadataMatch(metaMatch);
byte[] metaWrite = new byte[]{8, 9, 10, 11, 12, 13, 14, 15};
featuresBuilder.setMetadataWrite(metaWrite);
featuresBuilder.setConfig(new TableConfig(false));
- featuresBuilder.setMaxEntries(42L);
+ featuresBuilder.setMaxEntries(Uint32.valueOf(42));
List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart
.reply.multipart.reply.body.multipart.reply.table.features._case.multipart.reply.table.features
@Test
public void testWithMPTableFeatureWithProperties() {
TableFeaturesBuilder featuresBuilder = new TableFeaturesBuilder();
- featuresBuilder.setTableId((short) 5);
+ featuresBuilder.setTableId(Uint8.valueOf(5));
featuresBuilder.setName("Aloha");
featuresBuilder.setMetadataMatch(new byte[]{0, 1, 2, 3, 4, 5, 6, 7});
featuresBuilder.setMetadataWrite(new byte[]{8, 9, 10, 11, 12, 13, 14, 15});
featuresBuilder.setConfig(new TableConfig(false));
- featuresBuilder.setMaxEntries(42L);
+ featuresBuilder.setMaxEntries(Uint32.valueOf(42));
TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLES);
List<NextTableIds> nextIds = new ArrayList<>();
- nextIds.add(new NextTableIdsBuilder().setTableId((short) 1).build());
- nextIds.add(new NextTableIdsBuilder().setTableId((short) 2).build());
+ nextIds.add(new NextTableIdsBuilder().setTableId(Uint8.ONE).build());
+ nextIds.add(new NextTableIdsBuilder().setTableId(Uint8.TWO).build());
propBuilder.addAugmentation(new NextTableRelatedTableFeaturePropertyBuilder().setNextTableIds(nextIds).build());
List<TableFeatureProperties> properties = new ArrayList<>();
propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLESMISS);
nextIds = new ArrayList<>();
- nextIds.add(new NextTableIdsBuilder().setTableId((short) 3).build());
+ nextIds.add(new NextTableIdsBuilder().setTableId(Uint8.valueOf(3)).build());
propBuilder.addAugmentation(new NextTableRelatedTableFeaturePropertyBuilder().setNextTableIds(nextIds).build());
properties.add(propBuilder.build());
propBuilder = new TableFeaturePropertiesBuilder();
.TableFeatures> features = new ArrayList<>();
features.add(featuresBuilder.build());
featuresBuilder = new TableFeaturesBuilder();
- featuresBuilder.setTableId((short) 6);
+ featuresBuilder.setTableId(Uint8.valueOf(6));
featuresBuilder.setName("Mahalo");
featuresBuilder.setMetadataMatch(new byte[]{8, 9, 10, 11, 12, 13, 14, 15});
featuresBuilder.setMetadataWrite(new byte[]{0, 1, 2, 3, 4, 5, 6, 7});
featuresBuilder.setConfig(new TableConfig(false));
- featuresBuilder.setMaxEntries(24L);
+ featuresBuilder.setMaxEntries(Uint32.valueOf(24));
/* -------------------------------------------------- */
private static GroupCase createGroupAction() {
final GroupCaseBuilder groupCaseBuilder = new GroupCaseBuilder();
final GroupActionBuilder groupActionBuilder = new GroupActionBuilder();
- groupActionBuilder.setGroupId(42L);
+ groupActionBuilder.setGroupId(Uint32.valueOf(42));
groupCaseBuilder.setGroupAction(groupActionBuilder.build());
return groupCaseBuilder.build();
}
private static SetMplsTtlCase createSetMplsTtlCase() {
SetMplsTtlCaseBuilder setMplsTtlCaseBuilder = new SetMplsTtlCaseBuilder();
SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
- setMplsTtlActionBuilder.setMplsTtl((short) 42);
+ setMplsTtlActionBuilder.setMplsTtl(Uint8.valueOf(42));
setMplsTtlCaseBuilder.setSetMplsTtlAction(setMplsTtlActionBuilder.build());
return setMplsTtlCaseBuilder.build();
}
private static PushVlanCase pushVlanCase() {
PushVlanCaseBuilder pushVlanCaseBuilder = new PushVlanCaseBuilder();
PushVlanActionBuilder pushVlanActionBuilder = new PushVlanActionBuilder();
- pushVlanActionBuilder.setEthertype(new EtherType(1));
+ pushVlanActionBuilder.setEthertype(new EtherType(Uint16.ONE));
pushVlanCaseBuilder.setPushVlanAction(pushVlanActionBuilder.build());
return pushVlanCaseBuilder.build();
}
private static PushPbbCase createPushPbbCase() {
PushPbbCaseBuilder pushPbbCaseBuilder = new PushPbbCaseBuilder();
PushPbbActionBuilder pushPbbActionBuilder = new PushPbbActionBuilder();
- pushPbbActionBuilder.setEthertype(new EtherType(1));
+ pushPbbActionBuilder.setEthertype(new EtherType(Uint16.ONE));
pushPbbCaseBuilder.setPushPbbAction(pushPbbActionBuilder.build());
return pushPbbCaseBuilder.build();
}
import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
/**
* test for {@link ActionConvertor}.
private void pbbActionData() {
PushPbbActionBuilder pushpbb = new PushPbbActionBuilder();
- pushpbb.setEthernetType(10);
+ pushpbb.setEthernetType(Uint16.TEN);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setOrder(actionItem).setAction(new PushPbbActionCaseBuilder()
private void nwTtlAction() {
SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
- setNwTtlActionBuilder.setNwTtl((short) 1);
+ setNwTtlActionBuilder.setNwTtl(Uint8.ONE);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setOrder(actionItem).setAction(new SetNwTtlActionCaseBuilder()
.setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
action : ofActionsList) {
if (action.getActionChoice() instanceof OutputActionCase) {
OutputActionCase outputActionCase = (OutputActionCase) action.getActionChoice();
- Assert.assertEquals(Uint16.valueOf(10), outputActionCase.getOutputAction().getMaxLength());
+ Assert.assertEquals(Uint16.TEN, outputActionCase.getOutputAction().getMaxLength());
Assert.assertEquals(Uint32.valueOf(4294967293L),
outputActionCase.getOutputAction().getPort().getValue());
}
private void outputActionData() {
OutputActionBuilder outputB = new OutputActionBuilder();
- outputB.setMaxLength(10);
+ outputB.setMaxLength(Uint16.TEN);
Uri uri = new Uri(OutputPortValues.CONTROLLER.toString());
outputB.setOutputNodeConnector(uri);
SetMplsTtlActionBuilder setMplsTtlActionB = new SetMplsTtlActionBuilder();
- setMplsTtlActionB.setMplsTtl((short) 10);
+ setMplsTtlActionB.setMplsTtl(Uint8.valueOf(10));
ActionBuilder actionBuilder1 = new ActionBuilder();
actionBuilder1.setOrder(actionItem).setAction(new SetMplsTtlActionCaseBuilder()
.setSetMplsTtlAction(setMplsTtlActionB.build()).build());
private void vlanActionData() {
PushVlanActionBuilder pvB = new PushVlanActionBuilder();
- pvB.setVlanId(new VlanId(10));
+ pvB.setVlanId(new VlanId(Uint16.TEN));
ActionBuilder actionBuilder1 = new ActionBuilder();
actionBuilder1.setOrder(actionItem).setAction(new PushVlanActionCaseBuilder()
private void mplsActionData() {
PushMplsActionBuilder pushMB = new PushMplsActionBuilder();
- pushMB.setEthernetType(10);
+ pushMB.setEthernetType(Uint16.TEN);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setOrder(actionItem).setAction(new PushMplsActionCaseBuilder()
actions.add(actionItem++, actionBuilder.build());
PopMplsActionBuilder popMB = new PopMplsActionBuilder();
- popMB.setEthernetType(10);
+ popMB.setEthernetType(Uint16.TEN);
ActionBuilder actionBuilder1 = new ActionBuilder();
actionBuilder1.setOrder(actionItem).setAction(new PopMplsActionCaseBuilder()
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action;
import java.util.ArrayList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetVlanPcpCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetVlanVidCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
/**
* Unit tests for v1.0 action converters.
}
/**
- * Test {@link ActionConvertor#convert(List, ActionConvertorData)}}.
+ * Test {@link ActionConvertor#convert(java.util.Collection, ActionConvertorData)}}.
*/
@Test
public void testGetActions() {
ActionBuilder actionBuilder = new ActionBuilder();
SetVlanPcpActionCaseBuilder vlanPcpCaseBuilder = new SetVlanPcpActionCaseBuilder();
SetVlanPcpActionBuilder pcpBuilder = new SetVlanPcpActionBuilder();
- pcpBuilder.setVlanPcp(new VlanPcp((short) 7));
+ pcpBuilder.setVlanPcp(new VlanPcp(Uint8.valueOf(7)));
vlanPcpCaseBuilder.setSetVlanPcpAction(pcpBuilder.build());
actionBuilder.setAction(vlanPcpCaseBuilder.build());
actionBuilder.setOrder(0);
actionBuilder = new ActionBuilder();
SetTpSrcActionCaseBuilder tpSrcCaseBuilder = new SetTpSrcActionCaseBuilder();
SetTpSrcActionBuilder tpSrcBuilder = new SetTpSrcActionBuilder();
- tpSrcBuilder.setPort(new PortNumber(54));
+ tpSrcBuilder.setPort(new PortNumber(Uint16.valueOf(54)));
tpSrcCaseBuilder.setSetTpSrcAction(tpSrcBuilder.build());
actionBuilder.setAction(tpSrcCaseBuilder.build());
actionBuilder.setOrder(6);
actionBuilder = new ActionBuilder();
SetTpDstActionCaseBuilder tpDstCaseBuilder = new SetTpDstActionCaseBuilder();
SetTpDstActionBuilder tpDstBuilder = new SetTpDstActionBuilder();
- tpDstBuilder.setPort(new PortNumber(45));
+ tpDstBuilder.setPort(new PortNumber(Uint16.valueOf(45)));
tpDstCaseBuilder.setSetTpDstAction(tpDstBuilder.build());
actionBuilder.setAction(tpDstCaseBuilder.build());
actionBuilder.setOrder(7);
actionBuilder = new ActionBuilder();
SetVlanIdActionCaseBuilder vlanIdCaseBuilder = new SetVlanIdActionCaseBuilder();
SetVlanIdActionBuilder vlanIdBuilder = new SetVlanIdActionBuilder();
- vlanIdBuilder.setVlanId(new VlanId(22));
+ vlanIdBuilder.setVlanId(new VlanId(Uint16.valueOf(22)));
vlanIdCaseBuilder.setSetVlanIdAction(vlanIdBuilder.build());
actionBuilder.setAction(vlanIdCaseBuilder.build());
actionBuilder.setOrder(9);
SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
VlanMatchBuilder vlanMatchBuilder = new VlanMatchBuilder();
- vlanMatchBuilder.setVlanId(new VlanIdBuilder().setVlanId(new VlanId(22)).build());
+ vlanMatchBuilder.setVlanId(new VlanIdBuilder().setVlanId(new VlanId(Uint16.valueOf(22))).build());
setFieldBuilder.setVlanMatch(vlanMatchBuilder.build());
setFieldCaseBuilder.setSetField(setFieldBuilder.build());
actionBuilder.setAction(setFieldCaseBuilder.build());
public void testToMDSalActions() {
OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
OutputActionBuilder outputBuilder = new OutputActionBuilder();
- outputBuilder.setPort(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber(14L));
- outputBuilder.setMaxLength(555);
+ outputBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731
+ .PortNumber(Uint32.valueOf(14)));
+ outputBuilder.setMaxLength(Uint16.valueOf(555));
caseBuilder.setOutputAction(outputBuilder.build());
org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanPcpCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanVidCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.port._case.InPortBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
/**
* Unit tests for v1.3 action converters.
}
/**
- * Test {@link ActionConvertor#convert(List, ActionConvertorData)}}.
+ * Test {@link ActionConvertor#convert(java.util.Collection, ActionConvertorData)}}.
*/
//@Test
public void testToMDSalActions2() {
OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
OutputActionBuilder outputBuilder = new OutputActionBuilder();
- outputBuilder.setPort(new PortNumber(42L));
- outputBuilder.setMaxLength(52);
+ outputBuilder.setPort(new PortNumber(Uint32.valueOf(42)));
+ outputBuilder.setMaxLength(Uint16.valueOf(52));
caseBuilder.setOutputAction(outputBuilder.build());
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder = new ActionBuilder();
SetMplsTtlCaseBuilder setMplsTtlCaseBuilder = new SetMplsTtlCaseBuilder();
SetMplsTtlActionBuilder setMplsTtlBuilder = new SetMplsTtlActionBuilder();
- setMplsTtlBuilder.setMplsTtl((short) 4);
+ setMplsTtlBuilder.setMplsTtl(Uint8.valueOf(4));
setMplsTtlCaseBuilder.setSetMplsTtlAction(setMplsTtlBuilder.build());
actionBuilder.setActionChoice(setMplsTtlCaseBuilder.build());
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
PushVlanCaseBuilder pushVlanCaseBuilder = new PushVlanCaseBuilder();
PushVlanActionBuilder pushVlanBuilder = new PushVlanActionBuilder();
- pushVlanBuilder.setEthertype(new EtherType(new EtherType(16)));
+ pushVlanBuilder.setEthertype(new EtherType(new EtherType(Uint16.valueOf(16))));
pushVlanCaseBuilder.setPushVlanAction(pushVlanBuilder.build());
actionBuilder.setActionChoice(pushVlanCaseBuilder.build());
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
PushMplsCaseBuilder pushMplsCaseBuilder = new PushMplsCaseBuilder();
PushMplsActionBuilder pushMplsBuilder = new PushMplsActionBuilder();
- pushMplsBuilder.setEthertype(new EtherType(new EtherType(17)));
+ pushMplsBuilder.setEthertype(new EtherType(new EtherType(Uint16.valueOf(17))));
pushMplsCaseBuilder.setPushMplsAction(pushMplsBuilder.build());
actionBuilder.setActionChoice(pushMplsCaseBuilder.build());
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
PopMplsCaseBuilder popMplsCaseBuilder = new PopMplsCaseBuilder();
PopMplsActionBuilder popMplsBuilder = new PopMplsActionBuilder();
- popMplsBuilder.setEthertype(new EtherType(new EtherType(18)));
+ popMplsBuilder.setEthertype(new EtherType(new EtherType(Uint16.valueOf(18))));
popMplsCaseBuilder.setPopMplsAction(popMplsBuilder.build());
actionBuilder.setActionChoice(popMplsCaseBuilder.build());
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
SetQueueCaseBuilder setQueueCaseBuilder = new SetQueueCaseBuilder();
SetQueueActionBuilder setQueueBuilder = new SetQueueActionBuilder();
- setQueueBuilder.setQueueId(1234L);
+ setQueueBuilder.setQueueId(Uint32.valueOf(1234));
setQueueCaseBuilder.setSetQueueAction(setQueueBuilder.build());
actionBuilder.setActionChoice(setQueueCaseBuilder.build());
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
GroupCaseBuilder groupCaseBuilder = new GroupCaseBuilder();
GroupActionBuilder groupActionBuilder = new GroupActionBuilder();
- groupActionBuilder.setGroupId(555L);
+ groupActionBuilder.setGroupId(Uint32.valueOf(555));
groupCaseBuilder.setGroupAction(groupActionBuilder.build());
actionBuilder.setActionChoice(groupCaseBuilder.build());
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
SetNwTtlCaseBuilder nwTtlCaseBuilder = new SetNwTtlCaseBuilder();
SetNwTtlActionBuilder nwTtlBuilder = new SetNwTtlActionBuilder();
- nwTtlBuilder.setNwTtl((short) 8);
+ nwTtlBuilder.setNwTtl(Uint8.valueOf(8));
nwTtlCaseBuilder.setSetNwTtlAction(nwTtlBuilder.build());
actionBuilder.setActionChoice(nwTtlCaseBuilder.build());
actions.add(actionBuilder.build());
matchBuilder.setHasMask(false);
InPortCaseBuilder inPortCaseBuilder = new InPortCaseBuilder();
InPortBuilder inPortBuilder = new InPortBuilder();
- inPortBuilder.setPortNumber(new PortNumber(1L));
+ inPortBuilder.setPortNumber(new PortNumber(Uint32.ONE));
inPortCaseBuilder.setInPort(inPortBuilder.build());
matchBuilder.setMatchEntryValue(inPortCaseBuilder.build());
actionBuilder = new ActionBuilder();
PushPbbCaseBuilder pushPbbCaseBuilder = new PushPbbCaseBuilder();
PushPbbActionBuilder pushPbbBuilder = new PushPbbActionBuilder();
- pushPbbBuilder.setEthertype(new EtherType(new EtherType(19)));
+ pushPbbBuilder.setEthertype(new EtherType(new EtherType(Uint16.valueOf(19))));
pushPbbCaseBuilder.setPushPbbAction(pushPbbBuilder.build());
actionBuilder.setActionChoice(pushPbbCaseBuilder.build());
actions.add(actionBuilder.build());
}
/**
- * Test {@link ActionConvertor#convert(List, ActionConvertorData)} }.
+ * Test {@link ActionConvertor#convert(java.util.Collection, ActionConvertorData)} }.
*/
@Test
public void testGetActions() {
SetVlanPcpActionCaseBuilder vlanPcpCaseBuilder = new SetVlanPcpActionCaseBuilder();
SetVlanPcpActionBuilder pcpBuilder = new SetVlanPcpActionBuilder();
- pcpBuilder.setVlanPcp(new VlanPcp((short) 7));
+ pcpBuilder.setVlanPcp(new VlanPcp(Uint8.valueOf(7)));
vlanPcpCaseBuilder.setSetVlanPcpAction(pcpBuilder.build());
actionBuilder.setAction(vlanPcpCaseBuilder.build());
actionBuilder.setOrder(0);
SetTpSrcActionCaseBuilder tpSrcCaseBuilder = new SetTpSrcActionCaseBuilder();
SetTpSrcActionBuilder tpSrcBuilder = new SetTpSrcActionBuilder();
tpSrcBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types
- .rev130715.PortNumber(54));
+ .rev130715.PortNumber(Uint16.valueOf(54)));
tpSrcCaseBuilder.setSetTpSrcAction(tpSrcBuilder.build());
actionBuilder.setAction(tpSrcCaseBuilder.build());
actionBuilder.setOrder(6);
SetTpDstActionCaseBuilder tpDstCaseBuilder = new SetTpDstActionCaseBuilder();
SetTpDstActionBuilder tpDstBuilder = new SetTpDstActionBuilder();
tpDstBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types
- .rev130715.PortNumber(45));
+ .rev130715.PortNumber(Uint16.valueOf(45)));
tpDstCaseBuilder.setSetTpDstAction(tpDstBuilder.build());
actionBuilder.setAction(tpDstCaseBuilder.build());
actionBuilder.setOrder(7);
.action.list.ActionBuilder();
SetVlanIdActionCaseBuilder vlanIdCaseBuilder = new SetVlanIdActionCaseBuilder();
SetVlanIdActionBuilder vlanIdBuilder = new SetVlanIdActionBuilder();
- vlanIdBuilder.setVlanId(new VlanId(22));
+ vlanIdBuilder.setVlanId(new VlanId(Uint16.valueOf(22)));
vlanIdCaseBuilder.setSetVlanIdAction(vlanIdBuilder.build());
actionBuilder.setAction(vlanIdCaseBuilder.build());
actionBuilder.setOrder(9);
actionBuilder.setOrder(11);
salActions.add(actionBuilder.build());
- IpMatchBuilder ipMatchBld = new IpMatchBuilder().setIpProtocol((short) 6);
+ IpMatchBuilder ipMatchBld = new IpMatchBuilder().setIpProtocol(Uint8.valueOf(6));
MatchBuilder matchBld = new MatchBuilder().setIpMatch(ipMatchBld.build());
FlowBuilder flowBld = new FlowBuilder().setMatch(matchBld.build());
Flow flow = flowBld.build();
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow;
-import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public void test() {
RemoveFlowInputBuilder flowBuilder = new RemoveFlowInputBuilder();
flowBuilder.setBarrier(false);
- flowBuilder.setCookie(new FlowCookie(new BigInteger("4")));
- flowBuilder.setCookieMask(new FlowCookie(new BigInteger("5")));
- flowBuilder.setTableId((short) 6);
+ flowBuilder.setCookie(new FlowCookie(Uint64.valueOf(4)));
+ flowBuilder.setCookieMask(new FlowCookie(Uint64.valueOf(5)));
+ flowBuilder.setTableId(Uint8.valueOf(6));
flowBuilder.setStrict(true);
- flowBuilder.setIdleTimeout(50);
- flowBuilder.setHardTimeout(500);
- flowBuilder.setPriority(40);
- flowBuilder.setBufferId(18L);
- flowBuilder.setOutPort(new BigInteger("65535"));
- flowBuilder.setOutGroup(5000L);
+ flowBuilder.setIdleTimeout(Uint16.valueOf(50));
+ flowBuilder.setHardTimeout(Uint16.valueOf(500));
+ flowBuilder.setPriority(Uint16.valueOf(40));
+ flowBuilder.setBufferId(Uint32.valueOf(18));
+ flowBuilder.setOutPort(Uint64.valueOf(65535));
+ flowBuilder.setOutGroup(Uint32.valueOf(5000));
flowBuilder.setFlags(null);
flowBuilder.setMatch(null);
RemoveFlowInput flow = flowBuilder.build();
InstructionBuilder instructionBuilder = new InstructionBuilder();
GoToTableCaseBuilder goToCaseBuilder = new GoToTableCaseBuilder();
GoToTableBuilder goToBuilder = new GoToTableBuilder();
- goToBuilder.setTableId((short) 1);
+ goToBuilder.setTableId(Uint8.ONE);
goToCaseBuilder.setGoToTable(goToBuilder.build());
instructionBuilder.setInstruction(goToCaseBuilder.build());
instructionBuilder.setOrder(0);
instructionBuilder = new InstructionBuilder();
WriteMetadataCaseBuilder metaCaseBuilder = new WriteMetadataCaseBuilder();
WriteMetadataBuilder metaBuilder = new WriteMetadataBuilder();
- metaBuilder.setMetadata(new BigInteger("2"));
- metaBuilder.setMetadataMask(new BigInteger("3"));
+ metaBuilder.setMetadata(Uint64.valueOf(2));
+ metaBuilder.setMetadataMask(Uint64.valueOf(3));
metaCaseBuilder.setWriteMetadata(metaBuilder.build());
instructionBuilder.setInstruction(metaCaseBuilder.build());
instructionBuilder.setOrder(1);
instructionBuilder = new InstructionBuilder();
MeterCaseBuilder meterCaseBuilder = new MeterCaseBuilder();
MeterBuilder meterBuilder = new MeterBuilder();
- meterBuilder.setMeterId(new MeterId(5L));
+ meterBuilder.setMeterId(new MeterId(Uint32.valueOf(5)));
meterCaseBuilder.setMeter(meterBuilder.build());
instructionBuilder.setInstruction(meterCaseBuilder.build());
instructionBuilder.setOrder(5);
MockFlow mockFlow = new MockFlow();
Action action1 = createAction(
new SetVlanIdActionCaseBuilder().setSetVlanIdAction(
- new SetVlanIdActionBuilder().setVlanId(new VlanId(10)).build())
+ new SetVlanIdActionBuilder().setVlanId(new VlanId(Uint16.TEN)).build())
.build(),
0);
}
private static EthernetMatch createEthernetMatch() {
- EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder();
- ethernetMatchBuilder.setEthernetType(new EthernetTypeBuilder().setType(new EtherType(33024L)).build());
- return ethernetMatchBuilder.build();
+ return new EthernetMatchBuilder()
+ .setEthernetType(new EthernetTypeBuilder().setType(new EtherType(Uint32.valueOf(33024))).build())
+ .build();
}
private static Instructions toApplyInstruction(
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint8;
/**
* Created by Martin Bobak mbobak@cisco.com on 9/18/14.
for (int i = 0; i < PRESET_COUNT; i++) {
GotoTableCaseBuilder gotoTableCaseBuilder = new GotoTableCaseBuilder();
GotoTableBuilder gotoTableBuilder = new GotoTableBuilder();
- gotoTableBuilder.setTableId((short) i);
+ gotoTableBuilder.setTableId(Uint8.valueOf(i));
gotoTableCaseBuilder.setGotoTable(gotoTableBuilder.build());
instructionBuilder.setInstructionChoice(gotoTableCaseBuilder.build());
instructionsList.add(instructionBuilder.build());
for (int i = 0; i < PRESET_COUNT; i++) {
MeterCaseBuilder meterCaseBuilder = new MeterCaseBuilder();
MeterBuilder meterBuilder = new MeterBuilder();
- meterBuilder.setMeterId((long) i);
+ meterBuilder.setMeterId(Uint32.valueOf(i));
meterCaseBuilder.setMeter(meterBuilder.build());
instructionBuilder.setInstructionChoice(meterCaseBuilder.build());
instructionsList.add(instructionBuilder.build());
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match;
-import java.math.BigInteger;
import java.util.List;
import java.util.Optional;
import org.junit.Assert;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpSrcCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanPcpCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanVidCase;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
/**
* Unit tests for match conversion.
builder.setInPort(new NodeConnectorId("openflow:42:1"));
builder.setInPhyPort(new NodeConnectorId("openflow:42:2"));
MetadataBuilder metadataBuilder = new MetadataBuilder();
- metadataBuilder.setMetadata(new BigInteger("3"));
+ metadataBuilder.setMetadata(Uint64.valueOf(3));
builder.setMetadata(metadataBuilder.build());
EthernetMatchBuilder ethernetBuilder = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(4L));
+ ethTypeBuilder.setType(new EtherType(Uint32.valueOf(4)));
ethernetBuilder.setEthernetType(ethTypeBuilder.build());
EthernetSourceBuilder ethSrcBuilder = new EthernetSourceBuilder();
ethSrcBuilder.setAddress(new MacAddress("00:00:00:00:00:05"));
builder.setEthernetMatch(ethernetBuilder.build());
VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
- vlanIdBuilder.setVlanId(new VlanId(7));
+ vlanIdBuilder.setVlanId(new VlanId(Uint16.valueOf(7)));
vlanIdBuilder.setVlanIdPresent(true);
vlanBuilder.setVlanId(vlanIdBuilder.build());
- vlanBuilder.setVlanPcp(new VlanPcp((short) 7));
+ vlanBuilder.setVlanPcp(new VlanPcp(Uint8.valueOf(7)));
builder.setVlanMatch(vlanBuilder.build());
IpMatchBuilder ipMatchBuilder = new IpMatchBuilder();
- ipMatchBuilder.setIpDscp(new Dscp((short) 8));
- ipMatchBuilder.setIpEcn((short) 9);
- ipMatchBuilder.setIpProtocol((short) 10);
+ ipMatchBuilder.setIpDscp(new Dscp(Uint8.valueOf(8)));
+ ipMatchBuilder.setIpEcn(Uint8.valueOf(9));
+ ipMatchBuilder.setIpProtocol(Uint8.valueOf(10));
builder.setIpMatch(ipMatchBuilder.build());
TcpMatchBuilder tcpMatchBuilder = new TcpMatchBuilder();
- tcpMatchBuilder.setTcpSourcePort(new PortNumber(11));
- tcpMatchBuilder.setTcpDestinationPort(new PortNumber(12));
+ tcpMatchBuilder.setTcpSourcePort(new PortNumber(Uint16.valueOf(11)));
+ tcpMatchBuilder.setTcpDestinationPort(new PortNumber(Uint16.valueOf(12)));
builder.setLayer4Match(tcpMatchBuilder.build());
Icmpv4MatchBuilder icmpv4Builder = new Icmpv4MatchBuilder();
- icmpv4Builder.setIcmpv4Type((short) 13);
- icmpv4Builder.setIcmpv4Code((short) 14);
+ icmpv4Builder.setIcmpv4Type(Uint8.valueOf(13));
+ icmpv4Builder.setIcmpv4Code(Uint8.valueOf(14));
builder.setIcmpv4Match(icmpv4Builder.build());
Icmpv6MatchBuilder icmpv6Builder = new Icmpv6MatchBuilder();
- icmpv6Builder.setIcmpv6Type((short) 15);
- icmpv6Builder.setIcmpv6Code((short) 16);
+ icmpv6Builder.setIcmpv6Type(Uint8.valueOf(15));
+ icmpv6Builder.setIcmpv6Code(Uint8.valueOf(16));
builder.setIcmpv6Match(icmpv6Builder.build());
ProtocolMatchFieldsBuilder protoBuilder = new ProtocolMatchFieldsBuilder();
- protoBuilder.setMplsLabel(17L);
- protoBuilder.setMplsTc((short) 18);
- protoBuilder.setMplsBos((short) 19);
+ protoBuilder.setMplsLabel(Uint32.valueOf(17));
+ protoBuilder.setMplsTc(Uint8.valueOf(18));
+ protoBuilder.setMplsBos(Uint8.valueOf(19));
PbbBuilder pbbBuilder = new PbbBuilder();
- pbbBuilder.setPbbIsid(20L);
+ pbbBuilder.setPbbIsid(Uint32.valueOf(20));
protoBuilder.setPbb(pbbBuilder.build());
builder.setProtocolMatchFields(protoBuilder.build());
TunnelBuilder tunnelBuilder = new TunnelBuilder();
- tunnelBuilder.setTunnelId(new BigInteger("21"));
+ tunnelBuilder.setTunnelId(Uint64.valueOf(21));
builder.setTunnel(tunnelBuilder.build());
Ipv4MatchBuilder ipv4MatchBuilder = new Ipv4MatchBuilder();
ipv4MatchBuilder.setIpv4Source(new Ipv4Prefix("10.0.0.1/32"));
public void testUdpMatchConversion() {
MatchBuilder builder = new MatchBuilder();
UdpMatchBuilder udpMatchBuilder = new UdpMatchBuilder();
- udpMatchBuilder.setUdpSourcePort(new PortNumber(11));
- udpMatchBuilder.setUdpDestinationPort(new PortNumber(12));
+ udpMatchBuilder.setUdpSourcePort(new PortNumber(Uint16.valueOf(11)));
+ udpMatchBuilder.setUdpDestinationPort(new PortNumber(Uint16.valueOf(12)));
builder.setLayer4Match(udpMatchBuilder.build());
Match match = builder.build();
public void testSctpMatchConversion() {
MatchBuilder builder = new MatchBuilder();
SctpMatchBuilder sctpMatchBuilder = new SctpMatchBuilder();
- sctpMatchBuilder.setSctpSourcePort(new PortNumber(11));
- sctpMatchBuilder.setSctpDestinationPort(new PortNumber(12));
+ sctpMatchBuilder.setSctpSourcePort(new PortNumber(Uint16.valueOf(11)));
+ sctpMatchBuilder.setSctpDestinationPort(new PortNumber(Uint16.valueOf(12)));
builder.setLayer4Match(sctpMatchBuilder.build());
Match match = builder.build();
@Test
public void testArpMatchConversion() {
ArpMatchBuilder arpBuilder = new ArpMatchBuilder();
- arpBuilder.setArpOp(5);
+ arpBuilder.setArpOp(Uint16.valueOf(5));
arpBuilder.setArpSourceTransportAddress(new Ipv4Prefix("10.0.0.3/32"));
arpBuilder.setArpTargetTransportAddress(new Ipv4Prefix("10.0.0.4/32"));
ArpSourceHardwareAddressBuilder srcHwBuilder = new ArpSourceHardwareAddressBuilder();
ipv6Builder.setIpv6Source(new Ipv6Prefix("::1/128"));
ipv6Builder.setIpv6Destination(new Ipv6Prefix("::2/128"));
Ipv6LabelBuilder ipv6LabelBuilder = new Ipv6LabelBuilder();
- ipv6LabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(3L));
+ ipv6LabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(Uint32.valueOf(3)));
ipv6Builder.setIpv6Label(ipv6LabelBuilder.build());
ipv6Builder.setIpv6NdTarget(new Ipv6Address("::4"));
ipv6Builder.setIpv6NdSll(new MacAddress("00:00:00:00:00:05"));
ipv6Builder.setIpv6NdTll(new MacAddress("00:00:00:00:00:06"));
Ipv6ExtHeaderBuilder extHdrBuilder = new Ipv6ExtHeaderBuilder();
- extHdrBuilder.setIpv6Exthdr(153);
+ extHdrBuilder.setIpv6Exthdr(Uint16.valueOf(153));
ipv6Builder.setIpv6ExtHeader(extHdrBuilder.build());
MatchBuilder builder = new MatchBuilder();
public void testIpv6ExtHeaderConversion() {
Ipv6MatchBuilder ipv6Builder = new Ipv6MatchBuilder();
Ipv6ExtHeaderBuilder extHdrBuilder = new Ipv6ExtHeaderBuilder();
- extHdrBuilder.setIpv6Exthdr(358);
- extHdrBuilder.setIpv6ExthdrMask(258);
+ extHdrBuilder.setIpv6Exthdr(Uint16.valueOf(358));
+ extHdrBuilder.setIpv6ExthdrMask(Uint16.valueOf(258));
ipv6Builder.setIpv6ExtHeader(extHdrBuilder.build());
MatchBuilder builder = new MatchBuilder();
public void testConversionWithMasks() {
MatchBuilder builder = new MatchBuilder();
MetadataBuilder metadataBuilder = new MetadataBuilder();
- metadataBuilder.setMetadata(new BigInteger("3"));
- metadataBuilder.setMetadataMask(new BigInteger("15"));
+ metadataBuilder.setMetadata(Uint64.valueOf(3));
+ metadataBuilder.setMetadataMask(Uint64.valueOf(15));
builder.setMetadata(metadataBuilder.build());
EthernetMatchBuilder ethernetBuilder = new EthernetMatchBuilder();
EthernetSourceBuilder ethSrcBuilder = new EthernetSourceBuilder();
builder.setEthernetMatch(ethernetBuilder.build());
VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
- vlanIdBuilder.setVlanId(new VlanId(0));
+ vlanIdBuilder.setVlanId(new VlanId(Uint16.ZERO));
vlanIdBuilder.setVlanIdPresent(true);
vlanBuilder.setVlanId(vlanIdBuilder.build());
builder.setVlanMatch(vlanBuilder.build());
ProtocolMatchFieldsBuilder protoBuilder = new ProtocolMatchFieldsBuilder();
PbbBuilder pbbBuilder = new PbbBuilder();
- pbbBuilder.setPbbIsid(20L);
- pbbBuilder.setPbbMask(8L);
+ pbbBuilder.setPbbIsid(Uint32.valueOf(20));
+ pbbBuilder.setPbbMask(Uint32.valueOf(8));
protoBuilder.setPbb(pbbBuilder.build());
builder.setProtocolMatchFields(protoBuilder.build());
TunnelBuilder tunnelBuilder = new TunnelBuilder();
- tunnelBuilder.setTunnelId(new BigInteger("21"));
- tunnelBuilder.setTunnelMask(new BigInteger("14"));
+ tunnelBuilder.setTunnelId(Uint64.valueOf(21));
+ tunnelBuilder.setTunnelMask(Uint64.valueOf(14));
builder.setTunnel(tunnelBuilder.build());
Ipv4MatchBuilder ipv4MatchBuilder = new Ipv4MatchBuilder();
ipv4MatchBuilder.setIpv4Source(new Ipv4Prefix("10.0.0.0/24"));
@Test
public void testPacketTypeConversion() {
MatchBuilder builder = new MatchBuilder();
- builder.setPacketTypeMatch(new PacketTypeMatchBuilder().setPacketType(0x1894fL).build());
+ builder.setPacketTypeMatch(new PacketTypeMatchBuilder().setPacketType(Uint32.valueOf(0x1894f)).build());
Match match = builder.build();
Optional<List<MatchEntry>> entriesOptional =
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10;
import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint8;
/**
*/
public class MatchConvertorV10Test {
- private static final long ETH_TYPE_802_3 = 0x0000;
+ private static final Uint32 ETH_TYPE_802_3 = Uint32.ZERO;
private static final MacAddress ZERO_MAC = MacAddress.getDefaultInstance("00:00:00:00:00:00");
private static final MacAddress FF_MAC = MacAddress.getDefaultInstance("ff:ff:ff:ff:ff:ff");
private static final String NODE_CONNECTOR_ID = "1234";
- private static final short ZERO = 0;
private static final String DSCP = "0";
- private static final short IP_PROTOCOL = 6;
- private static final PortNumber DEFAULT_PORT = new PortNumber(9999);
+ private static final Uint8 IP_PROTOCOL = Uint8.valueOf(6);
+ private static final PortNumber DEFAULT_PORT = new PortNumber(Uint16.valueOf(9999));
private static final Ipv4Prefix IPV4_PREFIX = Ipv4Prefix.getDefaultInstance("10.0.0.1/24");
- private static final VlanId DEFAULT_VLAN_ID = new VlanId(42);
+ private static final VlanId DEFAULT_VLAN_ID = new VlanId(Uint16.valueOf(42));
private static final Ipv4Address DEFAULT_IPV4_ADDRESS = new Ipv4Address("10.0.0.1");
- private static final short DEFAULT_MASK = 24;
+ private static final Uint8 DEFAULT_MASK = Uint8.valueOf(24);
private ConvertorManager converterManager;
@Before
assertEquals(ZERO_MAC, matchV10.getDlDst());
assertEquals(FF_MAC, matchV10.getDlSrc());
- assertEquals(0, matchV10.getDlType().intValue());
- assertEquals(0xffff, matchV10.getDlVlan().intValue());
- assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpSrc().intValue());
- assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpDst().intValue());
- assertEquals(Integer.parseInt(NODE_CONNECTOR_ID), matchV10.getInPort().intValue());
+ assertEquals(Uint16.ZERO, matchV10.getDlType());
+ assertEquals(Uint16.MAX_VALUE, matchV10.getDlVlan());
+ assertEquals(DEFAULT_PORT.getValue(), matchV10.getTpSrc());
+ assertEquals(DEFAULT_PORT.getValue(), matchV10.getTpDst());
+ assertEquals(Uint16.valueOf(NODE_CONNECTOR_ID), matchV10.getInPort());
assertEquals(DEFAULT_IPV4_ADDRESS.getValue(), matchV10.getNwDst().getValue());
- assertEquals(DEFAULT_MASK, matchV10.getNwDstMask().shortValue());
- assertEquals(0, matchV10.getNwTos().shortValue());
- assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpSrc().intValue());
- assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpDst().intValue());
+ assertEquals(DEFAULT_MASK, matchV10.getNwDstMask());
+ assertEquals(Uint8.ZERO, matchV10.getNwTos());
+ assertEquals(DEFAULT_PORT.getValue(), matchV10.getTpSrc());
+ assertEquals(DEFAULT_PORT.getValue(), matchV10.getTpDst());
matchV10Optional = converterManager.convert(createL4TcpMatch().build(),
new VersionConvertorData(OFConstants.OFP_VERSION_1_0));
matchV10 = matchV10Optional.get();
- assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpSrc().intValue());
- assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpDst().intValue());
+ assertEquals(DEFAULT_PORT.getValue(), matchV10.getTpSrc());
+ assertEquals(DEFAULT_PORT.getValue(), matchV10.getTpDst());
matchV10Optional = converterManager.convert(createVlanTcpMatch().build(),
new VersionConvertorData(OFConstants.OFP_VERSION_1_0));
matchV10 = matchV10Optional.get();
- assertEquals(DEFAULT_VLAN_ID.getValue().intValue(), matchV10.getDlVlan().intValue());
-
+ assertEquals(DEFAULT_VLAN_ID.getValue(), matchV10.getDlVlan());
}
@Test
assertEquals(ZERO_MAC, matchV10.getDlDst());
assertEquals(FF_MAC, matchV10.getDlSrc());
- assertEquals(0, matchV10.getDlType().intValue());
- assertEquals(0xffff, matchV10.getDlVlan().intValue());
- assertEquals(Integer.parseInt(NODE_CONNECTOR_ID),
- matchV10.getInPort().intValue());
- assertEquals(DEFAULT_IPV4_ADDRESS.getValue(),
- matchV10.getNwDst().getValue());
- assertEquals(DEFAULT_MASK, matchV10.getNwDstMask().shortValue());
- assertEquals(0, matchV10.getNwTos().shortValue());
- assertEquals(0, matchV10.getTpSrc().toJava());
- assertEquals(0, matchV10.getTpDst().toJava());
+ assertEquals(Uint16.ZERO, matchV10.getDlType());
+ assertEquals(Uint16.MAX_VALUE, matchV10.getDlVlan());
+ assertEquals(Uint16.valueOf(NODE_CONNECTOR_ID), matchV10.getInPort());
+ assertEquals(DEFAULT_IPV4_ADDRESS.getValue(), matchV10.getNwDst().getValue());
+ assertEquals(DEFAULT_MASK, matchV10.getNwDstMask());
+ assertEquals(Uint8.ZERO, matchV10.getNwTos());
+ assertEquals(Uint16.ZERO, matchV10.getTpSrc());
+ assertEquals(Uint16.ZERO, matchV10.getTpDst());
boolean wcTpSrc = true;
boolean wcTpDst = true;
assertEquals(wc, matchV10.getWildcards());
// Specify ICMP type only.
- Integer icmpType = 55;
- Icmpv4MatchBuilder icmpv4MatchBuilder = new Icmpv4MatchBuilder().setIcmpv4Type(icmpType.shortValue());
+ Uint8 icmpType = Uint8.valueOf(55);
+ Icmpv4MatchBuilder icmpv4MatchBuilder = new Icmpv4MatchBuilder().setIcmpv4Type(icmpType);
wcTpSrc = false;
wc = new FlowWildcardsV10(
false, false, false, true, true, false, false, false,
matchV10.getInPort().intValue());
assertEquals(DEFAULT_IPV4_ADDRESS.getValue(),
matchV10.getNwDst().getValue());
- assertEquals(DEFAULT_MASK, matchV10.getNwDstMask().shortValue());
- assertEquals(0, matchV10.getNwTos().shortValue());
+ assertEquals(DEFAULT_MASK, matchV10.getNwDstMask());
+ assertEquals(Uint8.ZERO, matchV10.getNwTos());
assertEquals(55, matchV10.getTpSrc().toJava());
- assertEquals(0, matchV10.getTpDst().toJava());
+ assertEquals(Uint16.ZERO, matchV10.getTpDst());
assertEquals(wc, matchV10.getWildcards());
// Specify ICMP code only.
- Integer icmpCode = 31;
- icmpv4MatchBuilder = new Icmpv4MatchBuilder().setIcmpv4Type((Uint8) null).setIcmpv4Code(icmpCode.shortValue());
+ Uint8 icmpCode = Uint8.valueOf(31);
+ icmpv4MatchBuilder = new Icmpv4MatchBuilder().setIcmpv4Type((Uint8) null).setIcmpv4Code(icmpCode);
wcTpSrc = true;
wcTpDst = false;
wc = new FlowWildcardsV10(
matchV10 = matchV10Optional.get();
assertEquals(ZERO_MAC, matchV10.getDlDst());
assertEquals(FF_MAC, matchV10.getDlSrc());
- assertEquals(0, matchV10.getDlType().intValue());
- assertEquals(0xffff, matchV10.getDlVlan().intValue());
- assertEquals(Integer.parseInt(NODE_CONNECTOR_ID),
- matchV10.getInPort().intValue());
- assertEquals(DEFAULT_IPV4_ADDRESS.getValue(),
- matchV10.getNwDst().getValue());
- assertEquals(DEFAULT_MASK, matchV10.getNwDstMask().shortValue());
- assertEquals(0, matchV10.getNwTos().shortValue());
- assertEquals(0, matchV10.getTpSrc().toJava());
- assertEquals(Uint16.valueOf(icmpCode), matchV10.getTpDst());
+ assertEquals(Uint16.ZERO, matchV10.getDlType());
+ assertEquals(Uint16.MAX_VALUE, matchV10.getDlVlan());
+ assertEquals(Uint16.valueOf(NODE_CONNECTOR_ID), matchV10.getInPort());
+ assertEquals(DEFAULT_IPV4_ADDRESS.getValue(), matchV10.getNwDst().getValue());
+ assertEquals(DEFAULT_MASK, matchV10.getNwDstMask());
+ assertEquals(Uint8.ZERO, matchV10.getNwTos());
+ assertEquals(Uint16.ZERO, matchV10.getTpSrc());
+ assertEquals(icmpCode.toUint16(), matchV10.getTpDst());
assertEquals(wc, matchV10.getWildcards());
// Specify both ICMP type and code.
- icmpType = 11;
- icmpCode = 22;
- icmpv4MatchBuilder = new Icmpv4MatchBuilder().setIcmpv4Type(icmpType.shortValue())
- .setIcmpv4Code(icmpCode.shortValue());
+ icmpType = Uint8.valueOf(11);
+ icmpCode = Uint8.valueOf(22);
+ icmpv4MatchBuilder = new Icmpv4MatchBuilder().setIcmpv4Type(icmpType).setIcmpv4Code(icmpCode);
wcTpSrc = false;
wcTpDst = false;
- wc = new FlowWildcardsV10(
- false, false, false, true, true, false, false, false,
- wcTpDst, wcTpSrc);
+ wc = new FlowWildcardsV10(false, false, false, true, true, false, false, false, wcTpDst, wcTpSrc);
match = matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build()).build();
- matchV10Optional = converterManager.convert(match,
- new VersionConvertorData(OFConstants.OFP_VERSION_1_0));
+ matchV10Optional = converterManager.convert(match, new VersionConvertorData(OFConstants.OFP_VERSION_1_0));
matchV10 = matchV10Optional.get();
assertEquals(ZERO_MAC, matchV10.getDlDst());
assertEquals(FF_MAC, matchV10.getDlSrc());
- assertEquals(0, matchV10.getDlType().intValue());
- assertEquals(0xffff, matchV10.getDlVlan().intValue());
- assertEquals(Integer.parseInt(NODE_CONNECTOR_ID),
- matchV10.getInPort().intValue());
- assertEquals(DEFAULT_IPV4_ADDRESS.getValue(),
- matchV10.getNwDst().getValue());
- assertEquals(DEFAULT_MASK, matchV10.getNwDstMask().shortValue());
- assertEquals(0, matchV10.getNwTos().shortValue());
- assertEquals(Uint16.valueOf(icmpType), matchV10.getTpSrc());
- assertEquals(Uint16.valueOf(icmpCode), matchV10.getTpDst());
+ assertEquals(Uint16.ZERO, matchV10.getDlType());
+ assertEquals(Uint16.MAX_VALUE, matchV10.getDlVlan());
+ assertEquals(Uint16.valueOf(NODE_CONNECTOR_ID), matchV10.getInPort());
+ assertEquals(DEFAULT_IPV4_ADDRESS.getValue(), matchV10.getNwDst().getValue());
+ assertEquals(DEFAULT_MASK, matchV10.getNwDstMask());
+ assertEquals(Uint8.ZERO, matchV10.getNwTos());
+ assertEquals(icmpType.toUint16(), matchV10.getTpSrc());
+ assertEquals(icmpCode.toUint16(), matchV10.getTpDst());
assertEquals(wc, matchV10.getWildcards());
}
IpMatchBuilder ipMatchBuilder = new IpMatchBuilder();
ipMatchBuilder.setIpDscp(Dscp.getDefaultInstance(DSCP));
- ipMatchBuilder.setIpEcn(ZERO);
+ ipMatchBuilder.setIpEcn(Uint8.ZERO);
ipMatchBuilder.setIpProto(IpVersion.Ipv4);
ipMatchBuilder.setIpProtocol(IP_PROTOCOL);
matchBuilder.setIpMatch(ipMatchBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.vlan.vid._case.VlanVidBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
/**
* Unit tests for match response conversions.
entriesBuilder.setHasMask(false);
final InPortCaseBuilder caseBuilder = new InPortCaseBuilder();
final InPortBuilder portBuilder = new InPortBuilder();
- portBuilder.setPortNumber(new PortNumber(1L));
+ portBuilder.setPortNumber(new PortNumber(Uint32.ONE));
caseBuilder.setInPort(portBuilder.build());
entriesBuilder.setMatchEntryValue(caseBuilder.build());
entries.add(entriesBuilder.build());
org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.InPhyPort.class);
entriesBuilder.setHasMask(false);
final InPhyPortBuilder inPhyPortBuilder = new InPhyPortBuilder();
- inPhyPortBuilder.setPortNumber(new PortNumber(2L));
+ inPhyPortBuilder.setPortNumber(new PortNumber(Uint32.TWO));
inPhyPortCaseBuilder.setInPhyPort(inPhyPortBuilder.build());
entriesBuilder.setMatchEntryValue(inPhyPortCaseBuilder.build());
entries.add(entriesBuilder.build());
entriesBuilder.setHasMask(false);
final PacketTypeCaseBuilder packetTypeCaseBuilder = new PacketTypeCaseBuilder();
final PacketTypeBuilder packetTypeBuilder = new PacketTypeBuilder();
- packetTypeBuilder.setPacketType(0x1894fL);
+ packetTypeBuilder.setPacketType(Uint32.valueOf(0x1894f));
packetTypeCaseBuilder.setPacketType(packetTypeBuilder.build());
entriesBuilder.setMatchEntryValue(packetTypeCaseBuilder.build());
entries.add(entriesBuilder.build());
final EthTypeCaseBuilder ethTypeCaseBuilder = new EthTypeCaseBuilder();
final EthTypeBuilder ethTypeBuilder = new EthTypeBuilder();
- ethTypeBuilder.setEthType(new EtherType(3));
+ ethTypeBuilder.setEthType(new EtherType(Uint16.valueOf(3)));
ethTypeCaseBuilder.setEthType(ethTypeBuilder.build());
entriesBuilder.setMatchEntryValue(ethTypeCaseBuilder.build());
entries.add(entriesBuilder.build());
final VlanVidCaseBuilder vlanVidCaseBuilder = new VlanVidCaseBuilder();
entriesBuilder.setHasMask(false);
final VlanVidBuilder vlanVidBuilder = new VlanVidBuilder();
- vlanVidBuilder.setVlanVid(4);
+ vlanVidBuilder.setVlanVid(Uint16.valueOf(4));
vlanVidBuilder.setCfiBit(true);
vlanVidCaseBuilder.setVlanVid(vlanVidBuilder.build());
entriesBuilder.setMatchEntryValue(vlanVidCaseBuilder.build());
final VlanPcpCaseBuilder vlanPcpCaseBuilder = new VlanPcpCaseBuilder();
entriesBuilder.setHasMask(false);
final VlanPcpBuilder vlanPcpBuilder = new VlanPcpBuilder();
- vlanPcpBuilder.setVlanPcp((short) 5);
+ vlanPcpBuilder.setVlanPcp(Uint8.valueOf(5));
vlanPcpCaseBuilder.setVlanPcp(vlanPcpBuilder.build());
entriesBuilder.setMatchEntryValue(vlanPcpCaseBuilder.build());
entries.add(entriesBuilder.build());
entriesBuilder.setHasMask(false);
final IpDscpCaseBuilder ipDscpCaseBuilder = new IpDscpCaseBuilder();
final IpDscpBuilder ipDscpBuilder = new IpDscpBuilder();
- ipDscpBuilder.setDscp(new Dscp((short) 6));
+ ipDscpBuilder.setDscp(new Dscp(Uint8.valueOf(6)));
ipDscpCaseBuilder.setIpDscp(ipDscpBuilder.build());
entriesBuilder.setMatchEntryValue(ipDscpCaseBuilder.build());
entries.add(entriesBuilder.build());
entriesBuilder.setHasMask(false);
final IpEcnCaseBuilder ipEcnCaseBuilder = new IpEcnCaseBuilder();
final IpEcnBuilder ipEcnBuilder = new IpEcnBuilder();
- ipEcnBuilder.setEcn((short) 7);
+ ipEcnBuilder.setEcn(Uint8.valueOf(7));
ipEcnCaseBuilder.setIpEcn(ipEcnBuilder.build());
entriesBuilder.setMatchEntryValue(ipEcnCaseBuilder.build());
entries.add(entriesBuilder.build());
final IpProtoCaseBuilder ipProtoCaseBuilder = new IpProtoCaseBuilder();
entriesBuilder.setHasMask(false);
final IpProtoBuilder ipProtoBuilder = new IpProtoBuilder();
- ipProtoBuilder.setProtocolNumber((short) 8);
+ ipProtoBuilder.setProtocolNumber(Uint8.valueOf(8));
ipProtoCaseBuilder.setIpProto(ipProtoBuilder.build());
entriesBuilder.setMatchEntryValue(ipProtoCaseBuilder.build());
entries.add(entriesBuilder.build());
final TcpSrcCaseBuilder tcpSrcCaseBuilder = new TcpSrcCaseBuilder();
final TcpSrcBuilder tcpSrcBuilder = new TcpSrcBuilder();
tcpSrcBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf
- .inet.types.rev130715.PortNumber(9));
+ .inet.types.rev130715.PortNumber(Uint16.valueOf(9)));
tcpSrcCaseBuilder.setTcpSrc(tcpSrcBuilder.build());
entriesBuilder.setMatchEntryValue(tcpSrcCaseBuilder.build());
entries.add(entriesBuilder.build());
final TcpDstCaseBuilder tcpDstCaseBuilder = new TcpDstCaseBuilder();
final TcpDstBuilder tcpDstBuilder = new TcpDstBuilder();
tcpDstBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf
- .inet.types.rev130715.PortNumber(10));
+ .inet.types.rev130715.PortNumber(Uint16.valueOf(10)));
tcpDstCaseBuilder.setTcpDst(tcpDstBuilder.build());
entriesBuilder.setMatchEntryValue(tcpDstCaseBuilder.build());
entries.add(entriesBuilder.build());
entriesBuilder.setHasMask(false);
final Icmpv4TypeCaseBuilder icmpv4TypeCaseBuilder = new Icmpv4TypeCaseBuilder();
final Icmpv4TypeBuilder icmpv4TypeBuilder = new Icmpv4TypeBuilder();
- icmpv4TypeBuilder.setIcmpv4Type((short) 15);
+ icmpv4TypeBuilder.setIcmpv4Type(Uint8.valueOf(15));
icmpv4TypeCaseBuilder.setIcmpv4Type(icmpv4TypeBuilder.build());
entriesBuilder.setMatchEntryValue(icmpv4TypeCaseBuilder.build());
entries.add(entriesBuilder.build());
entriesBuilder.setHasMask(false);
final Icmpv4CodeCaseBuilder icmpv4CodeCaseBuilder = new Icmpv4CodeCaseBuilder();
final Icmpv4CodeBuilder icmpv4CodeBuilder = new Icmpv4CodeBuilder();
- icmpv4CodeBuilder.setIcmpv4Code((short) 16);
+ icmpv4CodeBuilder.setIcmpv4Code(Uint8.valueOf(16));
icmpv4CodeCaseBuilder.setIcmpv4Code(icmpv4CodeBuilder.build());
entriesBuilder.setMatchEntryValue(icmpv4CodeCaseBuilder.build());
entries.add(entriesBuilder.build());
entriesBuilder.setHasMask(false);
final Icmpv6TypeCaseBuilder icmpv6TypeCaseBuilder = new Icmpv6TypeCaseBuilder();
final Icmpv6TypeBuilder icmpv6TypeBuilder = new Icmpv6TypeBuilder();
- icmpv6TypeBuilder.setIcmpv6Type((short) 19);
+ icmpv6TypeBuilder.setIcmpv6Type(Uint8.valueOf(19));
icmpv6TypeCaseBuilder.setIcmpv6Type(icmpv6TypeBuilder.build());
entriesBuilder.setMatchEntryValue(icmpv6TypeCaseBuilder.build());
entries.add(entriesBuilder.build());
entriesBuilder.setHasMask(false);
final Icmpv6CodeCaseBuilder icmpv6CodeCaseBuilder = new Icmpv6CodeCaseBuilder();
final Icmpv6CodeBuilder icmpv6CodeBuilder = new Icmpv6CodeBuilder();
- icmpv6CodeBuilder.setIcmpv6Code((short) 20);
+ icmpv6CodeBuilder.setIcmpv6Code(Uint8.valueOf(20));
icmpv6CodeCaseBuilder.setIcmpv6Code(icmpv6CodeBuilder.build());
entriesBuilder.setMatchEntryValue(icmpv6CodeCaseBuilder.build());
entries.add(entriesBuilder.build());
final MplsLabelCaseBuilder mplsLabelCaseBuilder = new MplsLabelCaseBuilder();
final MplsLabelBuilder mplsLabelBuilder = new MplsLabelBuilder();
- mplsLabelBuilder.setMplsLabel(21L);
+ mplsLabelBuilder.setMplsLabel(Uint32.valueOf(21));
mplsLabelCaseBuilder.setMplsLabel(mplsLabelBuilder.build());
entriesBuilder.setMatchEntryValue(mplsLabelCaseBuilder.build());
entries.add(entriesBuilder.build());
entriesBuilder.setHasMask(false);
final MplsTcCaseBuilder mplsTcCaseBuilder = new MplsTcCaseBuilder();
final MplsTcBuilder mplsTcBuilder = new MplsTcBuilder();
- mplsTcBuilder.setTc((short) 22);
+ mplsTcBuilder.setTc(Uint8.valueOf(22));
mplsTcCaseBuilder.setMplsTc(mplsTcBuilder.build());
entriesBuilder.setMatchEntryValue(mplsTcCaseBuilder.build());
entries.add(entriesBuilder.build());
entriesBuilder.setHasMask(false);
final PbbIsidCaseBuilder pbbIsidCaseBuilder = new PbbIsidCaseBuilder();
final PbbIsidBuilder pbbIsidBuilder = new PbbIsidBuilder();
- pbbIsidBuilder.setIsid(23L);
+ pbbIsidBuilder.setIsid(Uint32.valueOf(23));
pbbIsidCaseBuilder.setPbbIsid(pbbIsidBuilder.build());
entriesBuilder.setMatchEntryValue(pbbIsidCaseBuilder.build());
entriesBuilder.setHasMask(true);
final VlanVidCaseBuilder vlanVidCaseBuilder = new VlanVidCaseBuilder();
final VlanVidBuilder vlanVidBuilder = new VlanVidBuilder();
- vlanVidBuilder.setVlanVid(4);
+ vlanVidBuilder.setVlanVid(Uint16.valueOf(4));
vlanVidBuilder.setCfiBit(true);
vlanVidBuilder.setMask(new byte[]{0, 4});
vlanVidCaseBuilder.setVlanVid(vlanVidBuilder.build());
final PbbIsidCaseBuilder pbbIsidCaseBuilder = new PbbIsidCaseBuilder();
final PbbIsidBuilder pbbIsidBuilder = new PbbIsidBuilder();
- pbbIsidBuilder.setIsid(23L);
+ pbbIsidBuilder.setIsid(Uint32.valueOf(23));
pbbIsidBuilder.setMask(new byte[]{0, 0, 7});
pbbIsidCaseBuilder.setPbbIsid(pbbIsidBuilder.build());
entriesBuilder.setMatchEntryValue(pbbIsidCaseBuilder.build());
final UdpSrcCaseBuilder udpSrcCaseBuilder = new UdpSrcCaseBuilder();
final UdpSrcBuilder portBuilder = new UdpSrcBuilder();
portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf
- .inet.types.rev130715.PortNumber(11));
+ .inet.types.rev130715.PortNumber(Uint16.valueOf(11)));
udpSrcCaseBuilder.setUdpSrc(portBuilder.build());
entriesBuilder.setMatchEntryValue(udpSrcCaseBuilder.build());
entries.add(entriesBuilder.build());
final UdpDstCaseBuilder udpDstCaseBuilder = new UdpDstCaseBuilder();
final UdpDstBuilder udpDstBuilder = new UdpDstBuilder();
udpDstBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf
- .inet.types.rev130715.PortNumber(12));
+ .inet.types.rev130715.PortNumber(Uint16.valueOf(12)));
udpDstCaseBuilder.setUdpDst(udpDstBuilder.build());
entriesBuilder.setMatchEntryValue(udpDstCaseBuilder.build());
entries.add(entriesBuilder.build());
final SctpSrcCaseBuilder sctpSrcCaseBuilder = new SctpSrcCaseBuilder();
final SctpSrcBuilder portBuilder = new SctpSrcBuilder();
portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf
- .inet.types.rev130715.PortNumber(13));
+ .inet.types.rev130715.PortNumber(Uint16.valueOf(13)));
sctpSrcCaseBuilder.setSctpSrc(portBuilder.build());
entriesBuilder.setMatchEntryValue(sctpSrcCaseBuilder.build());
entries.add(entriesBuilder.build());
final SctpDstCaseBuilder sctpDstCaseBuilder = new SctpDstCaseBuilder();
final SctpDstBuilder sctpDstBuilder = new SctpDstBuilder();
sctpDstBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf
- .inet.types.rev130715.PortNumber(14));
+ .inet.types.rev130715.PortNumber(Uint16.valueOf(14)));
sctpDstCaseBuilder.setSctpDst(sctpDstBuilder.build());
entriesBuilder.setMatchEntryValue(sctpDstCaseBuilder.build());
entries.add(entriesBuilder.build());
entriesBuilder.setHasMask(false);
final Ipv6FlabelCaseBuilder ipv6FlabelCaseBuilder = new Ipv6FlabelCaseBuilder();
final Ipv6FlabelBuilder ipv6FlabelBuilder = new Ipv6FlabelBuilder();
- ipv6FlabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(18L));
+ ipv6FlabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(Uint32.valueOf(18)));
ipv6FlabelCaseBuilder.setIpv6Flabel(ipv6FlabelBuilder.build());
entriesBuilder.setMatchEntryValue(ipv6FlabelCaseBuilder.build());
entries.add(entriesBuilder.build());
entriesBuilder.setHasMask(false);
final ArpOpCaseBuilder arpOpCaseBuilder = new ArpOpCaseBuilder();
final ArpOpBuilder arpOpBuilder = new ArpOpBuilder();
- arpOpBuilder.setOpCode(17);
+ arpOpBuilder.setOpCode(Uint16.valueOf(17));
arpOpCaseBuilder.setArpOp(arpOpBuilder.build());
entriesBuilder.setMatchEntryValue(arpOpCaseBuilder.build());
entries.add(entriesBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.vlan.vid._case.VlanVidBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
/**
* Unit test for {@link MatchResponseConvertor}.
*/
public class MatchResponseConvertorTest {
- private static final Uint64 DPID = Uint64.valueOf(10);
- private static final Long IN_PORT = 6L;
- private static final String URI_IN_PORT =
- "openflow:" + DPID + ":" + IN_PORT;
- private static final MacAddress MAC_SRC =
- MacAddress.getDefaultInstance("00:11:22:33:44:55");
- private static final MacAddress MAC_DST =
- MacAddress.getDefaultInstance("fa:fb:fc:fd:fe:ff");
- private static final int ETHTYPE_IPV4 = 0x800;
- private static final short VLAN_PCP = 7;
- private static final Ipv4Address IPV4_SRC =
- Ipv4Address.getDefaultInstance("192.168.10.254");
- private static final Ipv4Address IPV4_DST =
- Ipv4Address.getDefaultInstance("10.1.2.3");
+ private static final Uint64 DPID = Uint64.TEN;
+ private static final Uint32 IN_PORT = Uint32.valueOf(6);
+ private static final String URI_IN_PORT = "openflow:" + DPID + ":" + IN_PORT;
+ private static final MacAddress MAC_SRC = MacAddress.getDefaultInstance("00:11:22:33:44:55");
+ private static final MacAddress MAC_DST = MacAddress.getDefaultInstance("fa:fb:fc:fd:fe:ff");
+ private static final Uint16 ETHTYPE_IPV4 = Uint16.valueOf(0x800);
+ private static final Uint8 VLAN_PCP = Uint8.valueOf(7);
+ private static final Ipv4Address IPV4_SRC = Ipv4Address.getDefaultInstance("192.168.10.254");
+ private static final Ipv4Address IPV4_DST = Ipv4Address.getDefaultInstance("10.1.2.3");
private static final int DL_VLAN_NONE = 0xffff;
private ConvertorManager convertorManager;
FlowWildcardsV10Builder wcBuilder = new FlowWildcardsV10Builder();
for (int vid : vids) {
for (short dscp : dscps) {
- short tos = (short) (dscp << 2);
MatchV10Builder builder = new MatchV10Builder();
- builder.setDlSrc(MAC_SRC).setDlDst(MAC_DST).setDlVlan(vid).setDlVlanPcp(VLAN_PCP)
- .setDlType(ETHTYPE_IPV4).setInPort(IN_PORT.intValue()).setNwSrc(IPV4_SRC).setNwDst(IPV4_DST)
- .setNwTos(tos);
+ builder.setDlSrc(MAC_SRC).setDlDst(MAC_DST).setDlVlan(Uint16.valueOf(vid)).setDlVlanPcp(VLAN_PCP)
+ .setDlType(ETHTYPE_IPV4).setInPort(IN_PORT.toUint16()).setNwSrc(IPV4_SRC).setNwDst(IPV4_DST)
+ .setNwTos(Uint8.valueOf(dscp << 2));
wcBuilder.setAll(false).setNwProto(true).setTpSrc(true).setTpDst(true);
if (vid == DL_VLAN_NONE) {
wcBuilder.setDlVlanPcp(true);
assertEquals(null, ethMatch.getEthernetSource().getMask());
assertEquals(MAC_DST, ethMatch.getEthernetDestination().getAddress());
assertEquals(null, ethMatch.getEthernetDestination().getMask());
- assertEquals(ETHTYPE_IPV4, ethMatch.getEthernetType().getType().getValue().intValue());
+ assertEquals(ETHTYPE_IPV4.toUint32(), ethMatch.getEthernetType().getType().getValue());
NodeConnectorId inPort = builder.getInPort();
assertEquals(URI_IN_PORT, inPort.getValue());
return entries;
}
- private static MatchEntry toOfEthernetType(final int ethType) {
+ private static MatchEntry toOfEthernetType(final Uint16 ethType) {
MatchEntryBuilder builder = new MatchEntryBuilder();
builder.setOxmClass(OpenflowBasicClass.class);
builder.setHasMask(false);
}
private static MatchEntry toOfPort(final Class<? extends MatchField> field,
- final Long portNumber) {
+ final Uint32 portNumber) {
MatchEntryBuilder builder = new MatchEntryBuilder();
builder.setOxmClass(OpenflowBasicClass.class);
builder.setHasMask(false);
private static MatchEntry toOfVlanVid(final int vid) {
MatchEntryBuilder builder = new MatchEntryBuilder();
boolean cfi = true;
- Integer vidValue = vid;
+ final Uint16 vidValue;
byte[] mask = null;
builder.setOxmClass(OpenflowBasicClass.class);
builder.setOxmMatchField(VlanVid.class);
if (vid == 0) {
// Match untagged frame.
cfi = false;
+ vidValue = Uint16.ZERO;
} else if (vid < 0) {
// Match packet with VLAN tag regardless of its value.
mask = new byte[]{0x10, 0x00};
- vidValue = 0;
+ vidValue = Uint16.ZERO;
+ } else {
+ vidValue = Uint16.valueOf(vid);
}
VlanVidBuilder vlanVidBuilder = new VlanVidBuilder();
assertEquals(null, match.getLayer3Match());
} else {
assert ethMatch != null;
- assertEquals(ETHTYPE_IPV4, ethMatch.getEthernetType().getType().getValue().intValue());
+ assertEquals(ETHTYPE_IPV4.toUint32(), ethMatch.getEthernetType().getType().getValue());
Ipv4Match ipv4Match = (Ipv4Match) match.getLayer3Match();
- assertEquals(IPV4_SRC.getValue() + "/32",
- ipv4Match.getIpv4Source().getValue());
- assertEquals(IPV4_DST.getValue() + "/32",
- ipv4Match.getIpv4Destination().getValue());
+ assertEquals(IPV4_SRC.getValue() + "/32", ipv4Match.getIpv4Source().getValue());
+ assertEquals(IPV4_DST.getValue() + "/32", ipv4Match.getIpv4Destination().getValue());
}
VlanMatch vlanMatch = match.getVlanMatch();
if (wc.isDLVLANPCP()) {
assertEquals(null, vlanMatch.getVlanPcp());
} else {
- assertEquals(VLAN_PCP,
- vlanMatch.getVlanPcp().getValue().shortValue());
+ assertEquals(VLAN_PCP, vlanMatch.getVlanPcp().getValue());
}
}
}
MatchV10Builder builder = new MatchV10Builder();
builder.setWildcards(new FlowWildcardsV10(false, false, false, false,
false, false, false, false, false, false));
- builder.setNwSrcMask((short) 24);
- builder.setNwDstMask((short) 16);
- builder.setInPort(6653);
+ builder.setNwSrcMask(Uint8.valueOf(24));
+ builder.setNwDstMask(Uint8.valueOf(16));
+ builder.setInPort(Uint16.valueOf(6653));
builder.setDlSrc(new MacAddress("01:01:01:01:01:01"));
builder.setDlDst(new MacAddress("02:02:02:02:02:02"));
- builder.setDlVlan(128);
- builder.setDlVlanPcp((short) 2);
- builder.setDlType(15);
- builder.setNwTos((short) 16);
- builder.setNwProto((short) 6);
+ builder.setDlVlan(Uint16.valueOf(128));
+ builder.setDlVlanPcp(Uint8.TWO);
+ builder.setDlType(Uint16.valueOf(15));
+ builder.setNwTos(Uint8.valueOf(16));
+ builder.setNwProto(Uint8.valueOf(6));
builder.setNwSrc(new Ipv4Address("1.1.1.2"));
builder.setNwDst(new Ipv4Address("32.16.8.1"));
- builder.setTpSrc(2048);
- builder.setTpDst(4096);
+ builder.setTpSrc(Uint16.valueOf(2048));
+ builder.setTpDst(Uint16.valueOf(4096));
MatchV10 match = builder.build();
final VersionDatapathIdConvertorData datapathIdConvertorData =
MatchV10Builder builder = new MatchV10Builder();
builder.setWildcards(new FlowWildcardsV10(true, true, true, true,
true, true, true, true, true, true));
- builder.setNwSrcMask((short) 24);
- builder.setNwDstMask((short) 16);
- builder.setInPort(6653);
+ builder.setNwSrcMask(Uint8.valueOf(24));
+ builder.setNwDstMask(Uint8.valueOf(16));
+ builder.setInPort(Uint16.valueOf(6653));
builder.setDlSrc(new MacAddress("01:01:01:01:01:01"));
builder.setDlDst(new MacAddress("02:02:02:02:02:02"));
- builder.setDlVlan(128);
- builder.setDlVlanPcp((short) 2);
- builder.setDlType(15);
- builder.setNwTos((short) 14);
- builder.setNwProto((short) 6);
+ builder.setDlVlan(Uint16.valueOf(128));
+ builder.setDlVlanPcp(Uint8.TWO);
+ builder.setDlType(Uint16.valueOf(15));
+ builder.setNwTos(Uint8.valueOf(14));
+ builder.setNwProto(Uint8.valueOf(6));
builder.setNwSrc(new Ipv4Address("1.1.1.2"));
builder.setNwDst(new Ipv4Address("32.16.8.1"));
- builder.setTpSrc(2048);
- builder.setTpDst(4096);
+ builder.setTpSrc(Uint16.valueOf(2048));
+ builder.setTpDst(Uint16.valueOf(4096));
MatchV10 match = builder.build();
final VersionDatapathIdConvertorData datapathIdConvertorData =
MatchV10Builder builder = new MatchV10Builder();
builder.setWildcards(new FlowWildcardsV10(false, false, false, false,
false, false, false, false, false, false));
- builder.setNwProto((short) 17);
- builder.setTpSrc(2048);
- builder.setTpDst(4096);
+ builder.setNwProto(Uint8.valueOf(17));
+ builder.setTpSrc(Uint16.valueOf(2048));
+ builder.setTpDst(Uint16.valueOf(4096));
MatchV10 match = builder.build();
final VersionDatapathIdConvertorData datapathIdConvertorData =
Uint32 dlType = Uint32.valueOf(0x800L);
FlowWildcardsV10 wc = new FlowWildcardsV10(
true, true, false, true, true, true, true, true, true, true);
- MatchV10Builder builder = new MatchV10Builder().setWildcards(wc).setDlType(dlType.intValue());
+ MatchV10Builder builder = new MatchV10Builder().setWildcards(wc).setDlType(dlType.toUint16());
MatchV10 match = builder.build();
Uint64 dpid = Uint64.valueOf(12345L);
// Specify ICMPv4 protocol.
Uint8 ipProto = Uint8.ONE;
- match = builder.setNwProto(ipProto.shortValue()).build();
+ match = builder.setNwProto(ipProto).build();
salMatch = convert(match, datapathIdConvertorData).build();
etherMatch = salMatch.getEthernetMatch();
IpMatch ipMatch = salMatch.getIpMatch();
null, salMatch.getIcmpv4Match());
// Specify ICMPv4 type.
- Uint8 icmpType = Uint8.valueOf(10);
- match = builder.setTpSrc(icmpType.intValue()).build();
+ Uint8 icmpType = Uint8.TEN;
+ match = builder.setTpSrc(icmpType.toUint16()).build();
salMatch = convert(match, datapathIdConvertorData).build();
etherMatch = salMatch.getEthernetMatch();
ipMatch = salMatch.getIpMatch();
// Specify ICMPv4 code only.
Uint8 icmpCode = Uint8.valueOf(33);
- match = builder.setTpSrc((Uint16) null).setTpDst(icmpCode.intValue()).build();
+ match = builder.setTpSrc((Uint16) null).setTpDst(icmpCode.toUint16()).build();
salMatch = convert(match, datapathIdConvertorData).build();
etherMatch = salMatch.getEthernetMatch();
ipMatch = salMatch.getIpMatch();
// Specify both ICMPv4 type and code.
icmpType = Uint8.ZERO;
icmpCode = Uint8.valueOf(8);
- match = builder.setTpSrc(icmpType.intValue()).setTpDst(icmpCode.intValue()).build();
+ match = builder.setTpSrc(icmpType.toUint16()).setTpDst(icmpCode.toUint16()).build();
salMatch = convert(match, datapathIdConvertorData).build();
etherMatch = salMatch.getEthernetMatch();
ipMatch = salMatch.getIpMatch();
Uint32 dlType = Uint32.valueOf(0x800L);
FlowWildcardsV10 wc = new FlowWildcardsV10(
true, true, false, true, true, true, false, true, true, true);
- MatchV10Builder builder = new MatchV10Builder().setWildcards(wc).setDlType(dlType.intValue());
+ MatchV10Builder builder = new MatchV10Builder().setWildcards(wc).setDlType(dlType.toUint16());
MatchV10 match = builder.build();
Uint64 dpid = Uint64.valueOf(12345L);
Uint32 dlType = Uint32.valueOf(0x800L);
FlowWildcardsV10 wc = new FlowWildcardsV10(
true, true, false, true, true, true, false, true, true, true);
- MatchV10Builder builder = new MatchV10Builder().setWildcards(wc).setDlType(dlType.intValue());
+ MatchV10Builder builder = new MatchV10Builder().setWildcards(wc).setDlType(dlType.toUint16());
MatchV10 match = builder.build();
Uint64 dpid = Uint64.valueOf(12345L);
private static final BigInteger BIG_INTEGER = new BigInteger("1684367103");
private static final BigInteger BIG_INTFF = new BigInteger("4294967295");
- private static final Integer MEDIUM_INTEGER = new Integer("6579558");
- private static final Integer MEDIUM_INTEGERFF = new Integer("16777215");
+ private static final long MEDIUM_INTEGER = 6579558;
+ private static final long MEDIUM_INTEGERFF = 16777215;
private static final int INT00 = 0;
private static final int SHORT_BYTE_LENGTH = 2;
@Test
public void testBytesToUnsignedMedium() {
long unsigned = ByteUtil.bytesToUnsignedMedium(TEST3_BYTES);
- assertEquals(MEDIUM_INTEGER.longValue(), unsigned);
+ assertEquals(MEDIUM_INTEGER, unsigned);
unsigned = ByteUtil.bytesToUnsignedMedium(TEST3_BYTES00);
assertEquals(0, unsigned);
unsigned = ByteUtil.bytesToUnsignedMedium(TEST3_BYTESFF);
- assertEquals(MEDIUM_INTEGERFF.longValue(), unsigned);
+ assertEquals(MEDIUM_INTEGERFF, unsigned);
}
@Test(expected = IllegalArgumentException.class)
private static final Uint64 PATH_ID = Uint64.valueOf(10);
/**
- * Test method for {@link InventoryDataServiceUtil#nodeUpdatedBuilderFromDataPathId(BigInteger datapathId)}.
+ * Test method for {@link InventoryDataServiceUtil#nodeUpdatedBuilderFromDataPathId(Uint64 datapathId)}.
*/
@Test
public void testNodeUpdatedBuilderFromDataPathId() {
}
/**
- * Test method for {@link InventoryDataServiceUtil#nodeConnectorBuilderFromDatapathIdPortNo(BigInteger datapathId,
- * Long portNo, org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion ofVersion)}.
+ * Test method for {@link InventoryDataServiceUtil#nodeConnectorBuilderFromDatapathIdPortNo(Uint64 datapathId,
+ * Uint32 portNo, org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion ofVersion)}.
*/
@Test
public void testNodeConnectorBuilderFromDatapathIdPortNo() {
/**
* Test method for {@link InventoryDataServiceUtil#nodeConnectorUpdatedBuilderFromDatapathIdPortNo(
- * BigInteger datapathId, Long portNo, OpenflowVersion ofVersion)}.
+ * Uint64 datapathId, Uint32 portNo, OpenflowVersion ofVersion)}.
*/
@Test
public void testNodeConnectorUpdatedBuilderFromDatapathIdPortNo() {
/**
* Test method for {@link InventoryDataServiceUtil#nodeConnectorInstanceIdentifierFromDatapathIdPortno(
- * BigInteger datapathId, Long portNo, OpenflowVersion ofVersion)}.
+ * Uint64 datapathId, Uint32 portNo, OpenflowVersion ofVersion)}.
*/
@Test
public void testNodeConnectorInstanceIdentifierFromDatapathIdPortno() {
/**
* Test method for {@link InventoryDataServiceUtil#nodeConnectorRefFromDatapathIdPortno(
- * BigInteger datapathId, Long portNo, OpenflowVersion ofVersion)}.
+ * Uint64 datapathId, Uint32 portNo, OpenflowVersion ofVersion)}.
*/
@Test
public void testNodeConnectorRefFromDatapathIdPortno() {
}
/**
- * test for method {@link OpenflowPortsUtil#checkPortValidity(OpenflowVersion, Long)} - OF-1.0.
+ * test for method {@link OpenflowPortsUtil#checkPortValidity(OpenflowVersion, Uint32)} - OF-1.0.
*/
@Test
public void testCheckPortValidity10() {
}
/**
- * test for method {@link OpenflowPortsUtil#checkPortValidity(OpenflowVersion, Long)} - OF-1.3.
+ * test for method {@link OpenflowPortsUtil#checkPortValidity(OpenflowVersion, Uint32)} - OF-1.3.
*/
@Test
public void testCheckPortValidity13() {