BUG-393 : Fixed parsing for LSP object. 29/5129/2
authorDana Kutenicsova <dkutenic@cisco.com>
Wed, 5 Feb 2014 11:50:49 +0000 (12:50 +0100)
committerDana Kutenicsova <dkutenic@cisco.com>
Wed, 5 Feb 2014 12:18:37 +0000 (13:18 +0100)
Removed wrong handling of PCEP messages.

Change-Id: If7b57dd2bf7ce56bee4c4f041cf64ddf667c72fa
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
pcep/ietf-stateful02/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful02/PCEPLspObjectParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/initiated00/PCEPLspObjectParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful07/PCEPLspObjectParser.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/AbstractTopologySessionListener.java

index 1ae910086188aebd65bff19f083a3d15b055fb56..b1a2477e91bd23fcd04dddfb32976c1b1704d8a0 100644 (file)
@@ -100,16 +100,16 @@ public class PCEPLspObjectParser extends AbstractObjectWithTlvsParser<TlvsBuilde
                retBytes[0] = (byte) (lspID >> 12);
                retBytes[1] = (byte) (lspID >> 4);
                retBytes[2] = (byte) (lspID << 4);
-               if (specObj.isDelegate()) {
+               if (specObj.isDelegate() != null && specObj.isDelegate()) {
                        retBytes[3] |= 1 << (Byte.SIZE - (DELEGATE_FLAG_OFFSET - Byte.SIZE) - 1);
                }
-               if (specObj.isRemove()) {
+               if (specObj.isRemove() != null && specObj.isRemove()) {
                        retBytes[3] |= 1 << (Byte.SIZE - (REMOVE_FLAG_OFFSET - Byte.SIZE) - 1);
                }
-               if (specObj.isSync()) {
+               if (specObj.isSync() != null && specObj.isSync()) {
                        retBytes[3] |= 1 << (Byte.SIZE - (SYNC_FLAG_OFFSET - Byte.SIZE) - 1);
                }
-               if (specObj.isOperational()) {
+               if (specObj.isOperational() != null && specObj.isOperational()) {
                        retBytes[3] |= 1 << (Byte.SIZE - (OPERATIONAL_FLAG_OFFSET - Byte.SIZE) - 1);
                }
                ByteArray.copyWhole(tlvs, retBytes, TLVS_OFFSET);
index cbf5538ef230c22882824ec94c42aeed4209193e..40cec190bff4a4974a39b7d34513ebf3c7463f83 100644 (file)
@@ -114,23 +114,25 @@ public class PCEPLspObjectParser extends AbstractObjectWithTlvsParser<TlvsBuilde
                retBytes[0] = (byte) (lspID >> 12);
                retBytes[1] = (byte) (lspID >> 4);
                retBytes[2] = (byte) (lspID << 4);
-               if (specObj.isDelegate()) {
+               if (specObj.isDelegate() != null && specObj.isDelegate()) {
                        retBytes[3] |= 1 << (Byte.SIZE - (DELEGATE_FLAG_OFFSET - Byte.SIZE) - 1);
                }
-               if (specObj.isRemove()) {
+               if (specObj.isRemove() != null && specObj.isRemove()) {
                        retBytes[3] |= 1 << (Byte.SIZE - (REMOVE_FLAG_OFFSET - Byte.SIZE) - 1);
                }
-               if (specObj.isSync()) {
+               if (specObj.isSync() != null && specObj.isSync()) {
                        retBytes[3] |= 1 << (Byte.SIZE - (SYNC_FLAG_OFFSET - Byte.SIZE) - 1);
                }
-               if (specObj.isAdministrative()) {
+               if (specObj.isAdministrative() != null && specObj.isAdministrative()) {
                        retBytes[3] |= 1 << (Byte.SIZE - (ADMINISTRATIVE_FLAG_OFFSET - Byte.SIZE) - 1);
                }
-               if (specObj.getAugmentation(Lsp1.class).isCreate()) {
+               if (specObj.getAugmentation(Lsp1.class).isCreate() != null && specObj.getAugmentation(Lsp1.class).isCreate()) {
                        retBytes[3] |= 1 << (Byte.SIZE - (CREATE_FLAG_OFFSET - Byte.SIZE) - 1);
                }
-               final int op = specObj.getOperational().getIntValue();
-               retBytes[3] |= (op & 7) << 4;
+               if (specObj.getOperational() != null) {
+                       final int op = specObj.getOperational().getIntValue();
+                       retBytes[3] |= (op & 7) << 4;
+               }
                ByteArray.copyWhole(tlvs, retBytes, TLVS_OFFSET);
                return ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), retBytes);
        }
index ff3b0e5dd4078aa4ba28ba1869d8dd8df89f5e32..6e48ac9cdcb4aade760337ffba46d4e78610d31d 100644 (file)
@@ -113,20 +113,22 @@ public class PCEPLspObjectParser extends AbstractObjectWithTlvsParser<TlvsBuilde
                retBytes[0] = (byte) (lspID >> 12);
                retBytes[1] = (byte) (lspID >> 4);
                retBytes[2] = (byte) (lspID << 4);
-               if (specObj.isDelegate()) {
+               if (specObj.isDelegate() != null && specObj.isDelegate()) {
                        retBytes[3] |= 1 << (Byte.SIZE - (DELEGATE_FLAG_OFFSET - Byte.SIZE) - 1);
                }
-               if (specObj.isRemove()) {
+               if (specObj.isRemove() != null && specObj.isRemove()) {
                        retBytes[3] |= 1 << (Byte.SIZE - (REMOVE_FLAG_OFFSET - Byte.SIZE) - 1);
                }
-               if (specObj.isSync()) {
+               if (specObj.isSync() != null && specObj.isSync()) {
                        retBytes[3] |= 1 << (Byte.SIZE - (SYNC_FLAG_OFFSET - Byte.SIZE) - 1);
                }
-               if (specObj.isAdministrative()) {
+               if (specObj.isAdministrative() != null && specObj.isAdministrative()) {
                        retBytes[3] |= 1 << (Byte.SIZE - (ADMINISTRATIVE_FLAG_OFFSET - Byte.SIZE) - 1);
                }
-               final int op = specObj.getOperational().getIntValue();
-               retBytes[3] |= (op & 7) << 4;
+               if (specObj.getOperational() != null) {
+                       final int op = specObj.getOperational().getIntValue();
+                       retBytes[3] |= (op & 7) << 4;
+               }
                ByteArray.copyWhole(tlvs, retBytes, TLVS_OFFSET);
                return ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), retBytes);
        }
index 158f24644fd1f06157b4021ac30e514ac450cdbc..2f3cbea5b785f27806272aee1b05c6f07ce8a9f9 100644 (file)
@@ -23,12 +23,9 @@ import org.opendaylight.protocol.pcep.PCEPSessionListener;
 import org.opendaylight.protocol.pcep.PCEPTerminationReason;
 import org.opendaylight.protocol.pcep.TerminationReason;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcerr;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcerrBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.MessageHeader;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ProtocolVersion;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.PcerrMessageBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.Node1;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.Node1Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.OperationResult;
@@ -72,8 +69,6 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID> implements
                }
        };
        private static final Logger LOG = LoggerFactory.getLogger(AbstractTopologySessionListener.class);
-       private static final Pcerr UNHANDLED_MESSAGE_ERROR = new PcerrBuilder().setPcerrMessage(
-                       new PcerrMessageBuilder().setErrorType(null).build()).build();
 
        // FIXME: make this private
        protected final ServerSessionManager serverSessionManager;
@@ -235,7 +230,6 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID> implements
 
                if (onMessage(trans, message)) {
                        LOG.info("Unhandled message {} on session {}", message, session);
-                       session.sendMessage(UNHANDLED_MESSAGE_ERROR);
                        return;
                }