use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress in project lispflowmapping by opendaylight.
the class LispSouthboundRpcTest method sendMapReplyTest_inputNotNull.
/**
* Tests {@link LispSouthboundRPC#sendMapReply} method.
*/
@Test
public void sendMapReplyTest_inputNotNull() throws ExecutionException, InterruptedException {
final MapReply mapReply = getDefaultMapReplyBuilder().build();
final TransportAddress transportAddress = new TransportAddressBuilder().build();
final SendMapReplyInput sendMapReplyInputMock = Mockito.mock(SendMapReplyInput.class);
Mockito.when(sendMapReplyInputMock.getTransportAddress()).thenReturn(transportAddress);
Mockito.when(sendMapReplyInputMock.getMapReply()).thenReturn(mapReply);
assertEquals(RPC_RESULT_SUCCESS.isSuccessful(), lispSouthboundRPC.sendMapReply(sendMapReplyInputMock).get().isSuccessful());
Mockito.verify(lispSouthboundPlugin).handleSerializedLispBuffer(transportAddress, MapReplySerializer.getInstance().serialize(mapReply), MessageType.MapReply);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress in project lispflowmapping by opendaylight.
the class LispSouthboundRpcTest method sendMapNotifyTest_inputNotNull.
/**
* Tests {@link LispSouthboundRPC#sendMapNotify} method.
*/
@Test
public void sendMapNotifyTest_inputNotNull() throws ExecutionException, InterruptedException {
final MapNotify mapNotify = getDefaultMapNotifyBuilder().build();
final TransportAddress transportAddress = new TransportAddressBuilder().build();
final SendMapNotifyInput sendMapNotifyInputMock = Mockito.mock(SendMapNotifyInput.class);
Mockito.when(sendMapNotifyInputMock.getTransportAddress()).thenReturn(transportAddress);
Mockito.when(sendMapNotifyInputMock.getMapNotify()).thenReturn(mapNotify);
assertEquals(RPC_RESULT_SUCCESS.isSuccessful(), lispSouthboundRPC.sendMapNotify(sendMapNotifyInputMock).get().isSuccessful());
Mockito.verify(lispSouthboundPlugin).handleSerializedLispBuffer(transportAddress, MapNotifySerializer.getInstance().serialize(mapNotify), MessageType.MapNotify);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress in project lispflowmapping by opendaylight.
the class LispMappingServiceTest method onAddMappingTest_noTransportAddress.
/**
* Tests {@link LispMappingService#onAddMapping} method with no TransportAddress.
*/
@Test
public void onAddMappingTest_noTransportAddress() {
final org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapregisternotification.MapRegister mapRegister = Mockito.mock(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapregisternotification.MapRegister.class);
final AddMapping addMapping = Mockito.mock(AddMapping.class);
final MapNotify mapNotify = new MapNotifyBuilder().setKeyId((short) 1).build();
Mockito.when(addMapping.getMapRegister()).thenReturn(mapRegister);
Mockito.when(mapRegister.getMappingRecordItem()).thenReturn(Lists.newArrayList(MAPPING_RECORD_ITEM_BUILDER.build()));
Mockito.when(tlsMapNotifyMock.get()).thenReturn(new MutablePair<>(mapNotify, null));
Mockito.when(addMapping.getTransportAddress()).thenReturn(TRANSPORT_ADDRESS_1);
// result
final SendMapNotifyInputBuilder smnib = new SendMapNotifyInputBuilder().setMapNotify(new org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapnotifymessage.MapNotifyBuilder().setKeyId((short) 1).build()).setTransportAddress(TRANSPORT_ADDRESS);
lispMappingService.onAddMapping(addMapping);
Mockito.verify(odlLispSbService).sendMapNotify(smnib.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress in project lispflowmapping by opendaylight.
the class LispMappingServiceTest method handleNonProxyMapRequestTest.
/**
* Tests {@link LispMappingService#handleNonProxyMapRequest} method.
*/
@Test
@SuppressWarnings("unchecked")
public void handleNonProxyMapRequestTest() {
final MapRequest mapRequest = Mockito.mock(MapRequest.class);
final TransportAddress transportAddress = Mockito.mock(TransportAddress.class);
lispMappingService.handleNonProxyMapRequest(mapRequest, transportAddress);
Mockito.verify(tlsMapRequestMock).set(Mockito.any(MutablePair.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress in project lispflowmapping by opendaylight.
the class LispNotificationHelperTest method getTransportAddressFromRlocTest_withApplicationDataIpv4PrefixAddress.
/**
* Tests {@link LispNotificationHelper#getTransportAddressFromRloc} method with ApplicationData type address.
*/
@Test(expected = NullPointerException.class)
public void getTransportAddressFromRlocTest_withApplicationDataIpv4PrefixAddress() {
final TransportAddress result = new TransportAddressBuilder().build();
assertEquals(result, LispNotificationHelper.getTransportAddressFromRloc(RLOC_APPLICATION_DATA_IPV6_PREFIX));
}
Aggregations