Search in sources :

Example 96 with Dst

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);
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) Rloc(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc) ItrRloc(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc)

Example 97 with Dst

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;
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) ILispDAO(org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO)

Example 98 with Dst

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);
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) Subscriber(org.opendaylight.lispflowmapping.interfaces.dao.Subscriber) SourceDestKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey)

Example 99 with Dst

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);
        }
    }
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) Subscriber(org.opendaylight.lispflowmapping.interfaces.dao.Subscriber) MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord) SourceDestKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey) MappingData(org.opendaylight.lispflowmapping.lisp.type.MappingData)

Example 100 with Dst

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));
}
Also used : MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord) MappingData(org.opendaylight.lispflowmapping.lisp.type.MappingData) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)50 BigInteger (java.math.BigInteger)30 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)23 ArrayList (java.util.ArrayList)22 VersionDatapathIdConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)20 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)19 Ipv4Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match)18 UdpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch)18 TcpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch)17 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)16 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)15 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder)15 Ipv6Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match)14 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)13 SctpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch)13 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match)12 ArpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatch)12 FlowWildcardsV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10)12 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match)12 IpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder)9