import org.opendaylight.protocol.concepts.Ipv4Util;
import org.opendaylight.protocol.concepts.Ipv6Util;
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.PCEPErrors;
-import org.opendaylight.protocol.pcep.impl.message.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.EndpointsObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.object.AddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.object.address.family.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.object.address.family.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.object.address.family.Ipv6;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.object.address.family.Ipv6Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.pcinitiate.message.requests.EndpointsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.address.family.Ipv4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.address.family.Ipv4Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.address.family.Ipv6;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.address.family.Ipv6Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.object.EndpointsObj;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.object.EndpointsObjBuilder;
/**
- * Parser for IPv4 {@link EndpointsObject}
+ * Parser for IPv4 {@link EndpointsObj}
*/
-public class PCEPEndPointsObjectParser extends AbstractObjectWithTlvsParser<EndpointsBuilder> {
+public class PCEPEndPointsObjectParser extends AbstractObjectWithTlvsParser<EndpointsObjBuilder> {
public static final int CLASS = 4;
-
public static final int TYPE = 1;
+ public static final int CLASS_6 = 4;
+ public static final int TYPE_6 = 2;
+
/*
* fields lengths and offsets for IPv4 in bytes
*/
- public static final int SRC4_F_LENGTH = 4;
- public static final int DEST4_F_LENGTH = 4;
+ private static final int SRC4_F_LENGTH = 4;
+ private static final int DEST4_F_LENGTH = 4;
- public static final int SRC4_F_OFFSET = 0;
- public static final int DEST4_F_OFFSET = SRC4_F_OFFSET + SRC4_F_LENGTH;
-
- public static final int CLASS_6 = 4;
-
- public static final int TYPE_6 = 2;
+ private static final int SRC4_F_OFFSET = 0;
+ private static final int DEST4_F_OFFSET = SRC4_F_OFFSET + SRC4_F_LENGTH;
- public static final int SRC6_F_LENGTH = 16;
- public static final int DEST6_F_LENGTH = 16;
+ private static final int SRC6_F_LENGTH = 16;
+ private static final int DEST6_F_LENGTH = 16;
- public static final int SRC6_F_OFFSET = 0;
- public static final int DEST6_F_OFFSET = SRC6_F_OFFSET + SRC6_F_LENGTH;
+ private static final int SRC6_F_OFFSET = 0;
+ private static final int DEST6_F_OFFSET = SRC6_F_OFFSET + SRC6_F_LENGTH;
public PCEPEndPointsObjectParser(final TlvHandlerRegistry tlvReg) {
super(tlvReg);
}
@Override
- public EndpointsObject parseObject(final ObjectHeader header, final byte[] bytes) throws PCEPDeserializerException,
- PCEPDocumentedException {
+ public EndpointsObj parseObject(final ObjectHeader header, final byte[] bytes) throws PCEPDeserializerException {
if (bytes == null) {
throw new IllegalArgumentException("Array of bytes is mandatory");
}
if (!header.isProcessingRule()) {
- throw new PCEPDocumentedException("Processed flag not set", PCEPErrors.P_FLAG_NOT_SET);
+ //LOG.debug("Processed bit not set on ENDPOINTS OBJECT, ignoring it");
+ return null;
}
- final EndpointsBuilder builder = new EndpointsBuilder();
+ final EndpointsObjBuilder builder = new EndpointsObjBuilder();
builder.setIgnore(header.isIgnore());
builder.setProcessingRule(header.isProcessingRule());
}
@Override
- public void addTlv(final EndpointsBuilder builder, final Tlv tlv) {
+ public void addTlv(final EndpointsObjBuilder builder, final Tlv tlv) {
// No tlvs defined
}
@Override
public byte[] serializeObject(final Object object) {
- if (!(object instanceof EndpointsObject)) {
+ if (!(object instanceof EndpointsObj)) {
throw new IllegalArgumentException("Wrong instance of PCEPObject. Passed " + object.getClass() + ". Needed EndpointsObject.");
}
- final EndpointsObject ePObj = (EndpointsObject) object;
+ final EndpointsObj ePObj = (EndpointsObj) object;
final AddressFamily afi = ePObj.getAddressFamily();