use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIdCaseValueBuilder in project openflowplugin by opendaylight.
the class TunIdConvertor method convert.
@Override
public MatchEntry convert(final Extension extension) {
Optional<NxmNxTunIdGrouping> matchGrouping = MatchUtil.TUN_ID_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
BigInteger value = matchGrouping.get().getNxmNxTunId().getValue();
TunIdCaseValueBuilder tunnelIdCaseBuilder = new TunIdCaseValueBuilder();
TunIdValuesBuilder tunnelIdBuilder = new TunIdValuesBuilder();
tunnelIdBuilder.setValue(value);
tunnelIdCaseBuilder.setTunIdValues(tunnelIdBuilder.build());
return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunId.class, Nxm1Class.class, tunnelIdCaseBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIdCaseValueBuilder in project openflowplugin by opendaylight.
the class TunIdCodecTest method createMatchEntry.
private MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final TunIdCaseValueBuilder caseBuilder = new TunIdCaseValueBuilder();
final TunIdValuesBuilder valuesBuilder = new TunIdValuesBuilder();
matchEntryBuilder.setOxmClass(Nxm1Class.class);
matchEntryBuilder.setOxmMatchField(NxmNxTunId.class);
matchEntryBuilder.setHasMask(false);
byte[] value = new byte[VALUE_LENGTH];
valuesBuilder.setValue(new BigInteger(value));
caseBuilder.setTunIdValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
return matchEntryBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIdCaseValueBuilder in project openflowplugin by opendaylight.
the class TunIdCodec method deserialize.
@Override
public MatchEntry deserialize(ByteBuf message) {
MatchEntryBuilder matchEntriesBuilder = deserializeHeaderToBuilder(message);
TunIdCaseValueBuilder caseBuilder = new TunIdCaseValueBuilder();
TunIdValuesBuilder tunIdBuilder = new TunIdValuesBuilder();
tunIdBuilder.setValue(BigInteger.valueOf(message.readLong()));
caseBuilder.setTunIdValues(tunIdBuilder.build());
matchEntriesBuilder.setMatchEntryValue(caseBuilder.build());
return matchEntriesBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIdCaseValueBuilder in project openflowplugin by opendaylight.
the class TunIdConvertorTest method testConvert1.
@Test
public void testConvert1() throws Exception {
final TunIdValuesBuilder tunIdValuesBuilder = new TunIdValuesBuilder().setValue(BigInteger.TEN);
final TunIdCaseValueBuilder tunIdCaseValueBuilder = new TunIdCaseValueBuilder().setTunIdValues(tunIdValuesBuilder.build());
final TunIdCaseValue tunIdCaseValue = tunIdCaseValueBuilder.build();
when(matchEntry.getMatchEntryValue()).thenReturn(tunIdCaseValue);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tunIdConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
Assert.assertEquals(BigInteger.TEN, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxTunId().getValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIdKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tunIdConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
Assert.assertEquals(BigInteger.TEN, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmNxTunId().getValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIdKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tunIdConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
Assert.assertEquals(BigInteger.TEN, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxTunId().getValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIdKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tunIdConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
Assert.assertEquals(BigInteger.TEN, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxTunId().getValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIdKey.class);
}
Aggregations