use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method test21SBnegativeToSBmoreSpecific.
/*
* Mapping change: adding a more specific southbound mapping overlapping a less specific negative mapping
* Support status: SUPPORTED
* Description: When a more specific SB mapping is added, the subscribers of the overlapping less specific existing
* negative SB mapping are notified, the negative is deleted, and then more specific negatives are
* created when requested.
*/
private void test21SBnegativeToSBmoreSpecific() {
cleanUP();
allowNullAuthenticationForAllIPv4(1L);
// First we add two negative mappings to NB with a hole between them
insertNBMappings(1L, "192.167.0.0/16", "192.169.0.0/16");
// We query for the hole, adding a negative SB mapping for 192.168.0.0/16 with a subscriber in the process
MapReply mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.0.1/32"));
Eid expectedNegativePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.0.0/16");
MappingRecord mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
assertEquals(expectedNegativePrefix, mr.getEid());
assertTrue(MappingRecordUtil.isNegativeMapping(mr));
// Add the more specific new overlapping SB mapping
registerSBMapping(1L, "192.168.254.0/24", "10.10.10.10");
// Notification is sent for the original prefix
MappingServiceIntegrationTestUtil.checkSmr(socket, lms, mapService, 1L, "192.168.0.0");
mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.0.1/32"));
expectedNegativePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.0.0/17");
mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
assertEquals(expectedNegativePrefix, mr.getEid());
assertTrue(MappingRecordUtil.isNegativeMapping(mr));
mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.254.1/32"));
Eid expectedPositivePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.254.0/24");
mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
assertEquals(expectedPositivePrefix, mr.getEid());
assertTrue(MappingRecordUtil.isPositiveMapping(mr));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method testGapIntersection.
/**
* Tests a negative mapping from an intersection of gaps in northbound and southbound.
*/
private void testGapIntersection() throws UnknownHostException {
// request an Eid from a gap between mappings
final MapReply mapReply = lms.handleMapRequest(newMapRequest(1L, "1.1.127.10/32"));
// expected negative mapping
final Address resultNegMapping = new Ipv4PrefixBinaryBuilder().setIpv4AddressBinary(new Ipv4AddressBinary(InetAddress.getByName("1.1.64.0").getAddress())).setIpv4MaskLength((short) 18).build();
assertEquals(resultNegMapping, mapReply.getMappingRecordItem().get(0).getMappingRecord().getEid().getAddress());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method test8NBtoSBexactMatch.
/*
* Mapping change: adding a southbound mapping matching a northbound mapping
* Support status: SUPPORTED
* Description: When a SB mapping is added that has an existing exact match NB counterpart the subscribers of the
* prefix are notified. This is not strictly necessary for the NB_FIRST policy, but it is still useful
* for the NB_AND_SB policy.
*/
private void test8NBtoSBexactMatch() {
cleanUP();
allowNullAuthenticationForAllIPv4(1L);
mapService.setLookupPolicy(IMappingService.LookupPolicy.NB_AND_SB);
// Original NB mapping
insertNBMapping(1L, "192.168.0.0/16", "172.16.0.1", "10.10.10.10");
// Subscribe, by sending a Map-Request
MapReply mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.0.1/32"));
// Add a mapping with the same EID but different locator set in SB
registerSBMapping(1L, "192.168.0.0/16", "10.10.10.10");
// Notification is sent for the prefix
MappingServiceIntegrationTestUtil.checkSmr(socket, lms, mapService, 1L, "192.168.0.0");
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method test18SBnegativeToNBmoreSpecific.
/*
* Mapping change: adding a more specific northbound mapping overlapping a less specific negative southbound mapping
* Support status: SUPPORTED
* Description: When a more specific NB mapping is added, the overlapping negative prefix is deleted, its
* subscribers notified, and then more specific negatives are created when requested.
*/
private void test18SBnegativeToNBmoreSpecific() {
cleanUP();
// First we add two negative mappings to NB with a hole between them
insertNBMappings(1L, "192.167.0.0/16", "192.169.0.0/16");
// We query for the hole, adding a negative SB mapping for 192.168.0.0/16 with a subscriber in the process
MapReply mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.0.1/32"));
Eid expectedNegativePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.0.0/16");
MappingRecord mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
assertEquals(expectedNegativePrefix, mr.getEid());
assertTrue(MappingRecordUtil.isNegativeMapping(mr));
// Add the more specific new overlapping NB mapping
insertNBMappings(1L, "192.168.1.0/24");
// Notification is sent for the original prefix
MappingServiceIntegrationTestUtil.checkSmr(socket, lms, mapService, 1L, "192.168.0.0");
// The original negative should now be broken up
mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.0.1/32"));
expectedNegativePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.0.0/24");
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.1.1/32"));
Eid expectedPositivePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.1.0/24");
mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
assertEquals(expectedPositivePrefix, mr.getEid());
assertTrue(MappingRecordUtil.isPositiveMapping(mr));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method testMultipleMappings.
private void testMultipleMappings() throws UnknownHostException {
final InstanceIdType iid = new InstanceIdType(1L);
// prefix from the intersection of NB and SB gaps
final String prefix1 = "1.1.127.10/32";
// prefix with existing mapping in NB
final String prefix2 = "1.1.200.255/32";
final String prefix3 = "1.3.255.255/32";
final MapRequest mapRequest = new MapRequestBuilder().setSmrInvoked(false).setEidItem(Lists.newArrayList(new EidItemBuilder().setEid(LispAddressUtil.asIpv4PrefixBinaryEid(prefix1, iid)).build(), new EidItemBuilder().setEid(LispAddressUtil.asIpv4PrefixBinaryEid(prefix2, iid)).build(), new EidItemBuilder().setEid(LispAddressUtil.asIpv4PrefixBinaryEid(prefix3, iid)).build())).build();
final MapReply mapReply = lms.handleMapRequest(mapRequest);
// expected result
final String resultPrefix1 = "1.1.64.0";
final Address resultNegMapping1 = new Ipv4PrefixBinaryBuilder().setIpv4AddressBinary(new Ipv4AddressBinary(InetAddress.getByName(resultPrefix1).getAddress())).setIpv4MaskLength((short) 18).build();
final String resultPrefix2 = "1.1.128.0";
final Address resultMapping2 = new Ipv4PrefixBinaryBuilder().setIpv4AddressBinary(new Ipv4AddressBinary(InetAddress.getByName(resultPrefix2).getAddress())).setIpv4MaskLength((short) 17).build();
final String resultPrefix3 = "1.3.0.0";
final Address resultNegMapping3 = new Ipv4PrefixBinaryBuilder().setIpv4AddressBinary(new Ipv4AddressBinary(InetAddress.getByName(resultPrefix3).getAddress())).setIpv4MaskLength((short) 16).build();
assertEquals(resultNegMapping1, mapReply.getMappingRecordItem().get(0).getMappingRecord().getEid().getAddress());
assertEquals(resultMapping2, mapReply.getMappingRecordItem().get(1).getMappingRecord().getEid().getAddress());
assertEquals(resultNegMapping3, mapReply.getMappingRecordItem().get(2).getMappingRecord().getEid().getAddress());
}
Aggregations