Bug 9127: Make IT more robust when receiving packets 44/62544/8
authorLorand Jakab <lojakab@cisco.com>
Fri, 1 Sep 2017 13:14:47 +0000 (16:14 +0300)
committerLorand Jakab <lojakab@cisco.com>
Fri, 29 Sep 2017 15:03:02 +0000 (18:03 +0300)
commit94989baeda43fa8e9da628fcefa1ad60c4948c87
tree6e9462c2eba5a7d2563f0dc93d380b923fc237b6
parent92a2b16147f7fefa0899a74018c5492cc77d69cb
Bug 9127: Make IT more robust when receiving packets

Methods of the type receiveMapNotify() pass the raw packet to a specific
deserializer without checking if the packet is actually of the correct
type. Deserializers expect checking to happen outside, and deserialize
anyway. In some cases, they even succeed without throwing an exception,
with erroneous results. This is obviously bad.

This patch fixes the serializers to throw an exception when the wrong
packet type is passed for deserialization. It also makes the
receiveXXX() methods in the IT to retry until they receive the expected
packet type.

In some cases, a Map-Register can cause an SMR to be sent. SMRs are sent
in a separate thread. This may lead to a race condition beween the
Map-Notify sent back to the xTR and the SMR sent to the subscriber. In
some cases, we expect a Map-Notify, but deserialize an SMR as a
Map-Notify, if it comes first. We had IT fail in the past with a message
of the type:

MappingServiceIntegrationTest.testLCAFs:357->registerAndQuery__SrcDestLCAF:1828->registerAddressAndQuery:1789 expected:<8> but was:<-859317697383733792>

This patch finally fixes that.

It needs to disable testRepeatedSmr() though, because the test is
broken, and it never actually worked as intended. It will be fixed in a
future commit.

Change-Id: Ife4396013df82cb6320978c3c02536df91fba646
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java
mappingservice/lisp-proto/src/main/java/org/opendaylight/lispflowmapping/lisp/serializer/MapNotifySerializer.java
mappingservice/lisp-proto/src/main/java/org/opendaylight/lispflowmapping/lisp/serializer/MapRegisterSerializer.java
mappingservice/lisp-proto/src/main/java/org/opendaylight/lispflowmapping/lisp/serializer/MapReplySerializer.java
mappingservice/lisp-proto/src/main/java/org/opendaylight/lispflowmapping/lisp/serializer/MapRequestSerializer.java