use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.EthTypeCaseValueBuilder in project openflowplugin by opendaylight.
the class EthTypeConvertorTest method testConvert1.
@Test
public void testConvert1() throws Exception {
final EthTypeValuesBuilder ethTypeValuesBuilder = new EthTypeValuesBuilder().setValue(Integer.valueOf(1));
final EthTypeCaseValueBuilder ethTypeCaseValueBuilder = new EthTypeCaseValueBuilder().setEthTypeValues(ethTypeValuesBuilder.build());
final EthTypeCaseValue ethTypeCaseValue = ethTypeCaseValueBuilder.build();
when(matchEntry.getMatchEntryValue()).thenReturn(ethTypeCaseValue);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = ethTypeConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
Assert.assertEquals(1, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfEthType().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthTypeKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = ethTypeConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfEthType().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthTypeKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = ethTypeConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfEthType().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthTypeKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = ethTypeConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfEthType().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthTypeKey.class);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.EthTypeCaseValueBuilder in project openflowplugin by opendaylight.
the class EthTypeCodec method deserialize.
@Override
public MatchEntry deserialize(ByteBuf message) {
MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
EthTypeCaseValueBuilder caseBuilder = new EthTypeCaseValueBuilder();
EthTypeValuesBuilder valuesBuilder = new EthTypeValuesBuilder();
valuesBuilder.setValue(message.readUnsignedShort()).build();
caseBuilder.setEthTypeValues(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.EthTypeCaseValueBuilder in project openflowplugin by opendaylight.
the class EthTypeCodecTest method createMatchEntry.
private MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final EthTypeCaseValueBuilder caseBuilder = new EthTypeCaseValueBuilder();
final EthTypeValuesBuilder valuesBuilder = new EthTypeValuesBuilder();
matchEntryBuilder.setOxmClass(Nxm0Class.class);
matchEntryBuilder.setOxmMatchField(NxmOfEthType.class);
matchEntryBuilder.setHasMask(false);
valuesBuilder.setValue(1);
caseBuilder.setEthTypeValues(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.EthTypeCaseValueBuilder in project openflowplugin by opendaylight.
the class EthTypeConvertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmOfEthTypeGrouping> matchGrouping = MatchUtil.ETH_TYPE_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
Integer value = matchGrouping.get().getNxmOfEthType().getValue();
EthTypeCaseValueBuilder ethTypeCaseValueBuilder = new EthTypeCaseValueBuilder();
ethTypeCaseValueBuilder.setEthTypeValues(new EthTypeValuesBuilder().setValue(value).build());
return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfEthType.class, Nxm0Class.class, ethTypeCaseValueBuilder.build()).build();
}
Aggregations