use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.arp.spa.grouping.ArpSpaValuesBuilder in project openflowplugin by opendaylight.
the class ArpSpaCodec method deserialize.
@Override
public MatchEntry deserialize(ByteBuf message) {
MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
ArpSpaCaseValueBuilder caseBuilder = new ArpSpaCaseValueBuilder();
caseBuilder.setArpSpaValues(new ArpSpaValuesBuilder().setValue(message.readUnsignedInt()).build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
return matchEntryBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.arp.spa.grouping.ArpSpaValuesBuilder in project openflowplugin by opendaylight.
the class ArpSpaConvertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmOfArpSpaGrouping> matchGrouping = MatchUtil.ARP_SPA_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
Long value = IpConverter.ipv4AddressToLong(matchGrouping.get().getNxmOfArpSpa().getIpv4Address());
ArpSpaCaseValueBuilder arpSpaCaseValueBuilder = new ArpSpaCaseValueBuilder();
arpSpaCaseValueBuilder.setArpSpaValues(new ArpSpaValuesBuilder().setValue(value).build());
return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfArpSpa.class, Nxm0Class.class, arpSpaCaseValueBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.arp.spa.grouping.ArpSpaValuesBuilder in project openflowplugin by opendaylight.
the class ArpSpaCodecTest method createMatchEntry.
private MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final ArpSpaCaseValueBuilder caseBuilder = new ArpSpaCaseValueBuilder();
final ArpSpaValuesBuilder valuesBuilder = new ArpSpaValuesBuilder();
matchEntryBuilder.setOxmClass(Nxm0Class.class);
matchEntryBuilder.setOxmMatchField(NxmOfArpSpa.class);
matchEntryBuilder.setHasMask(false);
valuesBuilder.setValue((long) 1);
caseBuilder.setArpSpaValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
return matchEntryBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.arp.spa.grouping.ArpSpaValuesBuilder in project openflowplugin by opendaylight.
the class ArpSpaConvertorTest method testConvertFromOFJava.
@Test
public void testConvertFromOFJava() throws Exception {
final ArpSpaValuesBuilder arpSpaValuesBuilder = new ArpSpaValuesBuilder().setValue(IpConverter.ipv4AddressToLong(IPV4_ADDRESS));
final ArpSpaCaseValueBuilder arpSpaCaseValueBuilder = new ArpSpaCaseValueBuilder().setArpSpaValues(arpSpaValuesBuilder.build());
final ArpSpaCaseValue arpSpaCaseValue = arpSpaCaseValueBuilder.build();
when(matchEntry.getMatchEntryValue()).thenReturn(arpSpaCaseValue);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = arpSpaConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfArpSpa().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpSpaKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = arpSpaConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfArpSpa().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpSpaKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = arpSpaConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfArpSpa().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpSpaKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = arpSpaConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
Assert.assertEquals(IPV4_ADDRESS, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfArpSpa().getIpv4Address());
Assert.assertEquals(extensionAugment.getKey(), NxmOfArpSpaKey.class);
}
Aggregations