X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=packetcable-policy-server%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fpacketcable%2Fprovider%2FPCMMGateReqBuilder.java;h=5c92641991d3b006d4c02af9f01039d1a37d0248;hb=73b0003682c6e2d083f1773d14c41ea7a1eface6;hp=7e85e0bb5bd833ec8ff76769f6981ea4f909a983;hpb=4f593643cd927200682936c741a6affea2a27e6b;p=packetcable.git diff --git a/packetcable-policy-server/src/main/java/org/opendaylight/controller/packetcable/provider/PCMMGateReqBuilder.java b/packetcable-policy-server/src/main/java/org/opendaylight/controller/packetcable/provider/PCMMGateReqBuilder.java index 7e85e0b..5c92641 100644 --- a/packetcable-policy-server/src/main/java/org/opendaylight/controller/packetcable/provider/PCMMGateReqBuilder.java +++ b/packetcable-policy-server/src/main/java/org/opendaylight/controller/packetcable/provider/PCMMGateReqBuilder.java @@ -16,19 +16,19 @@ import java.net.Inet6Address; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.List; -import org.opendaylight.yang.gen.v1.urn.packetcable.rev161017.ServiceFlowDirection; -import org.opendaylight.yang.gen.v1.urn.packetcable.rev161017.TosByte; -import org.opendaylight.yang.gen.v1.urn.packetcable.rev161017.ccap.attributes.AmId; -import org.opendaylight.yang.gen.v1.urn.packetcable.rev161017.classifier.attributes.classifiers.ClassifierContainer; -import org.opendaylight.yang.gen.v1.urn.packetcable.rev161017.classifier.attributes.classifiers.classifier.container.ClassifierChoice; -import org.opendaylight.yang.gen.v1.urn.packetcable.rev161017.classifier.attributes.classifiers.classifier.container.classifier.choice.ExtClassifierChoice; -import org.opendaylight.yang.gen.v1.urn.packetcable.rev161017.classifier.attributes.classifiers.classifier.container.classifier.choice.Ipv6ClassifierChoice; -import org.opendaylight.yang.gen.v1.urn.packetcable.rev161017.classifier.attributes.classifiers.classifier.container.classifier.choice.QosClassifierChoice; -import org.opendaylight.yang.gen.v1.urn.packetcable.rev161017.pcmm.qos.classifier.Classifier; -import org.opendaylight.yang.gen.v1.urn.packetcable.rev161017.pcmm.qos.ext.classifier.ExtClassifier; -import org.opendaylight.yang.gen.v1.urn.packetcable.rev161017.pcmm.qos.gate.spec.GateSpec; -import org.opendaylight.yang.gen.v1.urn.packetcable.rev161017.pcmm.qos.ipv6.classifier.Ipv6Classifier; -import org.opendaylight.yang.gen.v1.urn.packetcable.rev161017.pcmm.qos.traffic.profile.TrafficProfile; +import org.opendaylight.yang.gen.v1.urn.packetcable.rev161107.ServiceFlowDirection; +import org.opendaylight.yang.gen.v1.urn.packetcable.rev161107.TosByte; +import org.opendaylight.yang.gen.v1.urn.packetcable.rev161107.ccap.attributes.AmId; +import org.opendaylight.yang.gen.v1.urn.packetcable.rev161107.classifier.attributes.classifiers.ClassifierContainer; +import org.opendaylight.yang.gen.v1.urn.packetcable.rev161107.classifier.attributes.classifiers.classifier.container.ClassifierChoice; +import org.opendaylight.yang.gen.v1.urn.packetcable.rev161107.classifier.attributes.classifiers.classifier.container.classifier.choice.ExtClassifierChoice; +import org.opendaylight.yang.gen.v1.urn.packetcable.rev161107.classifier.attributes.classifiers.classifier.container.classifier.choice.Ipv6ClassifierChoice; +import org.opendaylight.yang.gen.v1.urn.packetcable.rev161107.classifier.attributes.classifiers.classifier.container.classifier.choice.QosClassifierChoice; +import org.opendaylight.yang.gen.v1.urn.packetcable.rev161107.pcmm.qos.classifier.Classifier; +import org.opendaylight.yang.gen.v1.urn.packetcable.rev161107.pcmm.qos.ext.classifier.ExtClassifier; +import org.opendaylight.yang.gen.v1.urn.packetcable.rev161107.pcmm.qos.gate.spec.GateSpec; +import org.opendaylight.yang.gen.v1.urn.packetcable.rev161107.pcmm.qos.ipv6.classifier.Ipv6Classifier; +import org.opendaylight.yang.gen.v1.urn.packetcable.rev161107.pcmm.qos.traffic.profile.TrafficProfile; import org.pcmm.gates.IClassifier; import org.pcmm.gates.IClassifier.Protocol; import org.pcmm.gates.IExtendedClassifier; @@ -168,8 +168,6 @@ public class PCMMGateReqBuilder { byte tosMask = (byte)0x0; short srcPort = (short) 0; short dstPort = (short) 0; - //byte priority = (byte) 64; - byte priority = (byte) (64+index); // Legacy classifier @@ -210,6 +208,16 @@ public class PCMMGateReqBuilder { tosMask = (byte) 0xff; } } + // + // The packetcable.yang models priority as an uint8 which means the java generated + // implementation saves the value in a short, so we mask it back into a byte + // + byte priority = 64; + if (qosClassifier.getPriority() != null) { + short result = qosClassifier.getPriority(); + priority = (byte)(result % 255); + } + // push the classifier to the gate request classifiers.add(new org.pcmm.gates.impl.Classifier(protocol, tosOverwrite, tosMask, srcAddress, dstAddress, srcPort, dstPort, priority)); @@ -217,7 +225,6 @@ public class PCMMGateReqBuilder { private void addExtClassifier(final Short index, final ExtClassifier qosExtClassifier) { // Extended classifier - final byte priority = (byte) (index+64); final ActivationState activationState = ActivationState.ACTIVE; // Protocol -- zero is match any final Protocol protocol; @@ -306,6 +313,16 @@ public class PCMMGateReqBuilder { // TODO - find out what the action value should really be. It was never getting set previously final IExtendedClassifier.Action action = IExtendedClassifier.Action.ADD; + // + // The packetcable.yang models priority as an uint8 which means the java generated + // implementation saves the value in a short, so we mask it back into a byte + // + byte priority = 64; + if (qosExtClassifier.getPriority() != null) { + short result = qosExtClassifier.getPriority(); + priority = (byte)(result % 255); + } + // push the extended classifier to the gate request classifiers.add(new org.pcmm.gates.impl.ExtendedClassifier(protocol, tosOverwrite, tosMask, srcIpAddr, dstIpAddr, @@ -430,9 +447,19 @@ public class PCMMGateReqBuilder { // TODO - find out what the action value should really be. It was never getting set previously final IExtendedClassifier.Action action = IExtendedClassifier.Action.ADD; + // + // The packetcable.yang models priority as an uint8 which means the java generated + // implementation saves the value in a short, so we mask it back into a byte + // + byte priority = 64; + if (qosIpv6Classifier.getPriority() != null) { + short result = qosIpv6Classifier.getPriority(); + priority = (byte)(result % 255); + } + // push the IPv6 classifier to the gate request classifiers.add( - new org.pcmm.gates.impl.IPv6Classifier(srcAddress, dstAddress, srcPortBegin, dstPortBegin, (byte) (index+64), + new org.pcmm.gates.impl.IPv6Classifier(srcAddress, dstAddress, srcPortBegin, dstPortBegin, priority, srcPortEnd, dstPortEnd, classifierId, ActivationState.ACTIVE, action, flowLabelFlag, tcLow, tcHigh, tcMask, flowLabelId, nextHdr, srcPrefixLen, dstPrefLen)); }