import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;
-import org.opendaylight.yang.gen.v1.urn.packetcable.rev151101.ServiceFlowDirection;
-import org.opendaylight.yang.gen.v1.urn.packetcable.rev151101.TosByte;
-import org.opendaylight.yang.gen.v1.urn.packetcable.rev151101.ccap.attributes.AmId;
-import org.opendaylight.yang.gen.v1.urn.packetcable.rev151101.classifier.attributes.classifiers.ClassifierContainer;
-import org.opendaylight.yang.gen.v1.urn.packetcable.rev151101.classifier.attributes.classifiers.classifier.container.ClassifierChoice;
-import org.opendaylight.yang.gen.v1.urn.packetcable.rev151101.classifier.attributes.classifiers.classifier.container.classifier.choice.ExtClassifierChoice;
-import org.opendaylight.yang.gen.v1.urn.packetcable.rev151101.classifier.attributes.classifiers.classifier.container.classifier.choice.Ipv6ClassifierChoice;
-import org.opendaylight.yang.gen.v1.urn.packetcable.rev151101.classifier.attributes.classifiers.classifier.container.classifier.choice.QosClassifierChoice;
-import org.opendaylight.yang.gen.v1.urn.packetcable.rev151101.pcmm.qos.classifier.Classifier;
-import org.opendaylight.yang.gen.v1.urn.packetcable.rev151101.pcmm.qos.ext.classifier.ExtClassifier;
-import org.opendaylight.yang.gen.v1.urn.packetcable.rev151101.pcmm.qos.gate.spec.GateSpec;
-import org.opendaylight.yang.gen.v1.urn.packetcable.rev151101.pcmm.qos.ipv6.classifier.Ipv6Classifier;
-import org.opendaylight.yang.gen.v1.urn.packetcable.rev151101.pcmm.qos.traffic.profile.TrafficProfile;
+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.pcmm.gates.IClassifier;
import org.pcmm.gates.IClassifier.Protocol;
import org.pcmm.gates.IExtendedClassifier;
public PCMMGateReq build() {
return new PCMMGateReq(amid, subscriberID, transactionID, gateSpec, trafficProfile, classifiers,
- gateID, error, gateState, gateTimeInfo, gateUsageInfo);
+ gateID, error, gateState, gateTimeInfo, gateUsageInfo);
}
public void setAmId(final AmId qosAmId) {
byte tosMask = (byte)0x0;
short srcPort = (short) 0;
short dstPort = (short) 0;
- byte priority = (byte) 64;
- //byte priority = index.byteValue();
-
+ //byte priority = (byte) 64;
+ byte priority = (byte) (64+index);
+
// Legacy classifier
-
+
// Protocol -- zero is match any
if (qosClassifier.getProtocol() != null) {
protocol = Protocol.valueOf(qosClassifier.getProtocol().getValue().shortValue());
} else {
protocol = Protocol.NONE;
}
-
- // IP Addresss and mask wildcards - addr byte 0 for no match (or match anything)
-
+
+ // IP Addresss and mask wildcards - addr byte 0 for no match (or match anything)
+
Inet4Address srcAddress = (Inet4Address) getByName("0.0.0.0");
-
+
if (qosClassifier.getSrcIp() != null) {
- srcAddress = (Inet4Address) getByName(qosClassifier.getSrcIp().getValue());
+ srcAddress = (Inet4Address) getByName(qosClassifier.getSrcIp().getValue());
}
-
+
Inet4Address dstAddress = (Inet4Address) getByName("0.0.0.0");
-
+
if (qosClassifier.getDstIp() != null) {
dstAddress = (Inet4Address) getByName(qosClassifier.getDstIp().getValue());
}
-
-
+
+
if (qosClassifier.getSrcPort() != null) {
srcPort = qosClassifier.getSrcPort().getValue().shortValue();
}
}
// push the classifier to the gate request
classifiers.add(new org.pcmm.gates.impl.Classifier(protocol, tosOverwrite, tosMask, srcAddress, dstAddress, srcPort,
- dstPort, priority));
+ dstPort, priority));
}
-
+
private void addExtClassifier(final Short index, final ExtClassifier qosExtClassifier) {
// Extended classifier
- final byte priority = (byte) 64;
+ final byte priority = (byte) (index+64);
final ActivationState activationState = ActivationState.ACTIVE;
// Protocol -- zero is match any
final Protocol protocol;
Inet4Address srcIpAddr = (Inet4Address) getByName("0.0.0.0");
if (qosExtClassifier.getSrcIp() != null) {
- srcIpAddr = getInet4Address(qosExtClassifier.getSrcIp());
+ srcIpAddr = getInet4Address(qosExtClassifier.getSrcIp());
}
-
+
Inet4Address dstIpAddr = (Inet4Address) getByName("0.0.0.0");
if (qosExtClassifier.getDstIp() != null) {
- dstIpAddr = getInet4Address(qosExtClassifier.getDstIp());
+ dstIpAddr = getInet4Address(qosExtClassifier.getDstIp());
}
-
+
//mask
Inet4Address srcIpMask = (Inet4Address) getByName("255.255.255.255");
if (qosExtClassifier.getSrcIpMask() != null) {
- srcIpMask = getInet4Address(qosExtClassifier.getSrcIpMask());
+ srcIpMask = getInet4Address(qosExtClassifier.getSrcIpMask());
}
-
+
Inet4Address dstIpMask = (Inet4Address) getByName("255.255.255.255");
if (qosExtClassifier.getDstIpMask() != null) {
- dstIpMask = getInet4Address(qosExtClassifier.getDstIpMask());
+ dstIpMask = getInet4Address(qosExtClassifier.getDstIpMask());
}
-
+
// TODO - find out what the classifier ID should really be. It was never getting set previously
final short classifierId = (short)index;
}
private Inet4Address getInet4Address(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address address) {
+ final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address address) {
if (address != null) {
final InetAddress out = getByName(address.getValue());
if (out != null && out instanceof Inet4Address) {
// TODO - try to make these two variables immutable
byte srcPrefixLen = (byte) 128;
Inet6Address srcAddress = (Inet6Address) getByName("0::0");
-
+
if (qosIpv6Classifier.getSrcIp6() != null) {
String[] parts = qosIpv6Classifier.getSrcIp6().getValue().split("/");
String Ipv6AddressStr = parts[0];
tcMask = qosIpv6Classifier.getTcHigh().getValue().byteValue();
else if (qosIpv6Classifier.getTcLow() != null) tcMask = (byte) 0xff;
else tcMask = (byte) 0x00;
-
+
FlowLabel flowLabelFlag = FlowLabel.IRRELEVANT;
int flowLabelId = 0;
-
+
if (qosIpv6Classifier.getFlowLabel() != null) {
- flowLabelFlag = FlowLabel.VALID;
- flowLabelId = qosIpv6Classifier.getFlowLabel().intValue();
+ flowLabelFlag = FlowLabel.VALID;
+ flowLabelId = qosIpv6Classifier.getFlowLabel().intValue();
}
-
+
// TODO - find out what the classifier ID should really be. It was never getting set previously
final short classifierId = (short)index;
// push the IPv6 classifier to the gate request
classifiers.add(
- new org.pcmm.gates.impl.IPv6Classifier(srcAddress, dstAddress, srcPortBegin, dstPortBegin, (byte) 64,
+ new org.pcmm.gates.impl.IPv6Classifier(srcAddress, dstAddress, srcPortBegin, dstPortBegin, (byte) (index+64),
srcPortEnd, dstPortEnd, classifierId, ActivationState.ACTIVE, action, flowLabelFlag, tcLow,
tcHigh, tcMask, flowLabelId, nextHdr, srcPrefixLen, dstPrefLen));
}