Search in sources :

Example 1 with AddMappingInput

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

Example 2 with AddMappingInput

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

the class HostInformationManagerTest method testScenarioPortDataFirst.

@Test
public void testScenarioPortDataFirst() {
    HostInformationManager hostInformationManager = getDefaultHostInformationManager();
    addPortData1(hostInformationManager);
    Mockito.verify(lfmDbService, Mockito.times(0)).addMapping(Mockito.any(AddMappingInput.class));
    addRlocData(hostInformationManager);
    AddMappingInput desiredMappingRecord = createAddMappingInput(SAMPLE_RLOC, SAMPLE_EID_1);
    Mockito.verify(lfmDbService).addMapping(desiredMappingRecord);
    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 3 with AddMappingInput

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

the class HostInformationManagerTest method testScenarioRlocFirst.

@Test
public void testScenarioRlocFirst() {
    HostInformationManager hostInformationManager = getDefaultHostInformationManager();
    addRlocData(hostInformationManager);
    Mockito.verify(lfmDbService, Mockito.times(0)).addMapping(Mockito.any(AddMappingInput.class));
    addPortData1(hostInformationManager);
    AddMappingInput desiredMappingRecord = createAddMappingInput(SAMPLE_RLOC, SAMPLE_EID_1);
    Mockito.verify(lfmDbService).addMapping(desiredMappingRecord);
    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 4 with AddMappingInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.AddMappingInput 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);
}
Also used : 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) 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)

Example 5 with AddMappingInput

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

the class HostInformationManagerTest method testOnlyUnprocessedPortDataIsBeingProcessed.

@Test
public void testOnlyUnprocessedPortDataIsBeingProcessed() {
    HostInformationManager hostInformationManager = getDefaultHostInformationManager();
    addPortData1(hostInformationManager);
    Mockito.verify(lfmDbService, Mockito.times(0)).addMapping(Mockito.any(AddMappingInput.class));
    addRlocData(hostInformationManager);
    addPortData2(hostInformationManager);
    Mockito.verify(lfmDbService, Mockito.times(2)).addMapping(Mockito.any(AddMappingInput.class));
    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)

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