use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder in project lispflowmapping by opendaylight.
the class LispMappingServiceTest method handleSmrTest.
/**
* Tests {@link LispMappingService#handleSMR} method.
*/
@Test
public void handleSmrTest() {
final MapRequest mapRequest = Mockito.mock(MapRequest.class);
final Rloc subscriber = LispAddressUtil.asIpv4Rloc(IPV4_STRING_1);
Mockito.when(mapRequest.getSourceEid()).thenReturn(new SourceEidBuilder().setEid(IPV4_SOURCE_EID).build());
Mockito.when(mapRequest.getEidItem()).thenReturn(Lists.newArrayList(EID_ITEM_BUILDER.build()));
// result
final SendMapRequestInputBuilder smrib = new SendMapRequestInputBuilder().setMapRequest(new MapRequestBuilder(mapRequest).build()).setTransportAddress(TRANSPORT_ADDRESS);
lispMappingService.handleSMR(mapRequest, subscriber);
Mockito.verify(odlLispSbService).sendMapRequest(smrib.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder in project lispflowmapping by opendaylight.
the class MapResolverTest method getDefaultMapRequestBuilder.
private static MapRequestBuilder getDefaultMapRequestBuilder() {
MapRequestBuilder mrBuilder = new MapRequestBuilder().setAuthoritative(false).setEidItem(new ArrayList<>()).setItrRloc(new ArrayList<>()).setMapDataPresent(true).setNonce((long) 0).setPitr(false).setProbe(false).setSmr(false).setSmrInvoked(false).setSourceEid(new SourceEidBuilder().setEid(LispAddressUtil.asIpv4Eid(IPV4_SOURCE)).build()).setItrRloc(getDefaultItrRlocList());
mrBuilder.getEidItem().add(new EidItemBuilder().setEid(IPV4_PREFIX_EID_1).build());
return mrBuilder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder in project lispflowmapping by opendaylight.
the class LispMappingService method handleSMR.
@Override
public void handleSMR(MapRequest smrMapRequest, Rloc subscriber) {
if (LOG.isDebugEnabled()) {
LOG.debug("Sending SMR Map-Request to {} with Source-EID {} and EID Record {} (reversed)", LispAddressStringifier.getString(subscriber), LispAddressStringifier.getString(smrMapRequest.getSourceEid().getEid()), LispAddressStringifier.getString(smrMapRequest.getEidItem().get(0).getEid()));
}
SendMapRequestInputBuilder smrib = new SendMapRequestInputBuilder();
smrib.setMapRequest(new MapRequestBuilder(smrMapRequest).build());
smrib.setTransportAddress(LispNotificationHelper.getTransportAddressFromRloc(subscriber));
getLispSB().sendMapRequest(smrib.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder in project lispflowmapping by opendaylight.
the class LispSouthboundRpcTest method sendMapRequestTest_inputNotNull.
/**
* Tests {@link LispSouthboundRPC#sendMapRequest} method.
*/
@Test
public void sendMapRequestTest_inputNotNull() throws ExecutionException, InterruptedException {
final MapRequest mapRequest = new MapRequestBuilder().build();
final TransportAddress transportAddress = new TransportAddressBuilder().build();
final SendMapRequestInput sendMapRequestInputMock = Mockito.mock(SendMapRequestInput.class);
Mockito.when(sendMapRequestInputMock.getTransportAddress()).thenReturn(transportAddress);
Mockito.when(sendMapRequestInputMock.getMapRequest()).thenReturn(mapRequest);
assertEquals(RPC_RESULT_SUCCESS.isSuccessful(), lispSouthboundRPC.sendMapRequest(sendMapRequestInputMock).get().isSuccessful());
Mockito.verify(lispSouthboundPlugin).handleSerializedLispBuffer(transportAddress, MapRequestSerializer.getInstance().serialize(mapRequest), MessageType.MapRequest);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder in project lispflowmapping by opendaylight.
the class LispXtrSouthboundHandlerTest method getDefaultMapRequestBuilder.
private static MapRequestBuilder getDefaultMapRequestBuilder() {
final ItrRloc itrRloc = new ItrRlocBuilder().setRloc(new RlocBuilder().setAddressType(Ipv4BinaryAfi.class).setAddress(new Ipv4BinaryBuilder().setIpv4Binary(new Ipv4AddressBinary(new byte[] { 127, 0, 0, 2 })).build()).build()).build();
final EidItem eidItem = new EidItemBuilder().setEid(LispAddressUtil.asIpv4PrefixBinaryEid(IPV4_STRING_2 + IPV4_STRING_PREFIX)).build();
return new MapRequestBuilder().setItrRloc(Lists.newArrayList(itrRloc)).setEidItem(Lists.newArrayList(eidItem)).setNonce(NONCE).setSourceEid(new SourceEidBuilder().setEid(LispAddressUtil.asIpv4Eid(IPV4_STRING_1)).build()).setAuthoritative(false).setMapDataPresent(false).setPitr(false).setProbe(false).setSmr(false).setSmrInvoked(false);
}
Aggregations