use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension in project openflowplugin by opendaylight.
the class NshNpConvertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmNxNshNpGrouping> matchGrouping = MatchUtil.NSH_NP_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
Short value = matchGrouping.get().getNxmNxNshNp().getValue();
NshNpCaseValueBuilder nshNpCaseValueBuilder = new NshNpCaseValueBuilder();
nshNpCaseValueBuilder.setNshNpValues(new NshNpValuesBuilder().setValue(value).build());
return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNshNp.class, Nxm1Class.class, nshNpCaseValueBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension in project openflowplugin by opendaylight.
the class RegConvertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmNxRegGrouping> matchGrouping = MatchUtil.REG_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
NxmNxReg nxmNxReg = matchGrouping.get().getNxmNxReg();
RegValuesBuilder regValuesBuilder = new RegValuesBuilder().setValue(nxmNxReg.getValue()).setMask(nxmNxReg.getMask());
RegCaseValueBuilder regCaseValueBuilder = new RegCaseValueBuilder();
regCaseValueBuilder.setRegValues(regValuesBuilder.build());
return MatchUtil.createDefaultMatchEntryBuilder(nxmNxReg.getReg(), Nxm1Class.class, regCaseValueBuilder.build()).setHasMask(Objects.nonNull(nxmNxReg.getMask())).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension in project openflowplugin by opendaylight.
the class TcpSrcConvertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmOfTcpSrcGrouping> matchGrouping = MatchUtil.TCP_SRC_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
TcpSrcCaseValueBuilder tcpSrcCaseValueBuilder = new TcpSrcCaseValueBuilder();
TcpSrcValuesBuilder tcpSrcValuesBuilder = new TcpSrcValuesBuilder();
tcpSrcValuesBuilder.setPort(matchGrouping.get().getNxmOfTcpSrc().getPort());
tcpSrcValuesBuilder.setMask(matchGrouping.get().getNxmOfTcpSrc().getMask());
tcpSrcCaseValueBuilder.setTcpSrcValues(tcpSrcValuesBuilder.build());
MatchEntryBuilder ofMatch = MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfTcpSrc.class, Nxm0Class.class, tcpSrcCaseValueBuilder.build());
ofMatch.setHasMask(true);
return ofMatch.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension in project openflowplugin by opendaylight.
the class UdpSrcConvertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmOfUdpSrcGrouping> matchGrouping = MatchUtil.UDP_SRC_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
UdpSrcCaseValueBuilder udpSrcCaseValueBuilder = new UdpSrcCaseValueBuilder();
UdpSrcValuesBuilder udpSrcValuesBuilder = new UdpSrcValuesBuilder();
udpSrcValuesBuilder.setPort(matchGrouping.get().getNxmOfUdpSrc().getPort());
udpSrcValuesBuilder.setMask(matchGrouping.get().getNxmOfUdpSrc().getMask());
udpSrcCaseValueBuilder.setUdpSrcValues(udpSrcValuesBuilder.build());
MatchEntryBuilder ofMatch = MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfUdpSrc.class, Nxm0Class.class, udpSrcCaseValueBuilder.build());
ofMatch.setHasMask(true);
return ofMatch.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension in project openflowplugin by opendaylight.
the class ArpShaConvertorTest method setUp.
@Before
public void setUp() throws Exception {
final NxmNxArpShaBuilder nxmNxArpShaBuilder = new NxmNxArpShaBuilder().setMacAddress(MAC_ADDRESS);
final NxAugMatchRpcAddFlowBuilder nxAugMatchRpcAddFlowBuilder = new NxAugMatchRpcAddFlowBuilder().setNxmNxArpSha(nxmNxArpShaBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build();
when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
arpShaConvertor = new ArpShaConvertor();
}
Aggregations