use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method mapRequestMapRegisterAndMapRequestTestTimeout.
// ------------------- TimeOut Tests -----------
public void mapRequestMapRegisterAndMapRequestTestTimeout() throws SocketTimeoutException {
cleanUP();
ConfigIni.getInstance().setSmrRetryCount(0);
Eid eid = LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32");
mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
sleepForSeconds(1);
MapRequest mapRequest = MappingServiceIntegrationTestUtil.getDefaultMapRequestBuilder(eid).build();
sendMapRequest(mapRequest);
MapReply mapReply = receiveMapReply();
assertEquals(4, mapReply.getNonce().longValue());
assertEquals(0, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().size());
MapRegister mapRegister = MappingServiceIntegrationTestUtil.getDefaultMapRegisterBuilder(eid).build();
sendMapRegister(mapRegister);
MapNotify mapNotify = receiveMapNotify();
assertEquals(8, mapNotify.getNonce().longValue());
sleepForSeconds(1);
sendMapRequest(mapRequest);
mapReply = receiveMapReply();
assertEquals(4, mapReply.getNonce().longValue());
assertEquals(MappingServiceIntegrationTestUtil.DEFAULT_IPV4_RLOC, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc());
causeEntryToBeCleaned();
sendMapRequest(mapRequest);
mapReply = receiveMapReply();
assertEquals(0, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().size());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method testMapRegisterOverwritesSameSubkey.
public void testMapRegisterOverwritesSameSubkey() throws SocketTimeoutException {
cleanUP();
Eid eid = LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32");
SimpleAddress rloc1Value = new SimpleAddress(new IpAddress(new Ipv4Address("4.3.2.1")));
Rloc rloc1 = LispAddressUtil.asKeyValueAddress("subkey1", rloc1Value);
SimpleAddress rloc2Value = new SimpleAddress(new IpAddress(new Ipv4Address("4.3.2.2")));
Rloc rloc2 = LispAddressUtil.asKeyValueAddress("subkey2", rloc2Value);
MapReply mapReply = sendMapRegisterTwiceWithDiffrentValues(eid, rloc1, rloc2);
assertEquals(1, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().size());
assertEquals(rloc2, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method testMapRegisterOverwritesNoSubkey.
public void testMapRegisterOverwritesNoSubkey() throws SocketTimeoutException {
cleanUP();
mapService.setMappingMerge(false);
Eid eid = LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32");
Rloc rloc1Value = LispAddressUtil.asIpv4Rloc("4.3.2.1");
Rloc rloc2Value = LispAddressUtil.asIpv4Rloc("4.3.2.2");
MapReply mapReply = sendMapRegisterTwiceWithDiffrentValues(eid, rloc1Value, rloc2Value);
assertEquals(1, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().size());
assertEquals(rloc2Value, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method testPositiveMappingRemoval.
private void testPositiveMappingRemoval() {
cleanUP();
allowNullAuthenticationForAllIPv4(1L);
insertNBMappings(1L, "192.167.0.0/16", "192.169.0.0/16");
insertSBMappings(false, 1L, "192.168.32.0/19");
MapReply mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.0.1/32"));
Eid expectedNegativePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.0.0/19");
MappingRecord mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
assertEquals(expectedNegativePrefix, mr.getEid());
assertTrue(MappingRecordUtil.isNegativeMapping(mr));
mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.64.1/32"));
expectedNegativePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.64.0/18");
mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
assertEquals(expectedNegativePrefix, mr.getEid());
assertTrue(MappingRecordUtil.isNegativeMapping(mr));
mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.128.1/32"));
expectedNegativePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.128.0/17");
mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
assertEquals(expectedNegativePrefix, mr.getEid());
assertTrue(MappingRecordUtil.isNegativeMapping(mr));
MappingServiceIntegrationTestUtil.printMapCacheState(mapService);
mapService.removeMapping(MappingOrigin.Southbound, LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.32.0/19"));
MappingServiceIntegrationTestUtil.printMapCacheState(mapService);
mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.32.1/32"));
expectedNegativePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.0.0/16");
mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
assertEquals(expectedNegativePrefix, mr.getEid());
assertTrue(MappingRecordUtil.isNegativeMapping(mr));
MappingServiceIntegrationTestUtil.printMapCacheState(mapService);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method registerAndQuery__MAC.
public void registerAndQuery__MAC() throws SocketTimeoutException {
cleanUP();
String macAddress = "01:02:03:04:05:06";
MapReply reply = registerAddressAndQuery(LispAddressUtil.asMacEid(macAddress));
assertTrue(true);
Eid addressFromNetwork = reply.getMappingRecordItem().get(0).getMappingRecord().getEid();
assertEquals(MacAfi.class, addressFromNetwork.getAddressType());
String macAddressFromReply = ((Mac) addressFromNetwork.getAddress()).getMac().getValue();
assertEquals(macAddress, macAddressFromReply);
}
Aggregations