Search in sources :

Example 1 with TransportAddress

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);
}
Also used : MapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapreplymessage.MapReply) TransportAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress) SendMapReplyInput(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapReplyInput) TransportAddressBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder) Test(org.junit.Test)

Example 2 with TransportAddress

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);
}
Also used : SendMapNotifyInput(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapNotifyInput) TransportAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress) MapNotify(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapnotifymessage.MapNotify) TransportAddressBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder) Test(org.junit.Test)

Example 3 with TransportAddress

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());
}
Also used : SendMapNotifyInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapNotifyInputBuilder) GotMapNotify(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapNotify) MapNotify(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify) AddMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.AddMapping) MapNotifyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapnotifymessage.MapNotifyBuilder) Test(org.junit.Test)

Example 4 with TransportAddress

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));
}
Also used : MutablePair(org.apache.commons.lang3.tuple.MutablePair) MapRequest(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest) TransportAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress) Test(org.junit.Test)

Example 5 with TransportAddress

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));
}
Also used : TransportAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress) TransportAddressBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder) Test(org.junit.Test)

Aggregations

TransportAddress (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress)22 Test (org.junit.Test)18 TransportAddressBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder)17 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)12 IpAddressBinary (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.IpAddressBinary)12 MapNotifyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapnotifymessage.MapNotifyBuilder)4 GotMapNotify (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapNotify)3 MapNotify (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify)3 MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest)3 ArrayList (java.util.ArrayList)2 MutablePair (org.apache.commons.lang3.tuple.MutablePair)2 MappingRecordItemBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItemBuilder)2 SendMapNotifyInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapNotifyInputBuilder)2 InetAddress (java.net.InetAddress)1 UnknownHostException (java.net.UnknownHostException)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Set (java.util.Set)1 MappingData (org.opendaylight.lispflowmapping.lisp.type.MappingData)1