use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes in project lispflowmapping by opendaylight.
the class MapNotifySerializationTest method deserialize__MultipleRecords.
@Test
public void deserialize__MultipleRecords() throws Exception {
// LISP(Type = 4 Map-Notify, I=1
// Record Counter: 4
// EID prefixes: 153.16.254.1 -- 152.16.254.1 -- 151.16.254.1 --
// 150.16.254.1
// Local RLOCs: 192.168.136.10 -- 192.168.136.11 -- 192.168.136.12 --
// 192.168.136.13
//
MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 00 " + // Record count
"04 " + "FF BB 00 00 00 00 00 00 00 01 00 14 87 c1 33 cd " + "d1 1e bc 80 fd 3e 71 11 81 17 40 74 26 25 44 bd " + // Record
"00 00 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " + // 1
"ff 00 00 05 00 01 c0 a8 88 0a " + // contd
"00 00 00 0a 01 20 10 00 00 00 00 01 98 10 fe 01 01 64 " + // 2
"ff 00 00 05 00 01 c0 a8 88 0b " + // contd
"00 00 00 0a 01 20 10 00 00 00 00 01 97 10 fe 01 01 64 " + // 3
"ff 00 00 05 00 01 c0 a8 88 0c " + // contd
"00 00 00 0a 01 20 10 00 00 00 00 01 96 10 fe 01 01 64 " + // 4
"ff 00 00 05 00 01 c0 a8 88 0d "));
assertEquals(4, mn.getMappingRecordItem().size());
assertEquals(LispAddressUtil.asIpv4PrefixBinaryEid("153.16.254.1/32"), mn.getMappingRecordItem().get(0).getMappingRecord().getEid());
assertEquals(LispAddressUtil.asIpv4PrefixBinaryEid("151.16.254.1/32"), mn.getMappingRecordItem().get(2).getMappingRecord().getEid());
assertEquals(LispAddressUtil.asIpv4Rloc("192.168.136.11"), mn.getMappingRecordItem().get(1).getMappingRecord().getLocatorRecord().get(0).getRloc());
assertEquals(LispAddressUtil.asIpv4Rloc("192.168.136.13"), mn.getMappingRecordItem().get(3).getMappingRecord().getLocatorRecord().get(0).getRloc());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes in project lispflowmapping by opendaylight.
the class MapNotifySerializationTest method deserialize__SomeEidToLocatorFiels.
@Test
public void deserialize__SomeEidToLocatorFiels() throws Exception {
// LISP(Type = 4 Map-Notify, I=0
// Record Counter: 4
// EID prefixes: 153.16.254.1 -- 152.16.254.1 -- 151.16.254.1 --
// 150.16.254.1
// Local RLOCs: 192.168.136.10 -- 192.168.136.11 -- 192.168.136.12 --
// 192.168.136.13
//
MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 00 " + //
"04 " + // Record count
"FF BB 00 00 00 00 00 00 00 01 00 14 b9 cd 7b 89 " + //
"65 c2 56 03 be dd 81 20 47 e5 c3 4f 56 02 e1 59 " + //
"00 00 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " + // 0
"ff 00 00 05 00 01 c0 a8 88 0a " + // contd
"00 00 00 0b 01 17 50 00 01 11 00 01 98 10 fe 01 01 64 " + // 1
"ff 00 00 05 00 01 c0 a8 88 0b " + // contd
"00 00 00 0c 01 20 00 00 02 22 00 01 97 10 fe 01 01 64 " + // 2
"ff 00 00 05 00 01 c0 a8 88 0c " + // contd
"00 00 00 0d 01 20 20 00 03 33 00 01 96 10 fe 01 01 64 " + // 3
"ff 00 00 05 00 01 c0 a8 88 0d "));
assertEquals(4, mn.getMappingRecordItem().size());
final MappingRecord record0 = mn.getMappingRecordItem().get(0).getMappingRecord();
final MappingRecord record1 = mn.getMappingRecordItem().get(1).getMappingRecord();
final MappingRecord record2 = mn.getMappingRecordItem().get(2).getMappingRecord();
final MappingRecord record3 = mn.getMappingRecordItem().get(3).getMappingRecord();
assertEquals(10, record0.getRecordTtl().intValue());
assertEquals(13, record3.getRecordTtl().intValue());
assertEquals(32, MaskUtil.getMaskForAddress(record0.getEid().getAddress()));
assertEquals(23, MaskUtil.getMaskForAddress(record1.getEid().getAddress()));
assertEquals(Action.NoAction, record0.getAction());
assertEquals(Action.SendMapRequest, record1.getAction());
assertEquals(Action.NoAction, record2.getAction());
assertEquals(Action.NativelyForward, record3.getAction());
assertTrue(record0.isAuthoritative());
assertTrue(record1.isAuthoritative());
assertFalse(record2.isAuthoritative());
assertFalse(record3.isAuthoritative());
assertEquals(0x000, record0.getMapVersion().shortValue());
assertEquals(0x111, record1.getMapVersion().shortValue());
assertEquals(0x222, record2.getMapVersion().shortValue());
assertEquals(0x333, record3.getMapVersion().shortValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes in project lispflowmapping by opendaylight.
the class MapRegisterSerializationTest method deserialize__SomeEidToLocatorFiels.
@Test
public void deserialize__SomeEidToLocatorFiels() throws Exception {
// LISP(Type = 3 Map-Register, P=1, M=1
// Record Counter: 4
// EID prefixes: 153.16.254.1 -- 152.16.254.1 -- 151.16.254.1 --
// 150.16.254.1
// Local RLOCs: 192.168.136.10 -- 192.168.136.11 -- 192.168.136.12 --
// 192.168.136.13
//
MapRegister mr = MapRegisterSerializer.getInstance().deserialize(hexToByteBuffer("38 00 01 " + //
"04 " + // Record count
"FF BB 00 00 00 00 00 00 00 01 00 14 b9 cd 7b 89 " + //
"65 c2 56 03 be dd 81 20 47 e5 c3 4f 56 02 e1 59 " + //
"00 00 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " + // 0
"ff 00 00 05 00 01 c0 a8 88 0a " + // contd
"00 00 00 0b 01 17 50 00 01 11 00 01 98 10 fe 01 01 64 " + // 1
"ff 00 00 05 00 01 c0 a8 88 0b " + // contd
"00 00 00 0c 01 20 00 00 02 22 00 01 97 10 fe 01 01 64 " + // 2
"ff 00 00 05 00 01 c0 a8 88 0c " + // contd
"00 00 00 0d 01 20 20 00 03 33 00 01 96 10 fe 01 01 64 " + // 3
"ff 00 00 05 00 01 c0 a8 88 0d "), null);
assertEquals(4, mr.getMappingRecordItem().size());
final MappingRecord record0 = mr.getMappingRecordItem().get(0).getMappingRecord();
final MappingRecord record1 = mr.getMappingRecordItem().get(1).getMappingRecord();
final MappingRecord record2 = mr.getMappingRecordItem().get(2).getMappingRecord();
final MappingRecord record3 = mr.getMappingRecordItem().get(3).getMappingRecord();
assertEquals(10, record0.getRecordTtl().intValue());
assertEquals(13, record3.getRecordTtl().intValue());
assertEquals(32, MaskUtil.getMaskForAddress(record0.getEid().getAddress()));
assertEquals(23, MaskUtil.getMaskForAddress(record1.getEid().getAddress()));
assertEquals(Action.NoAction, record0.getAction());
assertEquals(Action.SendMapRequest, record1.getAction());
assertEquals(Action.NoAction, record2.getAction());
assertEquals(Action.NativelyForward, record3.getAction());
assertTrue(record0.isAuthoritative());
assertTrue(record1.isAuthoritative());
assertFalse(record2.isAuthoritative());
assertFalse(record3.isAuthoritative());
assertEquals(0x000, record0.getMapVersion().shortValue());
assertEquals(0x111, record1.getMapVersion().shortValue());
assertEquals(0x222, record2.getMapVersion().shortValue());
assertEquals(0x333, record3.getMapVersion().shortValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method insertSBMappings.
private void insertSBMappings(boolean negative, long iid, String... prefixes) {
LOG.debug("Adding Southbound mappings in VNI {} for prefixes: {}", iid, prefixes);
final InstanceIdType iiType = new InstanceIdType(iid);
for (String prefix : prefixes) {
MappingRecord record;
if (negative) {
record = newMappingRecordNegative(prefix, iiType);
} else {
record = newMappingRecord(prefix, iiType);
}
mapService.addMapping(MappingOrigin.Southbound, record.getEid(), null, new MappingData(record, System.currentTimeMillis()));
}
MappingServiceIntegrationTestUtil.printMapCacheState(mapService);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes in project lispflowmapping by opendaylight.
the class MappingSystem method notifyChildren.
private void notifyChildren(Eid eid, MappingRecord mapping, MappingChange mappingChange) {
// Update/created only happens for NB mappings. We assume no overlapping prefix support for NB mappings - so
// this NB mapping should not have any children. Both for NB first and NB&SB cases all subscribers for SB
// prefixes that are equal or more specific to this NB prefix have to be notified of the potential change.
// Each subscriber is notified for the prefix that it is currently subscribed to, and MS should return to them
// a Map-Reply with the same prefix and update mapping in cases of EID_INTERSECTION_RLOC_NB_FIRST which is a
// new option we are creating TODO
Set<Eid> childPrefixes = getSubtree(MappingOrigin.Southbound, eid);
if (childPrefixes == null || childPrefixes.isEmpty()) {
return;
}
childPrefixes.remove(eid);
for (Eid prefix : childPrefixes) {
Set<Subscriber> subscribers = getSubscribers(prefix);
// No reason to send a notification when no subscribers exist
if (subscribers != null) {
publishNotification(mapping, prefix, subscribers, null, mappingChange);
}
}
}
Aggregations