X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=integrationtest%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Flispflowmapping%2Fintegrationtest%2FMappingServiceIntegrationTest.java;h=72ea2154ec7aee22f60fd5383e31b1e903418b37;hb=3495256c2cab615fd3119ee88538e248ed6f2a63;hp=a03edb0c9c78f5bea643de21839c01e4124f021d;hpb=6a4673dcd990ffefed9c1c9747bed12a4735857a;p=lispflowmapping.git diff --git a/integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java b/integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java index a03edb0c9..72ea2154e 100644 --- a/integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java +++ b/integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java @@ -73,6 +73,7 @@ import org.opendaylight.lispflowmapping.lisp.util.LispAddressUtil; import org.opendaylight.lispflowmapping.lisp.util.MappingRecordUtil; import org.opendaylight.lispflowmapping.lisp.util.MaskUtil; import org.opendaylight.lispflowmapping.type.sbplugin.IConfigLispSouthboundPlugin; +import org.opendaylight.mdsal.binding.api.NotificationService.Listener; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; @@ -106,18 +107,11 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types. import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv4AddressBinary; import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.Ipv4PrefixBinaryAfi; import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4PrefixBinaryBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.AddMapping; -import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapNotify; -import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply; import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify; import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister; import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply; import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest; -import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MappingKeepAlive; import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MessageType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.OdlLispProtoListener; -import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.RequestMapping; -import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrReplyMapping; import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrRequestMapping; import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid; import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder; @@ -167,7 +161,6 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase { private byte[] mapRegisterPacketWithoutNotify; String lispBindAddress = "127.0.0.1"; static final String ourAddress = "127.0.0.2"; - private Rloc locatorEid; private DatagramSocket socket; private byte[] mapRegisterPacketWithAuthenticationAndMapNotify; @@ -2900,36 +2893,22 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase { } - private class XtrRequestMappingListener implements OdlLispProtoListener { + private class XtrRequestMappingListener implements Listener { + private final String eid; + private final MapRequest mapRequest; - @Override - public void onGotMapReply(GotMapReply notification) { - } - - @Override - public void onAddMapping(AddMapping notification) { - } - - @Override - public void onXtrReplyMapping(XtrReplyMapping notification) { - } - - @Override - public void onRequestMapping(RequestMapping notification) { + private XtrRequestMappingListener(String eid, MapRequest mapRequest) { + this.eid = eid; + this.mapRequest = mapRequest; } @Override - public void onGotMapNotify(GotMapNotify notification) { + public void onNotification(XtrRequestMapping notification) { + assertEquals(((Ipv4Prefix) mapRequest.getEidItem().get(0).getEid().getAddress()) + .getIpv4Prefix().getValue(), eid); + notificationCalled = true; + LOG.warn("notification arrived"); } - - @Override - public void onXtrRequestMapping(XtrRequestMapping notification) { - } - - @Override - public void onMappingKeepAlive(MappingKeepAlive notification) { - } - } public void testRecievingNonProxyOnXtrPort() throws SocketTimeoutException, SocketException, Throwable { @@ -2950,17 +2929,10 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase { Rloc adLcaf = rb.build(); final MapRequest mapRequest = createNonProxyMapRequest(eid, adLcaf); - ((LispMappingService) lms).getNotificationService().registerNotificationListener( - new XtrRequestMappingListener() { - - @Override - public void onXtrRequestMapping(XtrRequestMapping notification) { - assertEquals(((Ipv4Prefix) mapRequest.getEidItem().get(0).getEid().getAddress()) - .getIpv4Prefix().getValue(), eid); - notificationCalled = true; - LOG.warn("notification arrived"); - } - }); + final var handler = new XtrRequestMappingListener(eid, mapRequest); + + ((LispMappingService) lms).getNotificationService().registerListener(XtrRequestMapping.class, handler); + sendMapRequest(mapRequest, port); for (int i = 0; i < MAX_NOTIFICATION_RETRYS; i++) { if (notificationCalled) {