use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method registerQueryRegisterWithSmr.
public void registerQueryRegisterWithSmr() throws SocketTimeoutException {
cleanUP();
lms.setShouldUseSmr(true);
mapService.addAuthenticationKey(LispAddressUtil.asIpv4PrefixBinaryEid("153.16.254.1/32"), NULL_AUTH_KEY);
sleepForSeconds(1);
sendPacket(mapRegisterPacketWithNotify);
receiveMapNotify();
sleepForSeconds(1);
sendPacket(mapRequestPacket);
sleepForSeconds(1);
mapRegisterPacketWithoutNotify[mapRegisterPacketWithoutNotify.length - 1] += 1;
sendPacket(mapRegisterPacketWithoutNotify);
MapRequest smr = receiveMapRequest();
assertTrue(smr.isSmr());
Eid sourceEid = smr.getSourceEid().getEid();
assertTrue(LispAddressUtil.asIpv4Eid("153.16.254.1").equals(sourceEid));
Eid smrEid = smr.getEidItem().get(0).getEid();
assertTrue(LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32").equals(smrEid));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest 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");
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method sendMapRegisterTwiceWithDiffrentValues.
private MapReply sendMapRegisterTwiceWithDiffrentValues(Eid eid, Rloc rloc1, Rloc rloc2) throws SocketTimeoutException {
mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
sleepForSeconds(1);
MapRegister mb = createMapRegister(eid, rloc1);
MapNotify mapNotify = lms.handleMapRegister(mb).getLeft();
MapRequest mr = createMapRequest(eid);
MapReply mapReply = lms.handleMapRequest(mr);
assertEquals(mb.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc(), mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc());
mb = createMapRegister(eid, rloc2);
mapNotify = lms.handleMapRegister(mb).getLeft();
assertEquals(8, mapNotify.getNonce().longValue());
mr = createMapRequest(eid);
sendMapRequest(mr);
mapReply = lms.handleMapRequest(mr);
return mapReply;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method testTTLAfterClean.
private void testTTLAfterClean(MapRequest mapRequest) throws SocketTimeoutException {
MapReply mapReply;
sendMapRequest(mapRequest);
mapReply = receiveMapReply();
assertCorrectMapReplyTTLAndAction(mapReply, 15, Action.NativelyForward);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method processSmrPackets.
private List<MapRequest> processSmrPackets(SocketReader reader, String address, int expectedSmrs) {
InetAddress inetAddress = null;
try {
inetAddress = InetAddress.getByName(address);
} catch (UnknownHostException e) {
LOG.error("Unknown address {}.", address, e);
}
final List<MapRequest> requests = Lists.newArrayList();
byte[][] buffers = reader.getBuffers(expectedSmrs);
for (byte[] buf : buffers) {
ByteBuffer packet = ByteBuffer.wrap(buf);
if (MappingServiceIntegrationTestUtil.checkType(packet, MessageType.MapRequest)) {
MapRequest request = MapRequestSerializer.getInstance().deserialize(packet, inetAddress);
requests.add(request);
}
}
return requests;
}
Aggregations