use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply 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.MapReply in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method registerAndQuery__TrafficEngineering.
public void registerAndQuery__TrafficEngineering() throws SocketTimeoutException {
cleanUP();
String macString = "01:02:03:04:05:06";
String ipString = "10.20.255.30";
HopBuilder hopBuilder = new HopBuilder();
hopBuilder.setAddress(new SimpleAddress(new IpAddress(new Ipv4Address(ipString))));
hopBuilder.setLrsBits(new LrsBits(true, false, true));
Hop hop1 = hopBuilder.build();
hopBuilder.setAddress(new SimpleAddress(new MacAddress(macString)));
hopBuilder.setLrsBits(new LrsBits(false, true, false));
Hop hop2 = hopBuilder.build();
ExplicitLocatorPathBuilder elpBuilder = new ExplicitLocatorPathBuilder();
elpBuilder.setHop(new ArrayList<Hop>());
elpBuilder.getHop().add(hop1);
elpBuilder.getHop().add(hop2);
EidBuilder eb = new EidBuilder();
eb.setAddressType(ExplicitLocatorPathLcaf.class);
eb.setVirtualNetworkId(null);
eb.setAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPathBuilder().setExplicitLocatorPath(elpBuilder.build()).build());
MapReply reply = registerAddressAndQuery(eb.build());
assertEquals(ExplicitLocatorPathLcaf.class, reply.getMappingRecordItem().get(0).getMappingRecord().getEid().getAddressType());
ExplicitLocatorPath receivedAddress = (ExplicitLocatorPath) reply.getMappingRecordItem().get(0).getMappingRecord().getEid().getAddress();
Hop receivedHop1 = (Hop) receivedAddress.getExplicitLocatorPath().getHop().get(0);
Hop receivedHop2 = (Hop) receivedAddress.getExplicitLocatorPath().getHop().get(1);
assertEquals(true, receivedHop1.getLrsBits().isLookup());
assertEquals(false, receivedHop1.getLrsBits().isRlocProbe());
assertEquals(true, receivedHop1.getLrsBits().isStrict());
assertEquals(false, receivedHop2.getLrsBits().isLookup());
assertEquals(true, receivedHop2.getLrsBits().isRlocProbe());
assertEquals(false, receivedHop2.getLrsBits().isStrict());
assertNotNull(receivedHop1.getAddress().getIpAddress().getIpv4Address());
assertNotNull(receivedHop2.getAddress().getMacAddress());
assertEquals(ipString, receivedHop1.getAddress().getIpAddress().getIpv4Address().getValue());
assertEquals(macString, receivedHop2.getAddress().getMacAddress().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply 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.lisp.proto.rev151105.MapReply 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method testPositivePrefixOverlappingNegativePrefix_lessSpecific.
private void testPositivePrefixOverlappingNegativePrefix_lessSpecific() {
cleanUP();
insertNBMappings(1L, "192.167.0.0/16", "192.169.0.0/16");
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));
insertNBMappings(1L, "192.0.0.0/8");
MappingServiceIntegrationTestUtil.checkSmr(socket, lms, mapService, 1L, "192.168.0.0");
mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.0.1/32"));
Eid expectedPositivePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.0.0.0/8");
mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
assertEquals(expectedPositivePrefix, mr.getEid());
assertTrue(MappingRecordUtil.isPositiveMapping(mr));
}
Aggregations