use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping._record.container.MappingRecordBuilder in project lispflowmapping by opendaylight.
the class LispUtil method buildAddMappingInput.
// private static final Logger LOG = LoggerFactory.getLogger(LispUtil.class);
public static AddMappingInput buildAddMappingInput(Eid eid, List<LocatorRecord> locators) {
MappingRecordBuilder mrb = new MappingRecordBuilder();
mrb.setAction(Action.NoAction).setAuthoritative(true).setEid(eid).setLocatorRecord(locators).setMapVersion((short) 0).setRecordTtl(1440);
AddMappingInputBuilder mib = new AddMappingInputBuilder();
mib.setMappingRecord(mrb.build());
return mib.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping._record.container.MappingRecordBuilder in project lispflowmapping by opendaylight.
the class LispUtilTest method buildAddMappingInputTest.
/**
* Tests {@link LispUtil#buildAddMappingInput} method.
*/
@Test
public void buildAddMappingInputTest() {
final MappingRecord mappingRecord = new MappingRecordBuilder().setAction(MappingRecord.Action.NoAction).setAuthoritative(true).setEid(EID).setLocatorRecord(Lists.newArrayList(getDefaultLocatorRecord())).setMapVersion((short) 0).setRecordTtl(RECORD_TTL).build();
final AddMappingInput expectedResult = new AddMappingInputBuilder().setMappingRecord(mappingRecord).build();
final AddMappingInput result = LispUtil.buildAddMappingInput(EID, Lists.newArrayList(LOCATOR_RECORD));
assertEquals(expectedResult, result);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping._record.container.MappingRecordBuilder in project lispflowmapping by opendaylight.
the class MultiSiteScenario method prepareMappingRecord.
private MappingRecordBuilder prepareMappingRecord(final EidType eidType, final Site srcSite, final Site... dstSites) {
assertTrue(isEidEquals(dstSites));
final MappingRecordBuilder mrb = prepareMappingRecordGeneral(eidType, srcSite, dstSites[0]);
final List<LocatorRecord> locatorRecords = new ArrayList<>();
if (!dstSites[0].isForDeletion) {
for (Site dstSite : dstSites) {
if (dstSite.getRloc() != null) {
locatorRecords.add(provideLocatorRecord(LispAddressUtil.asIpv4Rloc(dstSite.getRloc()), dstSite.getRloc(), dstSite.getWeight(), dstSite.getPriority()));
}
}
}
mrb.setLocatorRecord(locatorRecords);
return mrb;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping._record.container.MappingRecordBuilder in project lispflowmapping by opendaylight.
the class MultiSiteScenario method provideCommonMapRecordBuilder.
private MappingRecordBuilder provideCommonMapRecordBuilder() {
final MappingRecordBuilder mappingRecordBuilder = new MappingRecordBuilder();
mappingRecordBuilder.setRecordTtl(TTL);
mappingRecordBuilder.setAction(MappingRecord.Action.NoAction);
mappingRecordBuilder.setAuthoritative(true);
mappingRecordBuilder.setTimestamp(System.currentTimeMillis());
return mappingRecordBuilder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping._record.container.MappingRecordBuilder in project lispflowmapping by opendaylight.
the class MultiSiteScenario method storeNorthMappingSrcDst.
void storeNorthMappingSrcDst(final Site srcSite, final Site... dstSite) {
final MappingRecordBuilder mrb = prepareMappingRecord(EidType.EID_SRC_DST, srcSite, dstSite);
mapService.addMapping(MappingOrigin.Northbound, mrb.getEid(), new SiteId(DEFAULT_SITE_ID), new MappingData(mrb.build()));
}
Aggregations