Search in sources :

Example 11 with MappingBuilder

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

the class DSBEInputUtil method toMapping.

public static Mapping toMapping(MappingOrigin origin, Eid key, SiteId siteId, MappingData mappingData) {
    MappingRecord record = (mappingData != null) ? mappingData.getRecord() : null;
    List<SiteId> siteIds = (siteId != null) ? Arrays.asList(siteId) : null;
    return new MappingBuilder().setEidUri(new EidUri(LispAddressStringifier.getURIString(key))).setOrigin(origin).setSiteId(siteIds).setMappingRecord(record).build();
}
Also used : SiteId(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.SiteId) 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) 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)

Example 12 with MappingBuilder

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

the class DSBEInputUtil method toMapping.

public static Mapping toMapping(MappingOrigin origin, Eid key, @Nullable MappingData mappingData) {
    MappingRecord record = (mappingData != null) ? mappingData.getRecord() : new MappingRecordBuilder().setEid(key).build();
    SiteId siteId = (record != null) ? record.getSiteId() : null;
    List<SiteId> siteIds = (siteId != null) ? Arrays.asList(siteId) : null;
    return new MappingBuilder().setEidUri(new EidUri(LispAddressStringifier.getURIString(key))).setOrigin(origin).setSiteId(siteIds).setMappingRecord(record).build();
}
Also used : SiteId(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.SiteId) 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) MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord) 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 13 with MappingBuilder

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

the class LispNotificationHelper method getMapping.

public static List<Mapping> getMapping(AddMapping mapRegisterNotification) {
    List<Mapping> mappings = new ArrayList<Mapping>();
    for (int i = 0; i < mapRegisterNotification.getMapRegister().getMappingRecordItem().size(); i++) {
        MappingRecord record = mapRegisterNotification.getMapRegister().getMappingRecordItem().get(i).getMappingRecord();
        MappingBuilder mb = new MappingBuilder();
        mb.setEidUri(new EidUri(LispAddressStringifier.getURIString(record.getEid())));
        mb.setOrigin(MappingOrigin.Southbound);
        mb.setSiteId(getSiteId(mapRegisterNotification.getMapRegister()));
        mb.setMappingRecord(record);
        mappings.add(mb.build());
    }
    return mappings;
}
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) ArrayList(java.util.ArrayList) EidUri(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri) AddMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.AddMapping) Mapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping)

Example 14 with MappingBuilder

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

the class RPCInputConvertorUtil method toMapping.

private static Mapping toMapping(MappingRecord mapping) {
    MappingBuilder mb = new MappingBuilder();
    mb.setEidUri(new EidUri(LispAddressStringifier.getURIString(mapping.getEid())));
    mb.setOrigin(MappingOrigin.Northbound);
    mb.setMappingRecord(mapping);
    return mb.build();
}
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)

Example 15 with MappingBuilder

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

the class LispNotificationHelperTest method getMappingTest.

/**
 * Tests {@link LispNotificationHelper#getMapping} method with invalid address.
 */
@Test
public void getMappingTest() {
    final MappingBuilder mappingBuilder_1 = new MappingBuilder().setMappingRecord(new MappingRecordBuilder().setEid(EID_IPV4).build()).setEidUri(new EidUri("ipv4:" + IPV4_STRING)).setOrigin(MappingOrigin.Southbound).setSiteId(Lists.newArrayList(SITE_ID));
    final MappingBuilder mappingBuilder_2 = new MappingBuilder().setMappingRecord(new MappingRecordBuilder().setEid(EID_IPV6).build()).setEidUri(new EidUri("ipv6:" + IPV6_STRING)).setOrigin(MappingOrigin.Southbound).setSiteId(Lists.newArrayList(SITE_ID));
    assertEquals(Lists.newArrayList(mappingBuilder_1.build(), mappingBuilder_2.build()), LispNotificationHelper.getMapping(getDefaultAddMapping(true)));
}
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

MappingBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingBuilder)16 EidUri (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri)11 Test (org.junit.Test)8 Mapping (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping)8 XtrIdMappingBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingBuilder)7 MappingRecordBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder)6 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)6 MappingRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord)5 XtrIdMapping (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMapping)4 MappingData (org.opendaylight.lispflowmapping.lisp.type.MappingData)3 MappingKey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey)3 XtrIdMappingKey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.mapping.XtrIdMappingKey)3 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 AuthenticationKey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKey)2 AuthenticationKeyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKeyBuilder)2 ArrayList (java.util.ArrayList)1 AddMapping (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.AddMapping)1 LocatorRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecord)1 MappingAuthkey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey)1