Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Bug 963 - OSGi error in Topology manager component - After exiting mininet...
[controller.git]
/
opendaylight
/
md-sal
/
compatibility
/
sal-compatibility
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
sal
/
compatibility
/
FromSalConversionsUtils.java
diff --git
a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java
b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java
index a879a36f8c23e6321f26c8fee0ec47a4569df2a9..ecf1a94c18c8123dbcffe5c9d398ce69566f356d 100644
(file)
--- a/
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java
+++ b/
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java
@@
-61,10
+61,16
@@
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026
import com.google.common.net.InetAddresses;
import com.google.common.net.InetAddresses;
-public class FromSalConversionsUtils {
+/**
+ * MD-SAL to AD-SAL conversions collection
+ */
+public final class FromSalConversionsUtils {
- private FromSalConversionsUtils() {
+ /** http://en.wikipedia.org/wiki/IPv4#Packet_structure (end of octet number 1, bit 14.+15.) */
+ public static final int ENC_FIELD_BIT_SIZE = 2;
+ private FromSalConversionsUtils() {
+ throw new IllegalAccessError("forcing no instance for factory");
}
@SuppressWarnings("unused")
}
@SuppressWarnings("unused")
@@
-103,7
+109,8
@@
public class FromSalConversionsUtils {
private static NodeConnectorId inPortMatch(Match sourceMatch) {
MatchField inPort = sourceMatch.getField(MatchType.IN_PORT);
if(inPort != null && inPort.getValue() != null && (inPort.getValue() instanceof NodeConnector)) {
private static NodeConnectorId inPortMatch(Match sourceMatch) {
MatchField inPort = sourceMatch.getField(MatchType.IN_PORT);
if(inPort != null && inPort.getValue() != null && (inPort.getValue() instanceof NodeConnector)) {
- return new NodeConnectorId(((NodeConnector) inPort.getValue()).getNodeConnectorIdAsString());
+ NodeConnector port = (NodeConnector)inPort.getValue();
+ return (NodeConnectorId)MDFlowMapping.toUri(port);
}
return null;
}
}
return null;
}
@@
-203,8
+210,11
@@
public class FromSalConversionsUtils {
MatchField vlan = sourceMatch.getField(MatchType.DL_VLAN);
if (vlan != null && vlan.getValue() != null) {
VlanIdBuilder vlanIDBuilder = new VlanIdBuilder();
MatchField vlan = sourceMatch.getField(MatchType.DL_VLAN);
if (vlan != null && vlan.getValue() != null) {
VlanIdBuilder vlanIDBuilder = new VlanIdBuilder();
+ short vid = (short)vlan.getValue();
+ boolean present = (vid != MatchType.DL_VLAN_NONE);
vlanIDBuilder.setVlanId(new VlanId((NetUtils
vlanIDBuilder.setVlanId(new VlanId((NetUtils
- .getUnsignedShort((short) vlan.getValue()))));
+ .getUnsignedShort(vid))));
+ vlanIDBuilder.setVlanIdPresent(present);
vlanMatchBuild.setVlanId(vlanIDBuilder.build());
}
vlanMatchBuild.setVlanId(vlanIDBuilder.build());
}
@@
-465,5
+475,12
@@
public class FromSalConversionsUtils {
return true;
}
return true;
}
+ /**
+ * @param nwDscp NW-DSCP
+ * @return shifted to NW-TOS (with empty ECN part)
+ */
+ public static int dscpToTos(int nwDscp) {
+ return (short) (nwDscp << ENC_FIELD_BIT_SIZE);
+ }
}
}