use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrRequestMapping in project lispflowmapping by opendaylight.
the class LispXtrSouthboundHandlerTest method handlePacketTest_withMapRequest.
/**
* Tests {@link LispXtrSouthboundHandler#handlePacket} method with Map-Request.
*/
@Test
public void handlePacketTest_withMapRequest() throws InterruptedException {
final ArgumentCaptor<XtrRequestMapping> captor = ArgumentCaptor.forClass(XtrRequestMapping.class);
// expected result
final MapRequest expectedRequest = getDefaultMapRequestBuilder().build();
handler.handlePacket(extractLispPacket(MAP_REQUEST_PACKET_STRING, HEADER_LENGTH, LISP_MAP_REQUEST_PACKET_LENGTH));
Mockito.verify(lispSbPluginMock).sendNotificationIfPossible(captor.capture());
assertEquals(expectedRequest, captor.getValue().getMapRequest());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrRequestMapping in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method testRecievingNonProxyOnXtrPort.
public void testRecievingNonProxyOnXtrPort() throws SocketTimeoutException, SocketException, Throwable {
cleanUP();
configLispPlugin.shouldListenOnXtrPort(true);
notificationCalled = false;
final String eid = "10.10.10.10/32";
String rloc = "127.0.0.3";
int port = LispMessage.XTR_PORT_NUM;
RlocBuilder rb = new RlocBuilder();
rb.setAddressType(ApplicationDataLcaf.class);
rb.setVirtualNetworkId(null);
rb.setAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ApplicationDataBuilder().setApplicationData(new ApplicationDataBuilder().setAddress(new SimpleAddress(new IpAddress(new Ipv4Address(rloc)))).setLocalPortLow(new PortNumber(port)).build()).build());
Rloc adLcaf = rb.build();
final MapRequest mapRequest = createNonProxyMapRequest(eid, adLcaf);
((LispMappingService) lms).getNotificationService().registerNotificationListener(new XtrRequestMappingListener() {
@Override
public void onXtrRequestMapping(XtrRequestMapping notification) {
assertEquals(((Ipv4Prefix) mapRequest.getEidItem().get(0).getEid().getAddress()).getIpv4Prefix().getValue(), eid);
notificationCalled = true;
LOG.warn("notification arrived");
}
});
sendMapRequest(mapRequest, port);
for (int i = 0; i < MAX_NOTIFICATION_RETRYS; i++) {
if (notificationCalled) {
return;
} else {
LOG.warn("notification hasn't arrived, sleeping...");
Thread.sleep(500);
}
}
fail("Notification hasn't arrived");
}
Aggregations