Search in sources :

Example 1 with SendMapReplyInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapReplyInputBuilder 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 2 with SendMapReplyInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapReplyInputBuilder 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)

Aggregations

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 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 Test (org.junit.Test)1 RequestMapping (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.RequestMapping)1 XtrRequestMapping (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrRequestMapping)1