Search in sources :

Example 1 with EidUri

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri 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 EidUri

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

the class RPCInputConvertorUtil method toMapping.

private static Mapping toMapping(Eid eid) {
    MappingBuilder mb = new MappingBuilder();
    mb.setEidUri(new EidUri(LispAddressStringifier.getURIString(eid)));
    mb.setOrigin(MappingOrigin.Northbound);
    mb.setMappingRecord(new MappingRecordBuilder().setEid(eid).build());
    return mb.build();
}
Also used : MappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingBuilder) 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 3 with EidUri

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

the class MappingSystemTest method getMappingTest_NbFirst_withNullExpiredNbMapping.

/**
 * Tests {@link MappingSystem#getMapping} method with NB mapping == null, expired mapping.
 */
@Test
public void getMappingTest_NbFirst_withNullExpiredNbMapping() {
    final MappingData mappingData = getDefaultMappingData();
    mappingData.setTimestamp(EXPIRED_DATE);
    Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_IPV4_DST)).thenReturn(null);
    Mockito.when(smcMock.getMapping(EID_IPV4_DST, (XtrId) null)).thenReturn(mappingData, null);
    final Mapping mapping = new MappingBuilder().setEidUri(new EidUri("ipv4:" + IPV4_DST)).setOrigin(MappingOrigin.Southbound).setSiteId(Lists.newArrayList(SITE_ID)).setMappingRecord(mappingData.getRecord()).build();
    assertNull(mappingSystem.getMapping(EID_IPV4_SRC, EID_IPV4_DST));
    Mockito.verify(dsbeMock).removeMapping(mapping);
}
Also used : MappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingBuilder) EidUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri) MappingData(org.opendaylight.lispflowmapping.lisp.type.MappingData) Mapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 4 with EidUri

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

the class MappingSystemTest method getMappingTest_NbSbIntersection_withSbNull.

/**
 * Tests {@link MappingSystem#getMapping} method, northbound and southbound intersection with single Ipv4 type
 * locator, southbound null. Returns the original mapping.
 */
@Test
public void getMappingTest_NbSbIntersection_withSbNull() throws NoSuchFieldException, IllegalAccessException {
    setLookupPolicy(IMappingService.LookupPolicy.NB_AND_SB);
    final MappingRecord mappingRecord = getDefaultMappingRecordBuilder().setLocatorRecord(Lists.newArrayList(// Ipv4 type Rloc
    getDefaultLocatorRecordBuilder().build())).build();
    MappingData nbMappingData = getDefaultMappingData(mappingRecord);
    MappingData sbMappingData = getDefaultMappingData(mappingRecord);
    sbMappingData.setTimestamp(EXPIRED_DATE);
    Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_IPV4_DST)).thenReturn(nbMappingData);
    Mockito.when(smcMock.getMapping(EID_IPV4_DST, (XtrId) null)).thenReturn(sbMappingData, null);
    final Mapping mapping = new MappingBuilder().setEidUri(new EidUri("ipv4:" + IPV4_DST)).setOrigin(MappingOrigin.Southbound).setSiteId(Lists.newArrayList(SITE_ID)).setMappingRecord(mappingRecord).build();
    assertEquals(nbMappingData, mappingSystem.getMapping(EID_IPV4_SRC, EID_IPV4_DST));
    Mockito.verify(dsbeMock).removeMapping(mapping);
}
Also used : MappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingBuilder) MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord) EidUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri) MappingData(org.opendaylight.lispflowmapping.lisp.type.MappingData) Mapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 5 with EidUri

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

the class LispNotificationHelperTest method getMappingTest_SiteIdNotPresent.

/**
 * Tests {@link LispNotificationHelper#getMapping} method with invalid address, isXtrSiteIdPresent == false.
 */
@Test
public void getMappingTest_SiteIdNotPresent() {
    final MappingBuilder mappingBuilder_1 = new MappingBuilder().setMappingRecord(new MappingRecordBuilder().setEid(EID_IPV4).build()).setEidUri(new EidUri("ipv4:" + IPV4_STRING)).setOrigin(MappingOrigin.Southbound);
    final MappingBuilder mappingBuilder_2 = new MappingBuilder().setMappingRecord(new MappingRecordBuilder().setEid(EID_IPV6).build()).setEidUri(new EidUri("ipv6:" + IPV6_STRING)).setOrigin(MappingOrigin.Southbound);
    assertEquals(Lists.newArrayList(mappingBuilder_1.build(), mappingBuilder_2.build()), LispNotificationHelper.getMapping(getDefaultAddMapping(false)));
}
Also used : MappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingBuilder) AddMappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.AddMappingBuilder) 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) Test(org.junit.Test)

Aggregations

EidUri (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri)16 MappingBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingBuilder)11 MappingRecordBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder)5 Mapping (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping)5 Test (org.junit.Test)4 MappingRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord)4 VniUri (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.VniUri)4 XtrIdMappingBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingBuilder)4 AuthenticationKeyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKeyBuilder)3 VirtualNetworkIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifier)3 VirtualNetworkIdentifierKey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifierKey)3 MappingData (org.opendaylight.lispflowmapping.lisp.type.MappingData)2 AddMappingBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.AddMappingBuilder)2 SiteId (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.SiteId)2 AuthenticationKeyKey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKeyKey)2 MappingKey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey)2 XtrIdMapping (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMapping)2 XtrIdMappingKey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingKey)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 ArrayList (java.util.ArrayList)1