use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.ipv4.dst.grouping.TunIpv4DstValuesBuilder in project openflowplugin by opendaylight.
the class TunIpv4DstCodecTest method createMatchEntry.
private MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final TunIpv4DstCaseValueBuilder caseBuilder = new TunIpv4DstCaseValueBuilder();
final TunIpv4DstValuesBuilder valuesBuilder = new TunIpv4DstValuesBuilder();
matchEntryBuilder.setOxmClass(Nxm1Class.class);
matchEntryBuilder.setOxmMatchField(NxmNxTunIpv4Dst.class);
matchEntryBuilder.setHasMask(false);
valuesBuilder.setValue((long) 1);
caseBuilder.setTunIpv4DstValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
return matchEntryBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.ipv4.dst.grouping.TunIpv4DstValuesBuilder in project openflowplugin by opendaylight.
the class TunIPv4DstConvertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmNxTunIpv4DstGrouping> matchGrouping = MatchUtil.TUN_IPV4_DST_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
Ipv4Address value = matchGrouping.get().getNxmNxTunIpv4Dst().getIpv4Address();
TunIpv4DstCaseValueBuilder tunIpv4DstCaseValueBuilder = new TunIpv4DstCaseValueBuilder();
tunIpv4DstCaseValueBuilder.setTunIpv4DstValues(new TunIpv4DstValuesBuilder().setValue(MatchUtil.ipv4ToLong(value)).build());
return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunIpv4Dst.class, Nxm1Class.class, tunIpv4DstCaseValueBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.ipv4.dst.grouping.TunIpv4DstValuesBuilder in project openflowplugin by opendaylight.
the class TunIpv4DstCodec method deserialize.
@Override
public MatchEntry deserialize(ByteBuf message) {
MatchEntryBuilder matchEntriesBuilder = deserializeHeaderToBuilder(message);
TunIpv4DstCaseValueBuilder caseBuilder = new TunIpv4DstCaseValueBuilder();
TunIpv4DstValuesBuilder valuesBuilder = new TunIpv4DstValuesBuilder();
valuesBuilder.setValue(message.readUnsignedInt());
caseBuilder.setTunIpv4DstValues(valuesBuilder.build());
matchEntriesBuilder.setMatchEntryValue(caseBuilder.build());
return matchEntriesBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.ipv4.dst.grouping.TunIpv4DstValuesBuilder in project openflowplugin by opendaylight.
the class TunIPv4DstConvertorTest method testConvert1.
@Test
public void testConvert1() throws Exception {
final TunIpv4DstValuesBuilder tunIpv4DstValuesBuilder = new TunIpv4DstValuesBuilder().setValue(IpConverter.ipv4AddressToLong(IPV4_ADDRESS));
final TunIpv4DstCaseValueBuilder tunIpv4DstCaseValueBuilder = new TunIpv4DstCaseValueBuilder().setTunIpv4DstValues(tunIpv4DstValuesBuilder.build());
final TunIpv4DstCaseValue tunIpv4DstCaseValue = tunIpv4DstCaseValueBuilder.build();
when(matchEntry.getMatchEntryValue()).thenReturn(tunIpv4DstCaseValue);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tunIPv4DstConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxTunIpv4Dst().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIpv4DstKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tunIPv4DstConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmNxTunIpv4Dst().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIpv4DstKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tunIPv4DstConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxTunIpv4Dst().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIpv4DstKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tunIPv4DstConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxTunIpv4Dst().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIpv4DstKey.class);
}
Aggregations