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();
}
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();
}
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;
}
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();
}
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)));
}
Aggregations