use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord 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.lisp.proto.rev151105.mapping.record.container.MappingRecord in project lispflowmapping by opendaylight.
the class MappingSystemTest method getMappingTest_NbSbIntersection_mergeMappings.
/**
* Tests {@link MappingSystem#getMapping} method, northbound and southbound intersection with single Ipv4 type
* locator, southbound non-null. Returns the merged mapping.
*/
@Test
public void getMappingTest_NbSbIntersection_mergeMappings() throws NoSuchFieldException, IllegalAccessException {
setLookupPolicy(IMappingService.LookupPolicy.NB_AND_SB);
final MappingRecord mappingRecord = getDefaultMappingRecordBuilder().setLocatorRecord(Lists.newArrayList(getDefaultLocatorRecordBuilder().build())).build();
final MappingData nbMappingData = getDefaultMappingData(mappingRecord);
final MappingData sbMappingData = getDefaultMappingData(mappingRecord);
// this mock will be ultimately returned when MappingMergeUtil.computeNbSbIntersection is called
final MappingData resultMock = Mockito.mock(MappingData.class);
PowerMockito.mockStatic(MappingMergeUtil.class);
Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_IPV4_DST)).thenReturn(nbMappingData);
Mockito.when(smcMock.getMapping(EID_IPV4_DST, (XtrId) null)).thenReturn(sbMappingData);
PowerMockito.when(MappingMergeUtil.computeNbSbIntersection(nbMappingData, sbMappingData)).thenReturn(resultMock);
assertEquals(resultMock, mappingSystem.getMapping(EID_IPV4_SRC, EID_IPV4_DST));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord in project lispflowmapping by opendaylight.
the class MappingSystemTest method getMappingTest_NbFirst_withServicePathDestinationAddress_singleIpv4LocatorRecord.
/**
* Tests {@link MappingSystem#getMapping} method with ServicePath type dst address and single Ipv4 type locator
* record. Returns the original mapping.
*/
@Test
public void getMappingTest_NbFirst_withServicePathDestinationAddress_singleIpv4LocatorRecord() {
final MappingRecord mappingRecord = getDefaultMappingRecordBuilder().setLocatorRecord(Lists.newArrayList(// Ipv4 type Rloc
getDefaultLocatorRecordBuilder().build())).build();
final MappingData mappingData = getDefaultMappingData(mappingRecord);
Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_SERVICE_PATH)).thenReturn(mappingData);
assertEquals(mappingData, mappingSystem.getMapping(EID_IPV4_SRC, EID_SERVICE_PATH));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord in project lispflowmapping by opendaylight.
the class MappingSystemTest method getMappingTest_NbFirst_withServicePathDestinationAddress_multipleLocatorRecords.
/**
* Tests {@link MappingSystem#getMapping} method with ServicePath type dst address and multiple locator record.
* Returns the original mapping.
*/
@Test
public void getMappingTest_NbFirst_withServicePathDestinationAddress_multipleLocatorRecords() {
final MappingRecord mappingRecord = getDefaultMappingRecordBuilder().setLocatorRecord(Lists.newArrayList(// set two locators
getDefaultLocatorRecordBuilder().build(), getDefaultLocatorRecordBuilder().build())).build();
final MappingData mappingData = getDefaultMappingData(mappingRecord);
Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_SERVICE_PATH)).thenReturn(mappingData);
assertEquals(mappingData, mappingSystem.getMapping(EID_IPV4_SRC, EID_SERVICE_PATH));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord in project lispflowmapping by opendaylight.
the class MappingSystemTest method getMappingTest_NbFirst_withServicePathDestinationAddress_singleELPLocatorRecord.
/**
* Tests {@link MappingSystem#getMapping} method with ServicePath type dst address and single ExplicitLocatorPath
* type locator record.
*/
@Test
public void getMappingTest_NbFirst_withServicePathDestinationAddress_singleELPLocatorRecord() throws UnknownHostException {
final MappingRecord mappingRecord = getDefaultMappingRecordBuilder().setLocatorRecord(Lists.newArrayList(getDefaultLocatorRecordBuilder().setRloc(getELPTypeRloc()).build())).build();
final MappingData mappingData = getDefaultMappingData(mappingRecord);
Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_SERVICE_PATH)).thenReturn(mappingData);
final MappingData result = (MappingData) mappingSystem.getMapping(EID_IPV4_SRC, EID_SERVICE_PATH);
final Ipv4Binary ipv4Result = (Ipv4Binary) result.getRecord().getLocatorRecord().get(0).getRloc().getAddress();
assertTrue(Arrays.equals(InetAddress.getByName(IPV4_STRING_3).getAddress(), ipv4Result.getIpv4Binary().getValue()));
}
Aggregations