use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.AddMappingInputBuilder 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.mappingservice.rev150906.AddMappingInputBuilder 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.mappingservice.rev150906.AddMappingInputBuilder in project lispflowmapping by opendaylight.
the class MappingServiceTest method addMappingTest.
/**
* Tests {@link MappingService#addMapping} method.
*/
@Test
public void addMappingTest() throws ExecutionException, InterruptedException {
final MappingRecordBuilder mappingRecordBuilder = getDefaultMappingRecordBuilder();
final AddMappingInput addMappingInput = new AddMappingInputBuilder().setMappingRecord(mappingRecordBuilder.build()).build();
final Future<RpcResult<Void>> result = mappingService.addMapping(addMappingInput);
Mockito.verify(dsbe).addMapping(RPCInputConvertorUtil.toMapping(addMappingInput));
assertEquals(RPC_RESULT_SUCCESS.getErrors(), result.get().getErrors());
assertEquals(RPC_RESULT_SUCCESS.getResult(), result.get().getResult());
assertEquals(RPC_RESULT_SUCCESS.isSuccessful(), result.get().isSuccessful());
}
Aggregations