Search in sources :

Example 6 with AddMappingInput

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

the class HostInformationManagerTest method testScenarioMultiplePortDataAndThenRloc.

@Test
public void testScenarioMultiplePortDataAndThenRloc() {
    HostInformationManager hostInformationManager = getDefaultHostInformationManager();
    addPortData1(hostInformationManager);
    addPortData2(hostInformationManager);
    Mockito.verify(lfmDbService, Mockito.times(0)).addMapping(Mockito.any(AddMappingInput.class));
    addRlocData(hostInformationManager);
    AddMappingInput desiredMappingRecord1 = createAddMappingInput(SAMPLE_RLOC, SAMPLE_EID_1);
    Mockito.verify(lfmDbService).addMapping(desiredMappingRecord1);
    AddMappingInput desiredMappingRecord2 = createAddMappingInput(SAMPLE_RLOC, SAMPLE_EID_2);
    Mockito.verify(lfmDbService).addMapping(desiredMappingRecord2);
    destroySingleton(hostInformationManager);
}
Also used : AddMappingInput(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.AddMappingInput) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 7 with AddMappingInput

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

the class HostInformationManagerTest method testProperMappingRecordRemoval.

@Test
public void testProperMappingRecordRemoval() {
    HostInformationManager hostInformationManager = getDefaultHostInformationManager();
    addPortData1(hostInformationManager);
    addRlocData(hostInformationManager);
    addUpdatedPortData1(hostInformationManager);
    RemoveMappingInput removeMappingInput = LispUtil.buildRemoveMappingInput(PORT_DATA_1.getPortEid());
    Mockito.verify(lfmDbService).removeMapping(removeMappingInput);
    AddMappingInput addMappingInput = createAddMappingInput(SAMPLE_RLOC, SAMPLE_EID_3);
    Mockito.verify(lfmDbService).addMapping(addMappingInput);
    destroySingleton(hostInformationManager);
}
Also used : RemoveMappingInput(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveMappingInput) AddMappingInput(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.AddMappingInput) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 8 with AddMappingInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.AddMappingInput 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());
}
Also used : MappingRecordBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) AddMappingInput(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.AddMappingInput) AddMappingInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.AddMappingInputBuilder) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 AddMappingInput (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.AddMappingInput)7 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 MappingRecordBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder)3 AddMappingInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.AddMappingInputBuilder)3 MappingRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord)1 RemoveMappingInput (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveMappingInput)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1