package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match;
-import com.google.common.base.Optional;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
import org.opendaylight.openflowplugin.extension.api.ConverterExtensionKey;
import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
import org.opendaylight.openflowplugin.openflow.md.core.extension.ExtensionResolvers;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.OFApprovedExperimenterIds;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.OFApprovedExperimenterIds;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorProcessor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cases.SalToOfArpMatchCase;
vidEntryValue = vlanId.getVlanId().getValue();
}
- hasmask = (vidEntryValue == 0);
+ hasmask = vidEntryValue == 0;
if (hasmask) {
vlanVidBuilder.setMask(VLAN_VID_MASK);
}
/**
* TODO: EXTENSION PROPOSAL (match, MD-SAL to OFJava)
* - we might need version for conversion and for key
- * - sanitize NPE
*/
Optional<GeneralExtensionListGrouping> extensionListOpt = ExtensionResolvers.getMatchExtensionResolver().getExtension(match);
if (extensionListOpt.isPresent()) {
- for (ExtensionList extensionItem : extensionListOpt.get().getExtensionList()) {
+ List<ExtensionList> extensionListList = extensionListOpt.get().getExtensionList();
+ for (ExtensionList extensionItem : extensionListList) {
// TODO: get real version
ConverterExtensionKey<? extends ExtensionKey> key = new ConverterExtensionKey<>(extensionItem.getExtensionKey(), OFConstants.OFP_VERSION_1_3);
ConvertorToOFJava<MatchEntry> convertor = OFSessionUtil.getExtensionConvertorProvider().getConverter(key);
+ if (convertor == null) {
+ throw new IllegalStateException("No converter found for key: " + key.toString());
+ }
MatchEntry ofMatch = convertor.convert(extensionItem.getExtension());
result.add(ofMatch);
}