private static final Logger LOG = LoggerFactory.getLogger(ToSalConversionsUtils.class);
private ToSalConversionsUtils() {
-
+ throw new IllegalAccessError("forcing no instance for factory");
}
public static Flow toFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow source, Node node) {
} else if (sourceAction instanceof SetNwTosActionCase) {
Integer tos = ((SetNwTosActionCase) sourceAction).getSetNwTosAction().getTos();
if (tos != null) {
- targetAction.add(new SetNwTos(tos));
+ targetAction.add(new SetNwTos(ToSalConversionsUtils.tosToNwDscp(tos)));
}
} else if (sourceAction instanceof SetTpDstActionCase) {
PortNumber port = ((SetTpDstActionCase) sourceAction).getSetTpDstAction().getPort();
}
private static PushVlan pushVlanFrom(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanAction pushVlanAction) {
- final int tag;
- final int pcp;
- final int cfi;
- final int vlanId;
-
- if (pushVlanAction.getTag() != null) {
- tag = pushVlanAction.getTag();
- if (pushVlanAction.getPcp() != null) {
- pcp = pushVlanAction.getPcp();
- if (pushVlanAction.getCfi() != null && pushVlanAction.getCfi().getValue() != null) {
- cfi = pushVlanAction.getCfi().getValue();
- if (pushVlanAction.getVlanId() != null && pushVlanAction.getVlanId().getValue() != null) {
- vlanId = pushVlanAction.getVlanId().getValue();
- return new PushVlan(tag, pcp, cfi, vlanId);
- }
- }
- }
+ Integer tag = pushVlanAction.getTag();
+ if (tag != null) {
+ return new PushVlan(tag.intValue());
}
return null;
}
return mac;
}
+
+ /**
+ * @param nwTos NW-TOS
+ * @return shifted to NW-DSCP
+ */
+ public static int tosToNwDscp(int nwTos) {
+ return (short) (nwTos >>> FromSalConversionsUtils.ENC_FIELD_BIT_SIZE);
+ }
}