Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Return singleton empty collection instead of null in Read service code
[controller.git]
/
opendaylight
/
protocol_plugins
/
openflow
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
protocol_plugin
/
openflow
/
internal
/
FlowConverter.java
diff --git
a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowConverter.java
b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowConverter.java
index 756a6895dc06e19ef0fbcbd85314c3fb0abdc645..daf1aa8b7168a8b3a4670f21d0468036e42a380f 100644
(file)
--- a/
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowConverter.java
+++ b/
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowConverter.java
@@
-76,6
+76,13
@@
import org.slf4j.LoggerFactory;
public class FlowConverter {
protected static final Logger logger = LoggerFactory
.getLogger(FlowConverter.class);
public class FlowConverter {
protected static final Logger logger = LoggerFactory
.getLogger(FlowConverter.class);
+
+ /*
+ * The value 0xffff (OFP_VLAN_NONE) is used to indicate
+ * that no VLAN ID is set for OF Flow.
+ */
+ private static final short OFP_VLAN_NONE = (short) 0xffff;
+
private Flow flow; // SAL Flow
private OFMatch ofMatch; // OF 1.0 match or OF 1.0 + IPv6 extension match
private List<OFAction> actionsList; // OF 1.0 actions
private Flow flow; // SAL Flow
private OFMatch ofMatch; // OF 1.0 match or OF 1.0 + IPv6 extension match
private List<OFAction> actionsList; // OF 1.0 actions
@@
-143,6
+150,9
@@
public class FlowConverter {
if (match.isPresent(MatchType.DL_VLAN)) {
short vlan = (Short) match.getField(MatchType.DL_VLAN)
.getValue();
if (match.isPresent(MatchType.DL_VLAN)) {
short vlan = (Short) match.getField(MatchType.DL_VLAN)
.getValue();
+ if (vlan == MatchType.DL_VLAN_NONE) {
+ vlan = OFP_VLAN_NONE;
+ }
if (!isIPv6) {
ofMatch.setDataLayerVirtualLan(vlan);
wildcards &= ~OFMatch.OFPFW_DL_VLAN;
if (!isIPv6) {
ofMatch.setDataLayerVirtualLan(vlan);
wildcards &= ~OFMatch.OFPFW_DL_VLAN;
@@
-514,9
+524,13
@@
public class FlowConverter {
salMatch.setField(new MatchField(MatchType.DL_TYPE,
ofMatch.getDataLayerType()));
}
salMatch.setField(new MatchField(MatchType.DL_TYPE,
ofMatch.getDataLayerType()));
}
- if (ofMatch.getDataLayerVirtualLan() != 0) {
+ short vlan = ofMatch.getDataLayerVirtualLan();
+ if (vlan != 0) {
+ if (vlan == OFP_VLAN_NONE) {
+ vlan = MatchType.DL_VLAN_NONE;
+ }
salMatch.setField(new MatchField(MatchType.DL_VLAN,
salMatch.setField(new MatchField(MatchType.DL_VLAN,
-
ofMatch.getDataLayerVirtualLan()
));
+
vlan
));
}
if (ofMatch.getDataLayerVirtualLanPriorityCodePoint() != 0) {
salMatch.setField(MatchType.DL_VLAN_PR, ofMatch
}
if (ofMatch.getDataLayerVirtualLanPriorityCodePoint() != 0) {
salMatch.setField(MatchType.DL_VLAN_PR, ofMatch
@@
-543,6
+557,7
@@
public class FlowConverter {
byte tos = (byte) (dscp >> 2);
salMatch.setField(MatchType.NW_TOS, tos);
}
byte tos = (byte) (dscp >> 2);
salMatch.setField(MatchType.NW_TOS, tos);
}
+ //TODO: NW protocol 0 is a valid protocol
if (ofMatch.getNetworkProtocol() != 0) {
salMatch.setField(MatchType.NW_PROTO,
ofMatch.getNetworkProtocol());
if (ofMatch.getNetworkProtocol() != 0) {
salMatch.setField(MatchType.NW_PROTO,
ofMatch.getNetworkProtocol());
@@
-582,9
+597,13
@@
public class FlowConverter {
salMatch.setField(new MatchField(MatchType.DL_TYPE,
v6Match.getDataLayerType()));
}
salMatch.setField(new MatchField(MatchType.DL_TYPE,
v6Match.getDataLayerType()));
}
- if (v6Match.getDataLayerVirtualLan() != 0) {
+ short vlan = v6Match.getDataLayerVirtualLan();
+ if (vlan != 0) {
+ if (vlan == OFP_VLAN_NONE) {
+ vlan = MatchType.DL_VLAN_NONE;
+ }
salMatch.setField(new MatchField(MatchType.DL_VLAN,
salMatch.setField(new MatchField(MatchType.DL_VLAN,
- v
6Match.getDataLayerVirtualLan()
));
+ v
lan
));
}
if (v6Match.getDataLayerVirtualLanPriorityCodePoint() != 0) {
salMatch.setField(MatchType.DL_VLAN_PR, v6Match
}
if (v6Match.getDataLayerVirtualLanPriorityCodePoint() != 0) {
salMatch.setField(MatchType.DL_VLAN_PR, v6Match