Search in sources :

Example 1 with RequestMapping

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

the class LispSouthboundHandlerTest method mapRequest__UsesIpv6EncapsulatedUdpPort.

@Ignore
@Test
public void mapRequest__UsesIpv6EncapsulatedUdpPort() throws Exception {
    // Internet Protocol Version 6, Src: 2610:d0:ffff:192::1
    // (2610:d0:ffff:192::1), Dst: 2610:d0:ffff:192::2
    // (2610:d0:ffff:192::2)
    // encapsulated UDP source port: 4342
    mapRequestPacket = extractWSUdpByteArray("0000   00 0c 29 34 3e 1b 00 0c 29 f6 d6 0d 08 00 45 00 " + "0010   00 b0 00 00 40 00 40 11 ea 7b 0a 00 3a 9c 0a 00 " + "0020   01 26 10 f6 10 f6 00 9c 9b 19 80 00 00 00 60 00 " + "0030   00 00 00 68 11 ff 26 10 00 d0 ff ff 01 92 00 00 " + "0040   00 00 00 00 00 01 26 10 00 d0 ff ff 01 92 00 00 " + "0050   00 00 00 00 00 02 10 f6 10 f6 00 68 94 8b 14 00 " + "0060   00 01 ff f5 bf 5d 7b 75 93 e6 00 02 26 10 00 d0 " + "0070   ff ff 01 92 00 00 00 00 00 00 00 01 00 01 0a 00 " + "0080   3a 9c 00 80 00 02 26 10 00 d0 ff ff 01 92 00 00 " + "0090   00 00 00 00 00 02 00 00 00 0a 01 80 10 00 00 00 " + "00a0   00 02 26 10 00 d0 ff ff 01 92 00 00 00 00 00 00 " + "00b0   00 01 01 64 ff 00 00 05 00 01 0a 00 3a 9c");
    ArgumentCaptor<RequestMapping> captor = ArgumentCaptor.forClass(RequestMapping.class);
    DatagramPacket replyPacket = handleMapRequestPacket(mapRequestPacket);
    Mockito.verify(mockLispSouthboundPlugin).sendNotificationIfPossible(Mockito.any());
    assertEquals(4342, replyPacket.recipient().getPort());
}
Also used : DatagramPacket(io.netty.channel.socket.DatagramPacket) RequestMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.RequestMapping) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with RequestMapping

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

the class LispMappingServiceTest method onRequestMappingTest.

/**
 * Tests {@link LispMappingService#onRequestMapping} method.
 */
@Test
public void onRequestMappingTest() {
    final RequestMapping requestMapping = Mockito.mock(RequestMapping.class);
    final org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest mapRequest = Mockito.mock(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest.class);
    final MapReply mapReply = new MapReplyBuilder().build();
    Mockito.when(requestMapping.getMapRequest()).thenReturn(mapRequest);
    Mockito.when(requestMapping.getTransportAddress()).thenReturn(TRANSPORT_ADDRESS_1);
    Mockito.when(mapRequest.getEidItem()).thenReturn(Lists.newArrayList(EID_ITEM_BUILDER.build()));
    Mockito.when(tlsMapReplyMock.get()).thenReturn(mapReply);
    // result
    final SendMapReplyInputBuilder smrib = new SendMapReplyInputBuilder().setMapReply(new MapReplyBuilder(mapReply).build()).setTransportAddress(TRANSPORT_ADDRESS_1);
    lispMappingService.onRequestMapping(requestMapping);
    Mockito.verify(odlLispSbService).sendMapReply(smrib.build());
}
Also used : SendMapReplyInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapReplyInputBuilder) 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) MapReplyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapreplymessage.MapReplyBuilder) RequestMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.RequestMapping) XtrRequestMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrRequestMapping) Test(org.junit.Test)

Example 3 with RequestMapping

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

the class LispMappingServiceTest method onRequestMappingTest_withNullMapReply.

/**
 * Tests {@link LispMappingService#onRequestMapping} method with mapReply == null.
 */
@Test
public void onRequestMappingTest_withNullMapReply() {
    final RequestMapping requestMapping = Mockito.mock(RequestMapping.class);
    final org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest mapRequest = Mockito.mock(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest.class);
    Mockito.when(requestMapping.getMapRequest()).thenReturn(mapRequest);
    Mockito.when(mapRequest.getEidItem()).thenReturn(Lists.newArrayList(EID_ITEM_BUILDER.build()));
    Mockito.when(tlsMapReplyMock.get()).thenReturn(null);
    lispMappingService.onRequestMapping(requestMapping);
    Mockito.verifyZeroInteractions(odlLispSbService);
}
Also used : RequestMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.RequestMapping) XtrRequestMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrRequestMapping) Test(org.junit.Test)

Example 4 with RequestMapping

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

the class LispMappingService method onRequestMapping.

@Override
public void onRequestMapping(RequestMapping mapRequestNotification) {
    MapReply mapReply = handleMapRequest(mapRequestNotification.getMapRequest());
    if (mapReply != null) {
        SendMapReplyInputBuilder smrib = new SendMapReplyInputBuilder();
        smrib.setMapReply((new MapReplyBuilder(mapReply).build()));
        smrib.setTransportAddress(mapRequestNotification.getTransportAddress());
        getLispSB().sendMapReply(smrib.build());
    } else {
        LOG.debug("handleMapRequest: Got null MapReply");
    }
}
Also used : SendMapReplyInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapReplyInputBuilder) 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) MapReplyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapreplymessage.MapReplyBuilder)

Example 5 with RequestMapping

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

the class LispSouthboundHandlerTest method mapRequest__VerifyBasicFields.

@Test
public void mapRequest__VerifyBasicFields() throws Exception {
    ArgumentCaptor<RequestMapping> captor = ArgumentCaptor.forClass(RequestMapping.class);
    handleMapRequestAsByteArray(mapRequestPacket);
    Mockito.verify(mockLispSouthboundPlugin).sendNotificationIfPossible(captor.capture());
    List<EidItem> eids = captor.getValue().getMapRequest().getEidItem();
    assertEquals(1, eids.size());
    Eid lispAddress = eids.get(0).getEid();
    assertEquals(Ipv4PrefixBinaryAfi.class, lispAddress.getAddressType());
    assertEquals(LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32"), lispAddress);
    assertEquals(0x3d8d2acd39c8d608L, captor.getValue().getMapRequest().getNonce().longValue());
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) EidItem(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItem) RequestMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.RequestMapping) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 RequestMapping (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.RequestMapping)4 GotMapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)2 MapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply)2 XtrRequestMapping (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrRequestMapping)2 MapReplyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapreplymessage.MapReplyBuilder)2 SendMapReplyInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapReplyInputBuilder)2 DatagramPacket (io.netty.channel.socket.DatagramPacket)1 Ignore (org.junit.Ignore)1 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)1 EidItem (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItem)1