Search in sources :

Example 1 with MappingOrigin

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin in project lispflowmapping by opendaylight.

the class DSBEInputUtil method toMapping.

public static Mapping toMapping(MappingOrigin origin, Eid key) {
    MappingBuilder mb = new MappingBuilder();
    mb.setEidUri(new EidUri(LispAddressStringifier.getURIString(key)));
    mb.setOrigin(origin);
    mb.setMappingRecord(new MappingRecordBuilder().setEid(key).build());
    return mb.build();
}
Also used : MappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingBuilder) XtrIdMappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingBuilder) MappingRecordBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder) EidUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri)

Example 2 with MappingOrigin

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin in project lispflowmapping by opendaylight.

the class MappingServiceTest method addMappingTest_fromNorthbound.

/**
 * Tests {@link MappingService#addMapping} method from northbound.
 */
@Test
public void addMappingTest_fromNorthbound() throws ExecutionException, InterruptedException {
    // input
    final MappingOrigin origin = MappingOrigin.Northbound;
    final MappingRecord record = getDefaultMappingRecordBuilder().setXtrId(XTR_ID).build();
    final MappingData data = getDefaultMappingData(record);
    mappingService.addMapping(origin, IPV4_EID, SITE_ID, data);
    Mockito.verify(dsbe).addMapping(DSBEInputUtil.toMapping(origin, IPV4_EID, SITE_ID, data));
    Mockito.verifyZeroInteractions(mappingSystem);
    Mockito.verifyNoMoreInteractions(dsbe);
}
Also used : MappingOrigin(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin) MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord) MappingData(org.opendaylight.lispflowmapping.lisp.type.MappingData) Test(org.junit.Test)

Example 3 with MappingOrigin

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin in project lispflowmapping by opendaylight.

the class InstanceIdentifierUtil method createMappingIid.

public static InstanceIdentifier<Mapping> createMappingIid(Eid eid, MappingOrigin orig) {
    Preconditions.checkNotNull(eid, "Mapping needs an EID entry!");
    VirtualNetworkIdentifierKey vniKey = new VirtualNetworkIdentifierKey(new VniUri(Long.toString(getLispInstanceId(eid))));
    MappingKey eidKey = new MappingKey(new EidUri(LispAddressStringifier.getURIString(eid)), orig);
    return InstanceIdentifier.create(MappingDatabase.class).child(VirtualNetworkIdentifier.class, vniKey).child(Mapping.class, eidKey);
}
Also used : VniUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.VniUri) VirtualNetworkIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifier) EidUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri) VirtualNetworkIdentifierKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifierKey) XtrIdMappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingKey) MappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey)

Example 4 with MappingOrigin

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin in project lispflowmapping by opendaylight.

the class InstanceIdentifierUtil method createXtrIdMappingIid.

public static InstanceIdentifier<XtrIdMapping> createXtrIdMappingIid(Eid eid, MappingOrigin orig, XtrId xtrId) {
    Preconditions.checkNotNull(eid, "Mapping needs an EID entry!");
    Preconditions.checkNotNull(xtrId, "Mapping needs an xTR-ID entry!");
    VirtualNetworkIdentifierKey vniKey = new VirtualNetworkIdentifierKey(new VniUri(Long.toString(getLispInstanceId(eid))));
    MappingKey eidKey = new MappingKey(new EidUri(LispAddressStringifier.getURIString(eid)), orig);
    XtrIdMappingKey xtrIdKey = new XtrIdMappingKey(new XtrIdUri(LispAddressStringifier.getURIString(xtrId)));
    return InstanceIdentifier.create(MappingDatabase.class).child(VirtualNetworkIdentifier.class, vniKey).child(Mapping.class, eidKey).child(XtrIdMapping.class, xtrIdKey);
}
Also used : XtrIdMappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingKey) MappingDatabase(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingDatabase) VniUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.VniUri) EidUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri) VirtualNetworkIdentifierKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifierKey) Mapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping) XtrIdMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMapping) XtrIdMappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingKey) MappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey) XtrIdUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.XtrIdUri)

Example 5 with MappingOrigin

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin in project lispflowmapping by opendaylight.

the class MappingSystem method addMapping.

private void addMapping(MappingOrigin origin, Eid key, MappingData mappingData, MappingChange changeType) {
    sbMappingTimeoutService.removeExpiredMappings();
    if (mappingData == null) {
        LOG.warn("addMapping() called with null mapping, ignoring");
        return;
    }
    if (LOG.isDebugEnabled()) {
        LOG.debug("DAO: Adding {} mapping for EID {}", origin, LispAddressStringifier.getString(key));
    }
    if (LOG.isTraceEnabled()) {
        LOG.trace("mappingData = {}", mappingData.getString());
    }
    // Save the old mapping for the key before we modify anything, so that we can detect changes later
    final MappingRecord oldMapping = getMappingRecord(getMapping(key));
    if (origin == MappingOrigin.Southbound) {
        XtrId xtrId = mappingData.getXtrId();
        if (xtrId == null && mappingMerge && mappingData.isMergeEnabled()) {
            LOG.warn("addMapping() called will null xTR-ID in MappingRecord, while merge is set, ignoring");
            return;
        }
        if (xtrId != null && mappingMerge) {
            if (mappingData.isMergeEnabled()) {
                smc.addMapping(key, xtrId, mappingData);
                handleMergedMapping(key);
                return;
            } else {
                clearPresentXtrIdMappings(key);
                smc.addMapping(key, xtrId, mappingData);
            }
        }
        addOrRefreshMappingInTimeoutService(key, mappingData);
    }
    tableMap.get(origin).addMapping(key, mappingData);
    // We need to check if the newly added mapping is covering negatives in SB, and remove those (with notification)
    if (mappingData.isPositive().or(true)) {
        handleSbNegativeMappings(key);
    }
    MappingRecord newMapping = getMappingRecord(getMapping(key));
    handleAddMappingNotifications(origin, key, mappingData, oldMapping, newMapping, changeType);
}
Also used : MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord) XtrId(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrId)

Aggregations

MappingRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord)5 EidUri (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri)5 MappingBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingBuilder)3 XtrIdMappingBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingBuilder)3 MappingData (org.opendaylight.lispflowmapping.lisp.type.MappingData)2 SourceDestKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey)2 SiteId (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.SiteId)2 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)2 MappingRecordBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder)2 VniUri (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.VniUri)2 MappingKey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey)2 XtrIdMappingKey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingKey)2 VirtualNetworkIdentifierKey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifierKey)2 Test (org.junit.Test)1 Subscriber (org.opendaylight.lispflowmapping.interfaces.dao.Subscriber)1 XtrId (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrId)1 MappingDatabase (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingDatabase)1 MappingOrigin (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin)1 XtrIdUri (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.XtrIdUri)1 Mapping (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping)1