use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpSpaCaseValue in project openflowplugin by opendaylight.
the class ArpSpaConvertorTest method testConvertToOFJava.
@Test
public void testConvertToOFJava() throws Exception {
final NxmOfArpSpaBuilder nxmOfArpSpaBuilder = new NxmOfArpSpaBuilder().setIpv4Address(IPV4_ADDRESS);
final NxAugMatchRpcAddFlowBuilder nxAugMatchRpcAddFlowBuilder = new NxAugMatchRpcAddFlowBuilder();
nxAugMatchRpcAddFlowBuilder.setNxmOfArpSpa(nxmOfArpSpaBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build();
when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
final MatchEntry converted = arpSpaConvertor.convert(extension);
Assert.assertEquals(IpConverter.ipv4AddressToLong(IPV4_ADDRESS), ((ArpSpaCaseValue) converted.getMatchEntryValue()).getArpSpaValues().getValue().longValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpSpaCaseValue in project openflowplugin by opendaylight.
the class ArpSpaCodecTest method deserializeTest.
@Test
public void deserializeTest() {
createBuffer(buffer);
input = arpSpaCodec.deserialize(buffer);
final ArpSpaCaseValue result = (ArpSpaCaseValue) input.getMatchEntryValue();
assertEquals(Nxm0Class.class, input.getOxmClass());
assertEquals(NxmOfArpSpa.class, input.getOxmMatchField());
assertEquals(false, input.isHasMask());
assertEquals(2, result.getArpSpaValues().getValue().shortValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpSpaCaseValue in project openflowplugin by opendaylight.
the class ArpSpaCodec method serialize.
@Override
public void serialize(MatchEntry input, ByteBuf outBuffer) {
serializeHeader(input, outBuffer);
ArpSpaCaseValue arpSpaCase = ((ArpSpaCaseValue) input.getMatchEntryValue());
outBuffer.writeInt(arpSpaCase.getArpSpaValues().getValue().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpSpaCaseValue in project openflowplugin by opendaylight.
the class ArpSpaConvertor method convert.
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
ArpSpaCaseValue arpSpaCaseValue = (ArpSpaCaseValue) input.getMatchEntryValue();
Ipv4Address ipv4Address = IpConverter.longToIpv4Address(arpSpaCaseValue.getArpSpaValues().getValue());
return resolveAugmentation(new NxmOfArpSpaBuilder().setIpv4Address(ipv4Address).build(), path, NxmOfArpSpaKey.class);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpSpaCaseValue 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