use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method testTTLAfterRegister.
private void testTTLAfterRegister(MapRequest mapRequest) throws SocketTimeoutException {
MapReply mapReply;
sendMapRequest(mapRequest);
mapReply = receiveMapReply();
assertEquals(LispAddressUtil.asIpv4Rloc("4.3.2.1"), mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc());
assertCorrectMapReplyTTLAndAction(mapReply, 254, Action.NoAction);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method registerAddressAndQuery.
// takes an address, packs it in a MapRegister, sends it, returns the
// MapReply
private MapReply registerAddressAndQuery(Eid eid) throws SocketTimeoutException {
mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
sleepForSeconds(1);
MapRegister mapRegister = MappingServiceIntegrationTestUtil.getDefaultMapRegisterBuilder(eid).build();
LOG.trace("Sending Map-Register via socket: {}", mapRegister);
sendMapRegister(mapRegister);
MapNotify mapNotify = receiveMapNotify();
LOG.trace("Received Map-Notify via socket: {}", mapNotify);
assertEquals(8, mapNotify.getNonce().longValue());
// wait for the notifications to propagate
sleepForSeconds(1);
MapRequest mapRequest = MappingServiceIntegrationTestUtil.getDefaultMapRequestBuilder(eid).build();
sendMapRequest(mapRequest);
return receiveMapReply();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method testTTLBeforeRegister.
private void testTTLBeforeRegister(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 sendProxyMapRequest.
private void sendProxyMapRequest(String rloc, int port, Rloc adLcaf) throws SocketTimeoutException, SocketException {
String eid = "10.1.0.1/32";
MapRequest mapRequest = createNonProxyMapRequest(eid, adLcaf);
sendMapRequest(mapRequest);
DatagramSocket nonProxySocket = new DatagramSocket(new InetSocketAddress(rloc, port));
MapRequest receivedMapRequest = MappingServiceIntegrationTestUtil.receiveMapRequest(nonProxySocket, MappingServiceIntegrationTestUtil.DEFAULT_SOCKET_TIMEOUT);
assertEquals(mapRequest.getNonce(), receivedMapRequest.getNonce());
assertEquals(mapRequest.getSourceEid(), receivedMapRequest.getSourceEid());
assertEquals(mapRequest.getItrRloc(), receivedMapRequest.getItrRloc());
assertEquals(mapRequest.getEidItem(), receivedMapRequest.getEidItem());
nonProxySocket.close();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method runPrefixTest.
private void runPrefixTest(Eid registerEID, Eid matchedAddress, Eid unMatchedAddress) throws SocketTimeoutException {
mapService.addAuthenticationKey(registerEID, NULL_AUTH_KEY);
sleepForSeconds(1);
MapRegisterBuilder mapRegister = new MapRegisterBuilder();
mapRegister.setWantMapNotify(true);
mapRegister.setNonce((long) 8);
mapRegister.setWantMapNotify(true);
mapRegister.setKeyId((short) 0);
mapRegister.setAuthenticationData(new byte[0]);
mapRegister.setNonce((long) 8);
mapRegister.setProxyMapReply(false);
MappingRecordBuilder etlr = new MappingRecordBuilder();
etlr.setRecordTtl(254);
etlr.setAction(Action.NoAction);
etlr.setAuthoritative(false);
etlr.setMapVersion((short) 0);
etlr.setEid(registerEID);
etlr.setRecordTtl(254);
LocatorRecordBuilder record = new LocatorRecordBuilder();
record.setRloc(LispAddressUtil.asIpv4Rloc("4.3.2.1"));
record.setLocalLocator(false);
record.setRlocProbed(false);
record.setRouted(true);
record.setMulticastPriority((short) 0);
record.setMulticastWeight((short) 0);
record.setPriority((short) 0);
record.setWeight((short) 0);
etlr.setLocatorRecord(new ArrayList<LocatorRecord>());
etlr.getLocatorRecord().add(record.build());
mapRegister.setMappingRecordItem(new ArrayList<MappingRecordItem>());
mapRegister.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(etlr.build()).build());
sendMapRegister(mapRegister.build());
MapNotify mapNotify = receiveMapNotify();
assertEquals(8, mapNotify.getNonce().longValue());
sleepForSeconds(1);
MapRequestBuilder mapRequest = new MapRequestBuilder();
mapRequest.setNonce((long) 4);
mapRequest.setSourceEid(new SourceEidBuilder().setEid(LispAddressUtil.asIpv4Eid(ourAddress)).build());
mapRequest.setEidItem(new ArrayList<EidItem>());
mapRequest.setAuthoritative(false);
mapRequest.setMapDataPresent(false);
mapRequest.setPitr(false);
mapRequest.setProbe(false);
mapRequest.setSmr(false);
mapRequest.setSmrInvoked(false);
mapRequest.getEidItem().add(new EidItemBuilder().setEid(matchedAddress).build());
mapRequest.setItrRloc(new ArrayList<ItrRloc>());
mapRequest.getItrRloc().add(new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv4Rloc(ourAddress)).build());
sendMapRequest(mapRequest.build());
MapReply mapReply = receiveMapReply();
assertEquals(4, mapReply.getNonce().longValue());
assertEquals(record.getRloc(), mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc());
mapRequest.setEidItem(new ArrayList<EidItem>());
mapRequest.getEidItem().add(new EidItemBuilder().setEid(unMatchedAddress).build());
sendMapRequest(mapRequest.build());
mapReply = receiveMapReply();
assertEquals(0, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().size());
}
Aggregations