.idea/
target/
+target-ide/
*.class
*.iml
**/target
repository
workspace
*~
-target
.classpath
.project
.settings
/**
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
+ *
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
/**
* lookup and register key for extension converters, basic case expects this to
* correlate with input model type
- *
+ *
* @param <T> type of key
*/
public class ConverterExtensionKey<T extends ExtensionKey> extends TypeVersionKey<T> {
- /**
- * @param type
- */
public ConverterExtensionKey(Class<T> type, short ofVersion) {
super(type, ofVersion);
}
/**
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
+ *
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
/**
* lookup and register key for extension converters, basic case expects this to
* correlate with input model type
- *
+ *
* @param <T> type of key
*/
public class TypeVersionKey<T> {
- private Class<? extends T> type;
- private short ofVersion;
+ private final Class<? extends T> type;
+ private final short ofVersion;
- /**
- * @param type
- * @param ofVersion
- */
public TypeVersionKey(Class<? extends T> type, short ofVersion) {
this.type = type;
this.ofVersion = ofVersion;
final int prime = 31;
int result = 1;
result = prime * result + ofVersion;
- result = prime * result + ((type == null) ? 0 : type.hashCode());
+ result = prime * result + (type == null ? 0 : type.hashCode());
return result;
}
return false;
}
if (type == null) {
- if (other.type != null)
+ if (other.type != null) {
return false;
- } else if (!type.equals(other.type))
+ }
+ } else if (!type.equals(other.type)) {
return false;
+ }
return true;
}
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " [type=" + type + ", ofVersion=" + ofVersion + "]";
+ }
+
}
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);
}