use of org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.CodecPreconditionException in project openflowplugin by opendaylight.
the class UdpDstConvertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmOfUdpDstGrouping> matchGrouping = MatchUtil.UDP_DST_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
UdpDstCaseValueBuilder udpDstCaseValueBuilder = new UdpDstCaseValueBuilder();
UdpDstValuesBuilder udpDstValuesBuilder = new UdpDstValuesBuilder();
udpDstValuesBuilder.setPort(matchGrouping.get().getNxmOfUdpDst().getPort());
udpDstValuesBuilder.setMask(matchGrouping.get().getNxmOfUdpDst().getMask());
udpDstCaseValueBuilder.setUdpDstValues(udpDstValuesBuilder.build());
MatchEntryBuilder ofMatch = MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfUdpDst.class, Nxm0Class.class, udpDstCaseValueBuilder.build());
ofMatch.setHasMask(true);
return ofMatch.build();
}
use of org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.CodecPreconditionException 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