use of org.opendaylight.lispflowmapping.lisp.type.MappingData in project lispflowmapping by opendaylight.
the class LispMapCacheStringifier method prettyPrintFMCMappings.
public static String prettyPrintFMCMappings(ILispDAO dao) {
final StringBuilder sb = new StringBuilder();
dao.getAll(new IRowVisitor() {
public void visitRow(Object keyId, String valueKey, Object value) {
switch(valueKey) {
case SubKeys.RECORD:
MappingData md = (MappingData) value;
sb.append(Stringifier.getString(md.getRecord(), 2));
sb.append("\n");
break;
default:
break;
}
}
});
sb.append("\n");
return sb.toString();
}
use of org.opendaylight.lispflowmapping.lisp.type.MappingData in project lispflowmapping by opendaylight.
the class LispMapCacheStringifier method prettyPrintSMCMappings.
@SuppressWarnings("unchecked")
public static String prettyPrintSMCMappings(ILispDAO dao) {
final StringBuilder sb = new StringBuilder();
final IRowVisitor mappingVisitor = (new IRowVisitor() {
public void visitRow(Object keyId, String valueKey, Object value) {
switch(valueKey) {
case SubKeys.RECORD:
MappingData md = (MappingData) value;
sb.append(Stringifier.getString(md.getRecord(), 2));
sb.append("\n");
break;
case SubKeys.SUBSCRIBERS:
Set<Subscriber> subscribers = (Set<Subscriber>) value;
sb.append(prettyPrintSubscriberSet(subscribers, 4));
sb.append("\n");
break;
default:
break;
}
}
});
dao.getAll(new IRowVisitor() {
String lastKey = "";
public void visitRow(Object keyId, String valueKey, Object value) {
String key = keyId.getClass().getSimpleName() + "#" + keyId;
if (!lastKey.equals(key)) {
sb.append("Instance ID " + keyId + "\n");
}
if (valueKey.equals(SubKeys.VNI)) {
((ILispDAO) value).getAll(mappingVisitor);
}
lastKey = key;
}
});
return sb.toString();
}
use of org.opendaylight.lispflowmapping.lisp.type.MappingData in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method timedOutMappingRecord.
private void timedOutMappingRecord() {
cleanUP();
mapService.setMappingMerge(true);
// mapping expires after 1 second
ConfigIni.getInstance().setRegistrationValiditySb(1000L);
final Eid eid = LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32", new InstanceIdType(10L));
final MappingRecord mappingRecord = MappingServiceIntegrationTestUtil.getDefaultMappingRecordBuilder(eid).setRecordTtl(1000).build();
mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
mapService.addMapping(MappingOrigin.Southbound, eid, MappingServiceIntegrationTestUtil.DEFAULT_SITE_ID, new MappingData(mappingRecord, System.currentTimeMillis()));
sleepForSeconds(2);
MappingRecord resultRecord = (MappingRecord) mapService.getMapping(MappingOrigin.Southbound, eid);
assertNull(resultRecord);
ConfigIni.getInstance().setRegistrationValiditySb(ConfigIni.getInstance().getDefaultRegistrationValiditySb());
}
use of org.opendaylight.lispflowmapping.lisp.type.MappingData 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.lispflowmapping.lisp.type.MappingData in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method insertNBMapping.
private void insertNBMapping(Eid eid, List<Rloc> rlocs) {
MappingRecord record = MappingServiceIntegrationTestUtil.getDefaultMappingRecordBuilder(eid, rlocs).build();
mapService.addMapping(MappingOrigin.Northbound, record.getEid(), null, new MappingData(record));
sleepForMilliseconds(100);
MappingServiceIntegrationTestUtil.printMapCacheState(mapService);
}
Aggregations