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_withKeyValueAddress.
/**
* Tests {@link LispNotificationHelper#getTransportAddressFromRloc} method with KeyValueAddress type address.
*/
@Test
public void getTransportAddressFromRlocTest_withKeyValueAddress() {
final TransportAddress result = new TransportAddressBuilder().setIpAddress(new IpAddressBinary(ADDRESS_IPV4_BINARY)).setPort(new PortNumber(PORT)).build();
assertEquals(result, LispNotificationHelper.getTransportAddressFromRloc(RLOC_KEYVALUE_ADDRESS));
}
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_withDistinguishedNameAddress.
/**
* Tests {@link LispNotificationHelper#getTransportAddressFromRloc} method with DistinguishedName type address.
*/
@Test
public void getTransportAddressFromRlocTest_withDistinguishedNameAddress() {
final TransportAddress result = new TransportAddressBuilder().setIpAddress(new IpAddressBinary(ADDRESS_IPV4_BINARY)).setPort(new PortNumber(PORT)).build();
assertEquals(result, LispNotificationHelper.getTransportAddressFromRloc(RLOC_DISTINGUISHED_NAME_ADDRESS));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress in project lispflowmapping by opendaylight.
the class LispMappingService method onAddMapping.
@Override
public void onAddMapping(AddMapping mapRegisterNotification) {
Pair<MapNotify, List<TransportAddress>> result = handleMapRegister(mapRegisterNotification.getMapRegister());
if (result != null && result.getLeft() != null) {
MapNotify mapNotify = result.getLeft();
List<TransportAddress> rlocs = result.getRight();
if (rlocs == null) {
TransportAddressBuilder tab = new TransportAddressBuilder();
tab.setIpAddress(mapRegisterNotification.getTransportAddress().getIpAddress());
tab.setPort(new PortNumber(LispMessage.PORT_NUM));
sendMapNotify(mapNotify, tab.build());
} else {
for (TransportAddress ta : rlocs) {
sendMapNotify(mapNotify, ta);
}
}
} else {
LOG.debug("Not sending Map-Notify");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress in project lispflowmapping by opendaylight.
the class LispMappingService method sendMapNotify.
private void sendMapNotify(MapNotify mapNotify, TransportAddress address) {
SendMapNotifyInputBuilder smnib = new SendMapNotifyInputBuilder();
smnib.setMapNotify(new MapNotifyBuilder(mapNotify).build());
smnib.setTransportAddress(address);
getLispSB().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 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);
}
Aggregations