use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpTpaCaseValueBuilder in project openflowplugin by opendaylight.
the class ArpTpaConvertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmOfArpTpaGrouping> matchGrouping = MatchUtil.ARP_TPA_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
Long value = IpConverter.ipv4AddressToLong(matchGrouping.get().getNxmOfArpTpa().getIpv4Address());
ArpTpaCaseValueBuilder arpTpaCaseValueBuilder = new ArpTpaCaseValueBuilder();
arpTpaCaseValueBuilder.setArpTpaValues(new ArpTpaValuesBuilder().setValue(value).build());
return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfArpTpa.class, Nxm0Class.class, arpTpaCaseValueBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpTpaCaseValueBuilder in project openflowplugin by opendaylight.
the class ArpTpaCodecTest method createMatchEntry.
private MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final ArpTpaCaseValueBuilder caseBuilder = new ArpTpaCaseValueBuilder();
final ArpTpaValuesBuilder valuesBuilder = new ArpTpaValuesBuilder();
matchEntryBuilder.setOxmClass(Nxm0Class.class);
matchEntryBuilder.setOxmMatchField(NxmOfArpTpa.class);
matchEntryBuilder.setHasMask(false);
valuesBuilder.setValue((long) 1);
caseBuilder.setArpTpaValues(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.ArpTpaCaseValueBuilder in project openflowplugin by opendaylight.
the class ArpTpaCodec method deserialize.
@Override
public MatchEntry deserialize(ByteBuf message) {
MatchEntryBuilder matchEntriesBuilder = deserializeHeaderToBuilder(message);
ArpTpaCaseValueBuilder caseBuilder = new ArpTpaCaseValueBuilder();
caseBuilder.setArpTpaValues(new ArpTpaValuesBuilder().setValue(message.readUnsignedInt()).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.ArpTpaCaseValueBuilder in project openflowplugin by opendaylight.
the class ArpTpaConvertorTest method testConvertToOFJava.
@Test
public void testConvertToOFJava() throws Exception {
final ArpTpaValuesBuilder arpTpaValuesBuilder = new ArpTpaValuesBuilder().setValue(IpConverter.ipv4AddressToLong(IPV4_ADDRESS));
final ArpTpaCaseValueBuilder arpTpaCaseValueBuilder = new ArpTpaCaseValueBuilder().setArpTpaValues(arpTpaValuesBuilder.build());
final ArpTpaCaseValue arpTpaCaseValue = arpTpaCaseValueBuilder.build();
when(matchEntry.getMatchEntryValue()).thenReturn(arpTpaCaseValue);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = arpTpaConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfArpTpa().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpTpaKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = arpTpaConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfArpTpa().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpTpaKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = arpTpaConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfArpTpa().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpTpaKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = arpTpaConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfArpTpa().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpTpaKey.class);
}
Aggregations