use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Dst in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method insertNBMappingSourceDest.
private void insertNBMappingSourceDest(long iid, String src, String dst, String locator) {
String srcAddress = MaskUtil.getPrefixAddress(src);
String dstAddress = MaskUtil.getPrefixAddress(dst);
int srcMask = Integer.parseInt(MaskUtil.getPrefixMask(src));
int dstMask = Integer.parseInt(MaskUtil.getPrefixMask(dst));
LOG.debug("Adding Northbound mapping in VNI {} for prefix {}|{}, locator {}", iid, src, dst, locator);
Eid eid = LispAddressUtil.asSrcDstEid(srcAddress, dstAddress, srcMask, dstMask, iid);
List<Rloc> rlocs = Arrays.asList(LispAddressUtil.asIpv4Rloc(locator));
insertNBMapping(eid, rlocs);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Dst in project lispflowmapping by opendaylight.
the class MultiTableMapCache method getOrInstantiateSDInnerDao.
// SrcDst LCAFs are stored in a 2-tier DAO with dst having priority over src.
// This method returns the DAO associated to a dst or creates it if it doesn't exist.
private ILispDAO getOrInstantiateSDInnerDao(Eid address, ILispDAO mappingsDb) {
Eid dstKey = SourceDestKeyHelper.getDstBinary(address);
ILispDAO srcDstDao = (ILispDAO) mappingsDb.getSpecific(dstKey, SubKeys.LCAF_SRCDST);
if (srcDstDao == null) {
// inserts nested table for source
srcDstDao = mappingsDb.putNestedTable(dstKey, SubKeys.LCAF_SRCDST);
}
return srcDstDao;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Dst in project lispflowmapping by opendaylight.
the class MappingSystem method notifyChange.
public void notifyChange(Eid eid, MappingRecord mapping, MappingChange mappingChange) {
Set<Subscriber> subscribers = getSubscribers(eid);
Set<Subscriber> dstSubscribers = null;
// For SrcDst LCAF also send SMRs to Dst prefix
if (eid.getAddress() instanceof SourceDestKey) {
Eid dstAddr = SourceDestKeyHelper.getDstBinary(eid);
dstSubscribers = getSubscribers(dstAddr);
notifyChildren(dstAddr, mapping, mappingChange);
}
// No reason to send a notification when no subscribers exist
if (subscribers != null || dstSubscribers != null) {
publishNotification(mapping, eid, subscribers, dstSubscribers, mappingChange);
}
notifyChildren(eid, mapping, mappingChange);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Dst in project lispflowmapping by opendaylight.
the class MappingSystem method removeMapping.
@Override
public void removeMapping(MappingOrigin origin, Eid key) {
Eid dstAddr = null;
Set<Subscriber> subscribers = null;
Set<Subscriber> dstSubscribers = null;
MappingData mapping = (MappingData) tableMap.get(origin).getMapping(null, key);
if (LOG.isDebugEnabled()) {
LOG.debug("Removing mapping for EID {} from {}", LispAddressStringifier.getString(key), origin);
}
if (LOG.isTraceEnabled() && mapping != null) {
LOG.trace(mapping.getString());
}
MappingRecord notificationMapping = null;
if (mapping != null) {
notificationMapping = mapping.getRecord();
subscribers = getSubscribers(key);
// For SrcDst LCAF also send SMRs to Dst prefix
if (key.getAddress() instanceof SourceDestKey) {
dstAddr = SourceDestKeyHelper.getDstBinary(key);
dstSubscribers = getSubscribers(dstAddr);
}
}
removeSubscribersConditionally(origin, key);
if (origin == MappingOrigin.Southbound) {
removeFromSbTimeoutService(key);
}
if (origin == MappingOrigin.Southbound && mapping != null && mapping.isPositive().or(false)) {
mergeNegativePrefixes(key);
} else {
// mergeNegativePrefixes() above removes the mapping, so addNegativeMapping() will work correctly
tableMap.get(origin).removeMapping(key);
}
if (notificationMapping != null) {
publishNotification(notificationMapping, key, subscribers, dstSubscribers, MappingChange.Removed);
notifyChildren(key, notificationMapping, MappingChange.Removed);
if (dstAddr != null) {
notifyChildren(dstAddr, notificationMapping, MappingChange.Removed);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Dst in project lispflowmapping by opendaylight.
the class MappingSystemTest method getMappingTest_NbFirst_withServicePathDestinationAddress_singleIpv4LocatorRecord.
/**
* Tests {@link MappingSystem#getMapping} method with ServicePath type dst address and single Ipv4 type locator
* record. Returns the original mapping.
*/
@Test
public void getMappingTest_NbFirst_withServicePathDestinationAddress_singleIpv4LocatorRecord() {
final MappingRecord mappingRecord = getDefaultMappingRecordBuilder().setLocatorRecord(Lists.newArrayList(// Ipv4 type Rloc
getDefaultLocatorRecordBuilder().build())).build();
final MappingData mappingData = getDefaultMappingData(mappingRecord);
Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_SERVICE_PATH)).thenReturn(mappingData);
assertEquals(mappingData, mappingSystem.getMapping(EID_IPV4_SRC, EID_SERVICE_PATH));
}
Aggregations