Search in sources :

Example 11 with MapRequest

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method registerQueryRegisterWithSmr.

public void registerQueryRegisterWithSmr() throws SocketTimeoutException {
    cleanUP();
    lms.setShouldUseSmr(true);
    mapService.addAuthenticationKey(LispAddressUtil.asIpv4PrefixBinaryEid("153.16.254.1/32"), NULL_AUTH_KEY);
    sleepForSeconds(1);
    sendPacket(mapRegisterPacketWithNotify);
    receiveMapNotify();
    sleepForSeconds(1);
    sendPacket(mapRequestPacket);
    sleepForSeconds(1);
    mapRegisterPacketWithoutNotify[mapRegisterPacketWithoutNotify.length - 1] += 1;
    sendPacket(mapRegisterPacketWithoutNotify);
    MapRequest smr = receiveMapRequest();
    assertTrue(smr.isSmr());
    Eid sourceEid = smr.getSourceEid().getEid();
    assertTrue(LispAddressUtil.asIpv4Eid("153.16.254.1").equals(sourceEid));
    Eid smrEid = smr.getEidItem().get(0).getEid();
    assertTrue(LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32").equals(smrEid));
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) MapRequest(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)

Example 12 with MapRequest

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method testRecievingNonProxyOnXtrPort.

public void testRecievingNonProxyOnXtrPort() throws SocketTimeoutException, SocketException, Throwable {
    cleanUP();
    configLispPlugin.shouldListenOnXtrPort(true);
    notificationCalled = false;
    final String eid = "10.10.10.10/32";
    String rloc = "127.0.0.3";
    int port = LispMessage.XTR_PORT_NUM;
    RlocBuilder rb = new RlocBuilder();
    rb.setAddressType(ApplicationDataLcaf.class);
    rb.setVirtualNetworkId(null);
    rb.setAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ApplicationDataBuilder().setApplicationData(new ApplicationDataBuilder().setAddress(new SimpleAddress(new IpAddress(new Ipv4Address(rloc)))).setLocalPortLow(new PortNumber(port)).build()).build());
    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");
        }
    });
    sendMapRequest(mapRequest, port);
    for (int i = 0; i < MAX_NOTIFICATION_RETRYS; i++) {
        if (notificationCalled) {
            return;
        } else {
            LOG.warn("notification hasn't arrived, sleeping...");
            Thread.sleep(500);
        }
    }
    fail("Notification hasn't arrived");
}
Also used : MapRequest(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest) ApplicationDataBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.application.data.ApplicationDataBuilder) Rloc(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc) ItrRloc(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc) RlocBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder) ItrRlocBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder) XtrRequestMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrRequestMapping) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 13 with MapRequest

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method sendMapRegisterTwiceWithDiffrentValues.

private MapReply sendMapRegisterTwiceWithDiffrentValues(Eid eid, Rloc rloc1, Rloc rloc2) throws SocketTimeoutException {
    mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
    sleepForSeconds(1);
    MapRegister mb = createMapRegister(eid, rloc1);
    MapNotify mapNotify = lms.handleMapRegister(mb).getLeft();
    MapRequest mr = createMapRequest(eid);
    MapReply mapReply = lms.handleMapRequest(mr);
    assertEquals(mb.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc(), mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc());
    mb = createMapRegister(eid, rloc2);
    mapNotify = lms.handleMapRegister(mb).getLeft();
    assertEquals(8, mapNotify.getNonce().longValue());
    mr = createMapRequest(eid);
    sendMapRequest(mr);
    mapReply = lms.handleMapRequest(mr);
    return mapReply;
}
Also used : MapRequest(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest) MapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply) GotMapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply) GotMapNotify(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapNotify) MapNotify(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify) MapRegister(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister)

Example 14 with MapRequest

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method testTTLAfterClean.

private void testTTLAfterClean(MapRequest mapRequest) throws SocketTimeoutException {
    MapReply mapReply;
    sendMapRequest(mapRequest);
    mapReply = receiveMapReply();
    assertCorrectMapReplyTTLAndAction(mapReply, 15, Action.NativelyForward);
}
Also used : MapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply) GotMapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)

Example 15 with MapRequest

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method processSmrPackets.

private List<MapRequest> processSmrPackets(SocketReader reader, String address, int expectedSmrs) {
    InetAddress inetAddress = null;
    try {
        inetAddress = InetAddress.getByName(address);
    } catch (UnknownHostException e) {
        LOG.error("Unknown address {}.", address, e);
    }
    final List<MapRequest> requests = Lists.newArrayList();
    byte[][] buffers = reader.getBuffers(expectedSmrs);
    for (byte[] buf : buffers) {
        ByteBuffer packet = ByteBuffer.wrap(buf);
        if (MappingServiceIntegrationTestUtil.checkType(packet, MessageType.MapRequest)) {
            MapRequest request = MapRequestSerializer.getInstance().deserialize(packet, inetAddress);
            requests.add(request);
        }
    }
    return requests;
}
Also used : MapRequest(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest) UnknownHostException(java.net.UnknownHostException) InetAddress(java.net.InetAddress) ByteBuffer(java.nio.ByteBuffer)

Aggregations

MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)33 Test (org.junit.Test)24 GotMapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)11 MapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply)11 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)10 MapRequestBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder)10 ItrRlocBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder)9 InetAddress (java.net.InetAddress)8 EidItem (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItem)6 ItrRloc (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc)6 MapRequestBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder)6 RlocBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder)6 GotMapNotify (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapNotify)5 MapNotify (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify)5 MapRegister (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister)5 EidItemBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItemBuilder)5 SourceEidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder)5 MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest)5 Ipv4Binary (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4Binary)4 XtrRequestMapping (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrRequestMapping)4